Django Template Override Works Locally but Not on Azure

I’m working on a Django project where I’m overriding the submit_line.html template. This override works perfectly in my local development environment, but when I deploy the application to Azure, the override doesn’t seem to take effect.

Here’s the custom submit_line.html override in my templates directory:

    {% extends 'admin/submit_line.html' %}
    {% load i18n admin_urls %}

    {% block submit-row %}
    {{ block.super }}
    {% for obj in transitions %}
        <input type="submit" value="{{ obj }}" name="{{ obj }}">
    {% endfor %}
    <!--{{ perms.ForecastResponse }}-->
    {%if perms.ForecastResponse.add_project%}
    <input type="submit" value="{% translate 'Clone project from source'%}"         name="_cloneproject">
    {%endif%}
    {% endblock %}

File structure:

myproject/
├── ForecastResponse/
│   ├── migrations/
│   ├── templates/
│   │   └── admin/ForecastResponse/project
│   │   |    └── submit_line.html  # Overridden template
│   │   ├── ForecastResponse/
│   │   │   ├── base.html         # Global base template
│   │   │   ├── other_template.html  
│   │   ├── static/
│   │   ├── views.py
│   │   ├── models.py
│   │   └── admin.py
│   ├── manage.py
│   ├── settings.py
│   ├── urls.py
│   └── other_project_files/

What I've tried:

  • Verified that the custom submit_line.html file exists in the correct location on Azure by inspecting the deployed files.
  • Updated the settings.py to include the TEMPLATES section:

    TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(BASE_DIR,  'ForecastResponse', 'templates')
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
    ]
  • Reordering the INSTALLED_APPS so that my app (ForecastResponse) is at the top django.contrib.admin

Any help would be really appreciated! Thank you :)

Вернуться на верх