import os from subprocess import Popen os.environ["ALLOWED_HOSTS"] = "pplonski-deploy-mercury.hf.space" os.environ["DJANGO_SUPERUSER_PASSWORD"] = "test" os.environ["DJANGO_SUPERUSER_USERNAME"] = "test" os.environ["DJANGO_SUPERUSER_EMAIL"] = "test@example.com" command = ["mercury", "createsuperuser", "--noinput"] worker = Popen(command) worker.wait() command = ["mercury", "run", f"0.0.0.0:{os.environ.get('PORT', 7860)}", "--verbose"] worker = Popen(command) worker.wait()