首页 > 其他 > 详细

django - settings.py

时间:2014-03-09 06:55:08      阅读:528      评论:0      收藏:0      [点我收藏+]

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。

django - settings.py,布布扣,bubuko.com

django - settings.py

原文:http://www.cnblogs.com/kevin922/p/3587963.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!