Repository: cookiecutter/cookiecutter-django

Issue:
ruff hook fails with F405 issue in config/settings/production.py
## What happened?
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.
```
EDIT: Line 108 of `config/settings/production.py`
```python
COMPRESS_URL = STATIC_URL
```

## What should've happened instead?
The ruff hook should pass
```
ruff.....................................................................Passed
```

## 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`:
```python
from .base import STATIC_URL
```
EDIT: The issue only occurs if "cloud_provider" is set as "None".
There's also an interesting line in `config/settings/production.py`:
```python
COMPRESS_URL = STATIC_URL{% if cookiecutter.use_whitenoise == 'y' or cookiecutter.cloud_provider == 'None' %}{% endif %}
```
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
<!-- To assist you best, please include commands that you've run, options you've selected and any relevant logs -->

- Host system configuration:

  - Version of cookiecutter CLI: 2.6.0
  - OS name and version:

    ```bash
    LSB Version:    n/a
    Distributor ID: NobaraLinux
    Description:    Nobara Linux 39 (KDE Plasma)
    Release:        39
    Codename:       n/a
    (Based on Fedora 39)
    ```

  - 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](https://cookiecutter.readthedocs.io/en/latest/advanced/replay.html):

```json
"cookiecutter": {
      "project_name": "narcissus",
      "project_slug": "narcissus",
      "description": "A place for me to be a narcissist",
      "author_name": "roushikk",
      "domain_name": "...",
      "email": "...",
      "version": "0.1.0",
      "open_source_license": "Not open source",
      "username_type": "email",
      "timezone": "UTC",
      "windows": "n",
      "editor": "VS Code",
      "use_docker": "y",
      "postgresql_version": "16",
      "cloud_provider": "None",
      "mail_service": "Other SMTP",
      "use_async": "y",
      "use_drf": "n",
      "frontend_pipeline": "Django Compressor",
      "use_celery": "y",
      "use_mailpit": "y",
      "use_sentry": "n",
      "use_whitenoise": "y",
      "use_heroku": "n",
      "ci_tool": "Github",
      "keep_local_envs_in_vcs": "y",
      "debug": "n",
      "_template": "https://github.com/cookiecutter/cookiecutter-django"
    }
```



Discussion:

Resolving patch:
diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py
--- a/{{cookiecutter.project_slug}}/config/settings/production.py
+++ b/{{cookiecutter.project_slug}}/config/settings/production.py
@@ -309,7 +309,8 @@
 COMPRESS_STORAGE = STORAGES["staticfiles"]["BACKEND"]
 {%- endif %}
 # https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_URL
-COMPRESS_URL = STATIC_URL{% if cookiecutter.use_whitenoise == 'y' or cookiecutter.cloud_provider == 'None' %}{% endif %}
+COMPRESS_URL = STATIC_URL{% if cookiecutter.use_whitenoise == 'y' or cookiecutter.cloud_provider == 'None' %}  # noqa: F405
+{%- endif -%}
 {%- if cookiecutter.use_whitenoise == 'y' %}
 # https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_OFFLINE
 COMPRESS_OFFLINE = True  # Offline compression is required when using Whitenoise


Test patch: