diff options
author | 2021-08-27 21:07:02 +0100 | |
---|---|---|
committer | 2021-08-27 21:07:02 +0100 | |
commit | ee0fcd38d434540f83dc2ea2457db43c12791441 (patch) | |
tree | 58b57f2fd4c38b334828ce9364f6128bbf7cf7bc | |
parent | Merge pull request #569 from KittyBorgX/main (diff) | |
parent | Linting compliance (diff) |
Merge pull request #568 from python-discord/jb3/collectstatic-build
-rw-r--r-- | Dockerfile | 7 | ||||
-rwxr-xr-x | manage.py | 11 |
2 files changed, 16 insertions, 2 deletions
@@ -24,6 +24,13 @@ ENV GIT_SHA=$git_sha # Copy the source code in last to optimize rebuilding the image COPY . . +# Set dummy variables so collectstatic can load settings.py +RUN \ + SECRET_KEY=dummy_value \ + DATABASE_URL=postgres://localhost \ + METRICITY_DB_URL=postgres://localhost \ + python manage.py collectstatic --noinput --clear + # Run web server through custom manager ENTRYPOINT ["python", "manage.py"] CMD ["run"] @@ -138,10 +138,17 @@ class SiteManager: print("Applying migrations.") call_command("migrate", verbosity=self.verbosity) - print("Collecting static files.") - call_command("collectstatic", interactive=False, clear=True, verbosity=self.verbosity) if self.debug: + # In Production, collectstatic is ran in the Docker image + print("Collecting static files.") + call_command( + "collectstatic", + interactive=False, + clear=True, + verbosity=self.verbosity - 1 + ) + self.set_dev_site_name() self.create_superuser() |