triviOS/ui/homemanager/wsgi.py

27 lines
837 B
Python

"""
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
from pathlib import Path
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'homemanager.settings')
data = Path("/tmp/db.sqlite3")
if not data.is_file():
from django.core.management import call_command
os.environ.setdefault('DJANGO_SUPERUSER_PASSWORD', 'password')
call_command("migrate --noinput")
call_command("collectstatic --noinput")
call_command("createsuperuser --noinput --username adp --email a@a.com")
call_command("createsuperuser --noinput --username fabian --email b@a.com")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()