Browse Source

Load development configs in asgi and wsgi

pull/2/head
PCoder 11 months ago
parent
commit
72d55a5f14
  1. 10
      gmba_django/asgi.py
  2. 2
      gmba_django/wsgi.py

10
gmba_django/asgi.py

@ -8,9 +8,17 @@ https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
import dotenv
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gmba_django.settings')
dotenv.load_dotenv(
os.path.join(os.path.dirname(os.path.dirname(__file__)), '.env')
)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gmba_django.settings.development')
if os.getenv('DJANGO_SETTINGS_MODULE'):
os.environ['DJANGO_SETTINGS_MODULE'] = os.getenv('DJANGO_SETTINGS_MODULE')
application = get_asgi_application()

2
gmba_django/wsgi.py

@ -16,7 +16,7 @@ dotenv.load_dotenv(
os.path.join(os.path.dirname(os.path.dirname(__file__)), '.env')
)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gmba_django.settings.develop')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gmba_django.settings.development')
if os.getenv('DJANGO_SETTINGS_MODULE'):
os.environ['DJANGO_SETTINGS_MODULE'] = os.getenv('DJANGO_SETTINGS_MODULE')

Loading…
Cancel
Save