Django modify the configuration file

the reason

  • Django's default configuration file settings.py, but projects in the development and deployment of on-line time is not the same, in order to avoid changing the go, we are prepared two project profiles
  • dev.py project is to develop configuration, prod.py project is on-line configuration

step

"""
1.将settings.py内容拷贝到settings/dev.py中, 并将settings.py文件删除

2.修改 wsgi.py 与 manage.py 两个文件settings路径:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'luffyapi.settings.dev')

3.修改启动配置:见下图

4.在任何一个__init__.py文件中测试默认配置文件是否是dev.py文件
from django.conf import settings
print(settings)
"""

Guess you like

Origin www.cnblogs.com/bigb/p/12149991.html