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 urllib.parse import urljoin
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -41,7 +42,15 @@ class StaticAbsoluteUrl(RelativeAbsoluteUrl):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, path: str):
|
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:
|
if "://" in static_url:
|
||||||
super().__init__(static_url)
|
super().__init__(static_url)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -32,7 +32,7 @@ COPY . /takahe
|
||||||
|
|
||||||
WORKDIR /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
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue