Make the collectstatic hack slightly better
This commit is contained in:
parent
770f6728f6
commit
4a28e1708e
11
core/uris.py
11
core/uris.py
|
@ -1,3 +1,4 @@
|
|||
import sys
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -41,7 +42,15 @@ class StaticAbsoluteUrl(RelativeAbsoluteUrl):
|
|||
"""
|
||||
|
||||
def __init__(self, path: str):
|
||||
static_url = staticfiles_storage.url(path)
|
||||
try:
|
||||
static_url = staticfiles_storage.url(path)
|
||||
except ValueError:
|
||||
# Suppress static issues during the first collectstatic
|
||||
# Yes, I know it's a big hack! Pull requests welcome :)
|
||||
if "collectstatic" in sys.argv:
|
||||
super().__init__("https://example.com/")
|
||||
return
|
||||
raise
|
||||
if "://" in static_url:
|
||||
super().__init__(static_url)
|
||||
else:
|
||||
|
|
|
@ -32,7 +32,7 @@ COPY . /takahe
|
|||
|
||||
WORKDIR /takahe
|
||||
|
||||
RUN TAKAHE_DATABASE_SERVER="postgres://x@example.com/x" TAKAHE_DEBUG=true python3 manage.py collectstatic --noinput
|
||||
RUN TAKAHE_DATABASE_SERVER="postgres://x@example.com/x" python3 manage.py collectstatic --noinput
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
|
|
Loading…
Reference in New Issue