Split production and development settings

This commit is contained in:
Lars van Rhijn
2023-10-11 16:02:25 +02:00
parent c061d1c304
commit 4c10d2308c
4 changed files with 53 additions and 31 deletions

View File

@ -3,7 +3,13 @@ import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "marietje.settings.settings")
try:
import marietje.settings.production # noqa
except ModuleNotFoundError:
# Use the development settings if the production settings are not available (so we're on a dev machine)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "marietje.settings.development")
else:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "marietje.settings.production")
try:
from django.core.management import execute_from_command_line
except ImportError: