django - settings.py

settings.py : 一个 python语法 写满 变量 的文件。

 

1. 启动主程序中,可能是对 一段我不太明白的代码 的解释:

On the server (mod_wsgi)

In your live server environment, you’ll need to tell your WSGI application what settings file to use. Do that with os.environ:

import os

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

Read the Django mod_wsgi documentation for more information and other common elements to a Django WSGI application.

2. 差分 `自己的settings.py` 和 `Django默认配置的settings.py`

python manage.py diffsettings

3. 自己写的app,开始debug模式的方法:

In your Django apps, use settings by importing the object django.conf.settings. Example:

from django.conf import settings

if settings.DEBUG:
    # Do something

Note that django.conf.settings isn’t a module – it’s an object. 

4. 安全

settings.py 的 读写权限:自己 和 自己的程序 可读就ok。

 

 

 

posted @ 2014-03-08 16:47  kv9  阅读(276)  评论(0编辑  收藏  举报