django-simple-deploy / django-simple-deploy/dsd-flyio
Runs "collectstatic" needlessly
- Dominant language
- Python
- Stars
- 5
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
If you look at https://github.com/offby1/django-chess/commit/c677aea5fbb2d187d4e33cc0522674c8cf49c7c0, specifically https://github.com/offby1/django-chess/blob/c677aea5fbb2d187d4e33cc0522674c8cf49c7c0/Dockerfile#L24, you'll see that it runs `python manage.py collectstatic`.
However ... in my project, that's unneeded, and breaks the docker build:
`django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.`
This seems like the sort of thing we could avoid by doing some sort of probe, to see if it's necessary.
```
at 2025-09-11T17:59:46-05:00 ❯ fly deploy
==> Verifying app config
Validating /Users/not-workme/git-repositories/me/django-chess/fly.toml
✓ Configuration is valid
--> Verified app config
==> Building image
==> Building image with Depot
--> build:
[+] Building 2.2s (13/13) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 623B 0.1s
=> [internal] load metadata for docker.io/library/python:3.12-slim-bullseye 0.4s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 133B 0.1s
=> [1/9] FROM docker.io/library/python:3.12-slim-bullseye@sha256:411fa4dcfdce7e7a3057c45662beba9dcd4fa36b2e50a2bfcd6c9333e59bf0db 0.0s
=> => resolve docker.io/library/python:3.12-slim-bullseye@sha256:411fa4dcfdce7e7a3057c45662beba9dcd4fa36b2e50a2bfcd6c9333e59bf0db 0.0s
=> [internal] load build context 0.2s
=> => transferring context: 84.95kB 0.2s
=> CACHED [2/9] RUN mkdir -p /code 0.0s
=> CACHED [3/9] WORKDIR /code 0.0s
=> CACHED [4/9] COPY requirements.txt /tmp/requirements.txt 0.0s
=> CACHED [5/9] RUN apt -y update 0.0s
=> CACHED [6/9] RUN apt -y install git gnuchess 0.0s
=> CACHED [7/9] RUN set -ex && pip install --upgrade pip && pip install -r /tmp/requirements.txt && rm -rf /root/.cache/ 0.0s
=> [8/9] COPY . /code/ 0.0s
=> ERROR [9/9] RUN ON_FLYIO_SETUP="1" python manage.py collectstatic --noinput 1.4s
------
> [9/9] RUN ON_FLYIO_SETUP="1" python manage.py collectstatic --noinput:
1.272 Traceback (most recent call last):
1.272 File "/code/manage.py", line 23, in
1.272 main()
1.272 File "/code/manage.py", line 19, in main
1.272 execute_from_command_line(sys.argv)
1.272 File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
1.272 utility.execute()
1.272 File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
1.272 self.fetch_command(subcommand).run_from_argv(self.argv)
1.272 File "/usr/local/lib/python3.12/site-packages/django/core/management/base.py", line 416, in run_from_argv
1.273 self.execute(*args, **cmd_options)
1.273 File "/usr/local/lib/python3.12/site-packages/django/core/management/base.py", line 460, in execute
1.273 output = self.handle(*args, **options)
1.273 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.273 File "/usr/local/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 209, in handle
1.273 collected = self.collect()
1.273 ^^^^^^^^^^^^^^
1.273 File "/usr/local/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 135, in collect
1.274 handler(path, prefixed_path, storage)
1.274 File "/usr/local/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 368, in copy_file
1.274 if not self.delete_file(path, prefixed_path, source_storage):
1.274 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.274 File "/usr/local/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 278, in delete_file
1.274 if self.storage.exists(prefixed_path):
1.274 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.274 File "/usr/local/lib/python3.12/site-packages/django/core/files/storage/filesystem.py", line 206, in exists
1.274 return os.path.lexists(self.path(name))
1.274 ^^^^^^^^^^^^^^^
1.274 File "/usr/local/lib/python3.12/site-packages/django/contrib/staticfiles/storage.py", line 39, in path
1.275 raise ImproperlyConfigured(
1.275 django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
------
==> Building image
==> Building image with Depot
--> build:
[+] Building 1.3s (13/13) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 623B 0.0s
=> [internal] load metadata for docker.io/library/python:3.12-slim-bullseye 0.1s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 133B 0.0s
=> [1/9] FROM docker.io/library/python:3.12-slim-bullseye@sha256:411fa4dcfdce7e7a3057c45662beba9dcd4fa36b2e50a2bfcd6c9333e59bf0db 0.0s
=> => resolve docker.io/library/python:3.12-slim-bullseye@sha256:411fa4dcfdce7e7a3057c45662beba9dcd4fa36b2e50a2bfcd6c9333e59bf0db 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 4.39kB 0.0s
=> CACHED [2/9] RUN mkdir -p /code 0.0s
=> CACHED [3/9] WORKDIR /code 0.0s
=> CACHED [4/9] COPY requirements.txt /tmp/requirements.txt 0.0s
=> CACHED [5/9] RUN apt -y update 0.0s
=> CACHED [6/9] RUN apt -y install git gnuchess 0.0s
=> CACHED [7/9] RUN set -ex && pip install --upgrade pip && pip install -r /tmp/requirements.txt && rm -rf /root/.cache/ 0.0s
=> CACHED [8/9] COPY . /code/ 0.0s
=> ERROR [9/9] RUN ON_FLYIO_SETUP="1" python manage.py collectstatic --noinput 1.1s
------
> [9/9] RUN ON_FLYIO_SETUP="1" python manage.py collectstatic --noinput:
1.004 Traceback (most recent call last):
1.004 File "/code/manage.py", line 23, in
1.004 main()
1.004 File "/code/manage.py", line 19, in main
1.005 execute_from_command_line(sys.argv)
1.005 File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
1.005 utility.execute()
1.005 File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
1.005 self.fetch_command(subcommand).run_from_argv(self.argv)
1.005 File "/usr/local/lib/python3.12/site-packages/django/core/management/base.py", line 416, in run_from_argv
1.005 self.execute(*args, **cmd_options)
1.005 File "/usr/local/lib/python3.12/site-packages/django/core/management/base.py", line 460, in execute
1.005 output = self.handle(*args, **options)
1.005 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.005 File "/usr/local/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 209, in handle
1.006 collected = self.collect()
1.006 ^^^^^^^^^^^^^^
1.006 File "/usr/local/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 135, in collect
1.006 handler(path, prefixed_path, storage)
1.006 File "/usr/local/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 368, in copy_file
1.006 if not self.delete_file(path, prefixed_path, source_storage):
1.006 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.006 File "/usr/local/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 278, in delete_file
1.006 if self.storage.exists(prefixed_path):
1.006 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.006 File "/usr/local/lib/python3.12/site-packages/django/core/files/storage/filesystem.py", line 206, in exists
1.007 return os.path.lexists(self.path(name))
1.007 ^^^^^^^^^^^^^^^
1.007 File "/usr/local/lib/python3.12/site-packages/django/contrib/staticfiles/storage.py", line 39, in path
1.007 raise ImproperlyConfigured(
1.007 django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
------
Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c ON_FLYIO_SETUP=\"1\" python manage.py collectstatic --noinput" did not complete successfully: exit code: 1
django-chess on HEAD (c677aea) via 🐍 v3.13.7 took 7s
at 2025-09-11T18:03:24-05:00 ❌1 ❯
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.