mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-01-24 16:24:14 +03:00
Default DJANGO_SETTINGS_MODULE to local settings in asgi.py
This is to be consistent with `manage.py` behaviour and required to run locally.
This commit is contained in:
parent
cc099ae941
commit
c639541d50
|
@ -7,6 +7,7 @@ For more information on this file, see
|
||||||
https://docs.djangoproject.com/en/dev/howto/deployment/asgi/
|
https://docs.djangoproject.com/en/dev/howto/deployment/asgi/
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
@ -17,6 +18,9 @@ from django.core.asgi import get_asgi_application
|
||||||
app_path = Path(__file__).parents[1].resolve()
|
app_path = Path(__file__).parents[1].resolve()
|
||||||
sys.path.append(str(app_path / "{{ cookiecutter.project_slug }}"))
|
sys.path.append(str(app_path / "{{ cookiecutter.project_slug }}"))
|
||||||
|
|
||||||
|
# If DJANGO_SETTINGS_MODULE is unset, default to the local settings
|
||||||
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
|
||||||
|
|
||||||
# This application object is used by any ASGI server configured to use this file.
|
# This application object is used by any ASGI server configured to use this file.
|
||||||
django_application = get_asgi_application()
|
django_application = get_asgi_application()
|
||||||
# Apply ASGI middleware here.
|
# Apply ASGI middleware here.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user