Django admin template refuses to be overridden on ubuntu? -


i have django project , have overridden admin base_site.html change "django administration" "xxx administration." works fine on windows 7. on ubuntu machine, when visit /admin, still tells me "django administration!"

now on weird part... on ubuntu, can run ./manage.py shell , this:

import django.template.loader loader django.template.context import context s = loader.get_template('admin/base_site.html') print s.render(context()) 

and gives me:

....     <div id="branding">  <h1 id="site-name">xxx administration</h1>      </div> ....  

now have no idea why template loader loading right file, yet admin page still wants render wrong template, , on ubuntu! feel i'm going crazy. tried restarting server. on ubuntu server running on gunicorn through nginx reverse proxy.

/project_base/templates/admin/base_site.html

{% extends "admin/base.html" %} {% load i18n %}  {% block title %}{{ title }} | {% trans 'xxx site admin' noop %}{% endblock %}  {% block branding %} <h1 id="site-name">{% trans 'xxx administration' noop %}</h1> {% endblock %}  {% block nav-global %}{% endblock %}   

/project_base/project_name/settings.py

project_path = os.path.abspath(os.path.dirname(__name__))  template_dirs = (      os.path.join(project_path, 'templates') ) 

edit:
think has gunicorn / nginx. started instance of server through ./manage.py runserver 7777 & , curl http://localhost:7777/admin/ showed me correct title being displayed. curl http://localhost:80/admin still giving me "django administration." nginx somehow caching previous version of page?

alasdair pointed me problem. assumed os.path.abspath(os.path.dirname(__name__)) point absolute directory 1 level settings.py file. unfortunately, not case , i'm still not sure how magic code supposed work. seems have directory start python interpreter.

in case, starting gunicorn /project_base/project_name (the directory containing settings.py). starting gunicorn /project_base fixed problem.


Comments