Skip to content
Snippets Groups Projects
Commit 5efbb72e authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Merge branch '140-missing-env-error-handling' into 'develop'

Resolve "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. when missing env values"

Closes #140

See merge request funkwhale/funkwhale!112
parents c2985b7d e1bdd14f
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import django
import os
import sys
......@@ -7,6 +8,12 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
# we're doing this here since otherwise, missing environment
# files in settings result in AttributeError being raised, generating
# a cryptic django.core.exceptions.AppRegistryNotReady error.
# To prevent that, we explicitely load settings here before anything
# else, so we fail fast with a relevant error. See #140 for more details.
django.setup()
from django.core.management import execute_from_command_line
......
Better error messages in case of missing environment variables (#140)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment