Skip to content

Commit

Permalink
Update settings.py to not initialize the DB for collectstatic
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Normore committed Oct 27, 2020
1 parent 857ad50 commit de9d1a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mysite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""
from pathlib import Path
import os
import sys
from urllib.parse import urlparse

from django.core.management.utils import get_random_secret_key
Expand Down Expand Up @@ -85,7 +86,7 @@
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}
else:
elif len(sys.argv) > 0 and sys.argv[1] != 'collectstatic':
if os.getenv("DATABASE_URL", None) is None:
raise Exception("DATABASE_URL environment variable not defined")
r = urlparse(os.environ.get("DATABASE_URL"))
Expand Down

0 comments on commit de9d1a6

Please sign in to comment.