You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running pre-commit run --all-files on a newly created project, the ruff hook fails with the following error:
ruff.....................................................................Failed
- hook id: ruff
- exit code: 1
config/settings/production.py:108:16: F405 `STATIC_URL` may be undefined, or defined from star imports
Found 1 error.
The issue is caused because STATIC_URL is not explicitly imported.
The issue is easily fixed if we add the following line in config/settings/production.py:
from .baseimportSTATIC_URL
EDIT: The issue only occurs if "cloud_provider" is set as "None".
There's also an interesting line in config/settings/production.py:
There's an if block in the template but nothing is enclosed in it. It might be a mistake but I do not know what is the purpose of this.
You were pretty close, I think. This STATIC_URL is coming from the star import when these conditions are met, otherwise it's defined in the same file. Attempted a fix here: #5068
What happened?
When running
pre-commit run --all-files
on a newly created project, the ruff hook fails with the following error:EDIT: Line 108 of
config/settings/production.py
What should've happened instead?
The ruff hook should pass
Additional details
The issue is caused because
STATIC_URL
is not explicitly imported.The issue is easily fixed if we add the following line in
config/settings/production.py
:EDIT: The issue only occurs if "cloud_provider" is set as "None".
There's also an interesting line in
config/settings/production.py
:There's an if block in the template but nothing is enclosed in it. It might be a mistake but I do not know what is the purpose of this.
Here's a link to the line:
https://github.com/cookiecutter/cookiecutter-django/blob/831ce14ca320125b4176ed99b82956570789abf5/%7B%7Bcookiecutter.project_slug%7D%7D/config/settings/production.py#L288C26-L288C121
Host system configuration:
Version of cookiecutter CLI: 2.6.0
OS name and version:
Python version: Python 3.12.2
Docker version (if using Docker): 26.0.0, build 2ae903e
docker compose version (if using Docker): v2.25.0
Options selected and/or replay file:
The text was updated successfully, but these errors were encountered: