简体   繁体   English

django项目,“来自mezzanine.conf导入设置”的夹层

[英]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" 外观: ./mezzanine-master/mezzanine/blog/views.py master/ ./mezzanine-master/mezzanine/blog/views.py blog/ ./mezzanine-master/mezzanine/blog/views.py #此文件“从mezzanine.conf导入设置”导入此行

when i goto this ./mezzanine-master/mezzanine/conf folder and list files: 当我转到此./mezzanine-master/mezzanine/conf文件夹并列出文件时:

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? 在此conf文件夹中找不到settings.py文件,我在哪里找不到此设置,此设置不是项目设置,我知道项目根文件夹中的项目设置,但是在conf文件夹中的此设置,谁能告诉我这是什么手段? 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. 在Python中,一个__init__.py文件共享与它在目录中的名称空间,因此一个变量settingsmezzanine/conf/__init__.py是通过作为文件同名访问mezzanine/conf/settings.py会。

In this case mezzanine.conf.settings is defined on the final line of mezzanine/conf/__init__.py : 在这种情况下mezzanine.conf.settings被限定在的最后一行mezzanine/conf/__init__.py

settings = Settings()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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