Home Page Microblog



Download 2,44 Mb.
Pdf ko'rish
bet9/17
Sana30.12.2021
Hajmi2,44 Mb.
#90837
1   ...   5   6   7   8   9   10   11   12   ...   17
Bog'liq
mega-tutorial

(venv) $ mkdir app

The __init__.py for the



app

package is going to contain the following code:

Listing 1.1: app/__init__.py

: Flask application instance



from

flask

import

Flask

app

=

Flask(__name__)

from

app

import

routes

The script above simply creates the application object as an instance of class



Flask

imported


from the flask package. The

__name__

variable passed to the



Flask

class is a Python prede-

fined variable, which is set to the name of the module in which it is used. Flask uses the location

of the module passed here as a starting point when it needs to load associated resources such as

template files, which I will cover in

Chapter 2

. For all practical purposes, passing

__name__

is almost always going to configure Flask in the correct way. The application then imports the



routes

module, which doesn’t exist yet.




6

CHAPTER 1. HELLO, WORLD!

One aspect that may seem confusing at first is that there are two entities named


Download 2,44 Mb.

Do'stlaringiz bilan baham:
1   ...   5   6   7   8   9   10   11   12   ...   17




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish