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。

 

 

 

相关文章:

  • 2021-06-10
  • 2021-07-30
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2021-08-28
  • 2022-03-10
  • 2021-09-11
猜你喜欢
  • 2021-08-07
  • 2022-12-23
  • 2021-05-07
  • 2022-03-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案