triviOS/ui/homemanager/wsgi.py

29 lines
877 B
Python
Raw Permalink Normal View History

2023-09-11 08:07:53 +02:00
"""
WSGI config for homemanager project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""
import os
2023-09-12 23:51:16 +02:00
from pathlib import Path
2023-09-13 00:42:43 +02:00
from homemanager.settings import DATABASES
2023-09-12 23:51:16 +02:00
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'homemanager.settings')
2023-09-11 08:07:53 +02:00
2023-09-13 00:42:43 +02:00
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
data = DATABASES["default"]["NAME"]
2023-09-12 23:51:16 +02:00
if not data.is_file():
from django.core.management import call_command
2023-09-13 00:42:43 +02:00
call_command("migrate", "--noinput")
call_command("collectstatic", "--noinput")
2023-09-11 08:07:53 +02:00
2023-09-13 00:42:43 +02:00
from django.contrib.auth import get_user_model
User = get_user_model()
User.objects.create_superuser('adp', 'a@a.com', 'password')
User.objects.create_superuser('fabian', 'b@a.com', 'password')
2023-09-11 08:07:53 +02:00