Django admin template overrides not working in production environment

余生颓废 提交于 2019-12-06 08:13:01

问题


Like this question, my admin overrides aren't working in my production environment but they are in my development environment (same django version). I've tried reordering the INSTALLED_APPS tuple in settings.py with no change (was the answer to the question linked above). Here's how I have my project constructed:

/WebDJ/ # project dir
    +devices # unrelated app, but it uses templates (see below)
    +sales
        __init__.py
        admin.py
        models.py  # has Customer and Transaction model classes
    +templates
        +admin
            +sales
                +Customer
                    change_form.html
                +Transaction
                    change_form.html
        +devices # lots of templates under here that work fine
        404.html
        500.html

also:

TEMPLATE_DIRS = ('/WebDJ/templates',)

is set in settings.py. The templates in the devices app are fine. What's not loading are the overrides in the admin directory - so the change form for Customer and Transaction has some extra stuff added to them (overriding the "after_field_sets" block).

Again, it works in my development environment (using PyCharm) but not in my production environment. Any ideas? I'm really stumped on this one.


回答1:


Answer: on my production machine, apparently it didn't like "Customer" and "Transaction" despite that being the exact name of the models - it needed "customer" and "transaction".



来源:https://stackoverflow.com/questions/14823790/django-admin-template-overrides-not-working-in-production-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!