标签:inf django project span ima eve 原来 comm 数据库
django-生产和测试环境分离
from .base import *
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
1 import os 2 3 from django.core.wsgi import get_wsgi_application 4 5 profile = os.environ.get(‘PROJECT_PROFILE‘, ‘develop‘) 6 7 os.environ.setdefault(‘DJANGO_SETTINGS_MODULE‘, ‘ActivityApi.settings.%s‘ % profile) 8 9 application = get_wsgi_application()
wsgi.py
1 #!/usr/bin/env python 2 """Django‘s command-line utility for administrative tasks.""" 3 import os 4 import sys 5 6 7 def main(): 8 profile = os.environ.get(‘PROJECT_PROFILE‘, ‘develop‘) 9 os.environ.setdefault(‘DJANGO_SETTINGS_MODULE‘, ‘ActivityApi.settings.%s‘ % profile) 10 try: 11 from django.core.management import execute_from_command_line 12 except ImportError as exc: 13 raise ImportError( 14 "Couldn‘t import Django. Are you sure it‘s installed and " 15 "available on your PYTHONPATH environment variable? Did you " 16 "forget to activate a virtual environment?" 17 ) from exc 18 execute_from_command_line(sys.argv) 19 20 21 if __name__ == ‘__main__‘: 22 main()
manage.py
标签:inf django project span ima eve 原来 comm 数据库
原文地址:https://www.cnblogs.com/ivy-blogs/p/11645129.html