简体   繁体   中英

django project, mezzanine of “from mezzanine.conf import settings”

Using Mezzanine Resource, I find some files are missing in source folder, but project is not except error, i really want know why! i want know this file in where?

look: ./mezzanine-master/mezzanine/blog/views.py #this file import this line "from mezzanine.conf import settings"

when i goto this ./mezzanine-master/mezzanine/conf folder and list files:

total 96
drwxr-xr-x@ 13 Elone  staff   416B Nov 12 15:28 .
drwxr-xr-x@ 19 Elone  staff   608B Nov 12 15:28 ..
-rwxr-xr-x@  1 Elone  staff    10K Nov 12 15:28 __init__.py
-rwxr-xr-x@  1 Elone  staff   2.2K Nov 12 15:28 admin.py
-rwxr-xr-x@  1 Elone  staff   2.3K Nov 12 15:28 context_processors.py
-rwxr-xr-x@  1 Elone  staff   5.3K Nov 12 15:28 forms.py
drwxr-xr-x@ 40 Elone  staff   1.3K Nov 12 15:28 locale
drwxr-xr-x@  4 Elone  staff   128B Nov 12 15:28 migrations
-rwxr-xr-x@  1 Elone  staff   646B Nov 12 15:28 models.py
drwxr-xr-x@  3 Elone  staff    96B Nov 12 15:28 static
drwxr-xr-x@  3 Elone  staff    96B Nov 12 15:28 templates
-rwxr-xr-x@  1 Elone  staff   8.6K Nov 12 15:28 tests.py
-rwxr-xr-x@  1 Elone  staff   233B Nov 12 15:28 translation.py

not found settings.py file in this conf folder, i do not find this settings in where, this settings is not project settings, i know project settings in project root folder, but this settings in conf folder, who can tellde me this is what means? thinks

In python, an __init__.py file shares a namespace with the directory it is in. Therefore a variable settings in mezzanine/conf/__init__.py is accessible via the same name as a file mezzanine/conf/settings.py would be.

In this case mezzanine.conf.settings is defined on the final line of mezzanine/conf/__init__.py :

settings = Settings()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM