Skip to content

Commit

Permalink
Fix management command
Browse files Browse the repository at this point in the history
  • Loading branch information
JobDoesburg committed Dec 19, 2022
1 parent 827f2b7 commit b44ab3f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions website/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@
def main():
"""Django management command."""
try:
import tosti.settings.management # noqa
import tosti.settings.production # noqa
except ModuleNotFoundError:
# Use development settings if no management settings are found
# Use the development settings if the production settings are not available (so we're on a dev machine)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tosti.settings.development")
else:
import socket # noqa

hostname = socket.gethostname()
if hostname.startswith("lilo"):
# Use management settings if we're on lilo
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tosti.settings.management")
else:
# Use the production settings if we're on a production machine
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tosti.settings.production")

try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down

0 comments on commit b44ab3f

Please sign in to comment.