admin管理员组文章数量:1123097
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 :)
本文标签: Django Template Override Works Locally but Not on AzureStack Overflow
版权声明:本文标题:Django Template Override Works Locally but Not on Azure - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736546109a1944448.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论