Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django RedirectView to my another project's url as default
I started to build the django tutorial app on the MDN website yesterday. And used RedirectView.as_view() to redirect my base urls to the app url as the tutorial said and it worked fine. # MDN Project urls.py urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^catalog/', include('website.urls')), url(r'^$', RedirectView.as_view(url='/catalog/', permanent=True)), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) In the catalog app: # Catalog app urls.py urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^about/$', views.about, name='about'), url(r'^contact/$', views.contact, name='contact'), url(r'^products/$', views.products, name='products'), ] But today i started another project in django and tried to make my base url include directly my app and it still redirects to the MDN projects url ('/catalog/') even there is no code that says to do that. What is wrong with my code? # Projects urls.py urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^/', include('myapp.urls')), ] In my app: # My App's urls.py urlpatterns = [ url(r'^$', views.index, name='index'), ] -
Remove # and #_=_ from returning social auth url - Django
I am using python-social-auth and django in my authentication system. At the moment, when I authenticate with either Facebook or Google, the URL returns with either /#_=_ or /# appended. I understand that these are deliberate but I'd like to remove them. I've seen a number of javascript solutions for the facebook version, but I'd like to do this from the server side. I tried to do a basic redirect: def pre_home(request): return redirect(reverse('home')) def home(request): return render(request, 'core/home.html) where I directed the auth system to pre_home on completion. I assumed this would strip off the end of the url on redirection to home, however it does not... -
How do I initialise my form in Django?
I have created a contact form on my homepage but the form does not show until I click on the submit form the first time. I.e. calling the get method. I would like to keep it as a separate view to my homepage so that when re-clicking 'submit' it does not have an impact on my homepage. Is there a way to load my 'def email' when my homepage loads? template form <form method="post" action="{% url 'home_page:email' %}"> {% csrf_token %} {# {% bootstrap_form form.as_p %}#} {{ form.as_p }} <input type="submit" value="Sign Up" class="btn btn-default"> </form> urls urlpatterns = [ url(r"^$", views.HomePage.as_view(), name="home"), url(r'^email/$', views.email, name='email'), url(r'^success/$', views.success, name='success'), ] views class HomePage(MessageMixin, TemplateView): template_name = "index.html" def email(request): if request.method == 'GET': form = ContactForm() else: form = ContactForm(request.POST) if form.is_valid(): subject = form.cleaned_data['subject'] from_email = form.cleaned_data['from_email'] message = form.cleaned_data['message'] try: send_mail(subject, message, from_email, ['admin@example.com']) except BadHeaderError: return HttpResponse('Invalid header found.') return redirect('success') return render(request, "index.html", {'form': form}) -
Setting up gunicorn and supervisor for django server
I am trying to get my server up and running with gunicorn and supervisor. Managed to get it upp with this command: $ gunicorn project.wsgi:application --bind 192.168.1.130:8000 After this I made a gunicorn_init.bash file. I got the code from several tutorials. So guess it's a common way to set up gunicorn and supervisor. The code looks like this: #!/bin/bash NAME="project" # Name of the application DJANGODIR=/home/username/projects/project # Django project directory SOCKFILE=/home/username/.venvs/project/run/gunicorn.sock # We will communicate using this unix socket USER=username # the user to run as GROUP=username # the group to run as NUM_WORKERS=1 # how many worker processes shoul Gunicorn spawn DJANGO_SETTINGS_MODULE=project.settings.production # which settings file should Django use DJANGO_WSGI_MODULE=project.wsgi # WSGI module name echo "Starting $NAME as `whoami`" # Activate the virtual environment cd $DJANGODIR source /home/username/.venvs/project/bin/activate export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE export PYTHONPATH=$DJANGODIR:$PYTHONPATH # Create the run directory if it doesn't exsist RUNDIR=$(dirname $SOCKFILE) test -d $RUNDIR || mkdir -p $RUNDIR # Start yout Django Unicorn # Programs meant to be run under supervisor should not daemonize themselves (do not use daemon) exec gunicorn ${DJANGO_WSGI_UNICORN}:application \ --name $NAME \ --workers $NUM_WORKERS \ --user=$USER --group=$GROUP \ --bind=unix:$SOCKFILE \ --log-level=debug \ --log-file=- This only gives me exception is worker process like this: … -
How to send Jinja variables to Django View
I have a view in HTML whereby it displays a list of table with attendees; <table> {% for people in Attendees %} <tr> <td>{{ people.id }}</td> <td>{{ people.name }}</td> <td> <a id='deleteAttendeeButton' class="btn btn-primary btn-xs">Delete</a> </td> </tr> {% endfor %} </table> The table has a delete button for all entries and when clicked, I am using AJAX for a GET request as per below; $("#deleteAttendeeButton").on("click", function () { $.ajax({ url: '/modifyAttendee/?id={{ people.id }}', type: 'GET', }) }); I want to use AJAX to send the people.ID variable to view so that the view can determine what object to delete in the database. However, the issue is I cannot seem to pass in a jinja variable in AJAX. Am I missing something in my AJAX statement? If not, what would be an ideal solution? Note: I do not want to use 'href' in the button because I do not want to reload the page. -
Unable to use Memcached in Django 1.11 (cannot import name 'get_cache')
I want to use Memcached in my Django 1.11 project. I am using Python 3.6. I have installed memcached on my mac OSX terminal with Homebrew. After that I installed its python bindings: pip install python-memchached==1.58 I then add the necessary configurations to my settings.py project file: CACHES = { 'default': { 'BACKEND':'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION':'127.0.0.1:11211', } } I two terminals, one for my local host and the second one for memcached: memcached -l 127.0.0.1:11211 When I refresh my web page I get the following error: System check identified no issues (0 silenced). October 15, 2017 - 10:47:30 Django version 1.11.6, using settings 'educa.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C. Internal Server Error: / Traceback (most recent call last): File "/Users/comp/Desktop/Dev/educa/lib/python3.6/site- packages/django/template/utils.py", line 65, in __getitem__ return self._engines[alias] KeyError: 'django' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/comp/Desktop/Dev/educa/lib/python3.6/site- packages/django/template/backends/django.py", line 126, in get_package_libraries module = import_module(entry[1]) File "/Users/comp/Desktop/Dev/educa/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in … -
Django - having more than one foreignkey in the same model
models.py class City(models.Model): id = models.IntegerField(primary_key=True) name = models.CharField(max_length=35) countrycode = models.CharField(max_length=3) district = models.CharField(max_length=200) population = models.IntegerField(default='0') class Country(models.Model): code = models.CharField(primary_key=True, max_length=3) name = models.CharField(max_length=52) continent = models.CharField(max_length=50) region = models.CharField(max_length=26) surfacearea = models.FloatField() indepyear = models.SmallIntegerField(blank=True, null=True) population = models.IntegerField() lifeexpectancy = models.FloatField(blank=True, null=True) gnp = models.FloatField(blank=True, null=True) gnpold = models.FloatField(blank=True, null=True) localname = models.CharField(max_length=45) governmentform = models.CharField(max_length=45) headofstate = models.CharField(max_length=60, blank=True, null=True) capital = models.IntegerField(blank=True, null=True) code2 = models.CharField(max_length=2) Question 1 In the above mentioned models how can i relate code in the Country.code to City.countrycode, i am not able to do so because Country model is declared after the City model. Question 2 And how to link the Country.capital in the Country model which is a integer that relates to City.name. Note I am converting a .sql file with InnoDB Engine to Postgresql. -
mysql downloading error message
I've been trying to download a database preferably mysql for my Django project but when I use pip install, it tends to be downloading, all of a sudden it brings out an error message.. Please help, I'm on Windows -
Replacing Uploaded Django File
I'm want to replace a loaded file with a different file. My model looks like this and the document I change is doc. class GeneratedDocument (models.Model): survey = models.ForeignKey(Survey) document = models.ForeignKey( Document, blank=True, null = True) doc = models.FileField( upload_to = 'generated_docs/' ) my_state_field = StateField() objects = WorkflowObjectManager() def __unicode__(self): return u'%s | %s | %s' % (self.survey.organisation, self.document.name, self.doc) I user a ModelForm to load that initially and all works fine. When I am trying to replace doc I'm using: g = GeneratedDocument.objects.get(id=int(request.POST['g_id'])) g.doc = request.FILES['doc'] g.save() It is saving the file into the right place, ie media/generated_docs/filename BUT within the model it is only saving generated_docs/filename whereas with the original load is it saving a full URL (from http://). How do I get the file uploaded to the correct media directory and save that destination within my model? Thanks for the help -
Disable form field Django inlineformset_factory
Probably an easy one I am trying to disable (i.e. that the field is present but greyed out) the 'sub_total' field on all formset lines and use javascript to update the field with whatever values are entered into the 'price_estimate' and 'quantity' fields. I have the following models: class Requisition(models.Model): create_date = models.DateTimeField(auto_now_add=True) modified_date = models.DateTimeField(auto_now=True) description = models.CharField(max_length=128, null=True, blank=True,) total = models.DecimalField(decimal_places=2, max_digits=20, null=True) class RequisitionLine(models.Model): requisition = models.ForeignKey(Requisition) product = models.CharField(max_length=50, blank=False) quantity = models.PositiveIntegerField() price_estimate = models.DecimalField(decimal_places=2, max_digits=20) sub_total = models.DecimalField(decimal_places=2, max_digits=20, null=True) @property def get_sub_total(self): return self.quantity * self.price_estimate In my view I have Formset = inlineformset_factory(models.Requisition, models.RequisitionLine, form = forms.RequsitionForm, formset= forms.RequisitionLineForm, fields=('product', 'price_estimate', 'quantity', 'sub_total'), extra=2) In forms class RequsitionForm(forms.ModelForm): class Meta: model = models.Requisition fields = ['description'] class RequisitionLineForm(forms.BaseInlineFormSet): sub_total = forms.DecimalField(disabled=True, required=False) class Meta: model = models.RequisitionLine fields = ['product', 'quantity', 'price_estimate', 'sub_total'] In addition to the code above - I have tried to modify the sub_total field on init however, whatever I try it seems that it is ignored. Any help appreciated -
Use of database ID's in the url
Is there any reason why one should prefer to use a slug in its (public) urls instead of the database id? So, is this preferred somehow... www.example.com/comments/(?P<comment_slug>[0-9]+)/details ...to this: www.example.com/comments/(?P<comment_id>[0-9]+)/details The slug could possibly just be just a linear operation on the database id (say slug = id + secret integer), as done for example in the following: https://github.com/django-notifications/django-notifications/blob/master/notifications/utils.py -
Using more number of relational database in django
Using more number of ForeignKey's in Django cause any problem in production? Is there any limits of using models. I'm using cache to handle some views.But I'm really worried about my database design. In my project, I'm using 30 FK's to store information about users and activities.right now all working fine on the production server.In future, more FK will present.Using more number DB's cause any problem in future? Thanks in advance. -
SEO for Django CMS
my research on SEO for Django/ Django CMS/ Aldryn Newsblog website yielded dated articles published in 2013, 2014, 2015. I will like to seek your advice on the software/ setup you use in your Django/ Django CMS/ Aldryn Newsblog website for SEO. Thank you. -
Django: how to best separate development and deployment?
I have a remote project on a web server and would like to further develop the project in use. How can I work best without the changes being implemented directly in the application? I have already a settings folder to have separate settings and I can also access the Django testserver remotely, but all changes are implemented directly in the project. A solution would be to duplicate the project and then copy it after editing, but that does not seem to me to be a good solution. -
creating two content blocks on two different files - django
I have a django project that I am working on and I have 3 html files. I have the base html that holds all of the non content specific information like links, header, and over body tags. I have a block called content and a block called header in the the main body tag of the html. Then content comes from html files that are in the templates folder. Right now I have content from one html template. My question is. Can i have the content from the header block and content block come from two different html files within the templates folder. So the header block is its own file because it will be located on every page, while the content block comes from the different files that are specified. Do both content blocks have to come from the same html file. If I can grab the content from both, how do I structure it. is it possible to save the html in a variable within the django views and then pass it to each template. What is the most efficient way to approach this issue. base.html: {% load staticfiles %} <!DOCTYPE html> <html> <head> <title>{% block title %}{% … -
How to avoid hitting DB everytime a foreign key is required in Django
I am logged in into my application as institute user and I have to save student details. Student Model have a column as FK to Institute Model. institute = models.ForeignKey('institute.InstituteDetailsModel', to_field="sys_id", on_delete = models.SET_NULL, null=True, blank=True) Every-time I register student, I have to hit the DB to get institute instance and use it while saving student details. This DB-hitting situation is arising at many places when doing other things. To avoid hitting DB everytime I tried doing below things: Get the institute instance from DB at login time and 1. convert it to dict using model_to_dict (dates needs to be handled separately because of serialisation issue) and store in session. 2. serialize it using django's serialization framework and store in session. But I am getting below issues in above methods respectively: 1. Using ModelForms to save data. data["institute_id"] = request.session["institute"]["id"] form = StudentForm(data) got error "this field is required" for institute. I tried to deserialized the saved object but it is of type generator and not of type model instance hence got the errors'generator' object has no attribute 'id and 'DeserializedObject' object has no attribute 'id' when tried getting id attribute. What is the best way to retrieve and store … -
Python/Django: Selecting max value of one-to-many relation and displaying it in HTML/View
Good Day SO, I am a beginner in Django and python, just started learning two days ago. This qn is related to this question: Python/Django: How to show both main model and 'foreign-key model' together in HTML I have two models in a one(crisis)-to-many(plans) relationship, with the models shown here: class Plan(models.Model): plan_ID = models.CharField( primary_key=True, max_length=8, validators=[RegexValidator(regex='^\w{8}$', message='Length has to be 8', code='nomatch')] ) plan_crisisID = models.ForeignKey(Crisis, on_delete=models.CASCADE) plan_status = models.CharField(max_length=50) class Crisis(models.Model): crisis_ID = models.CharField( primary_key=True, max_length=4, validators=[RegexValidator(regex='^\w{4}$', message='Length has to be 4', code='nomatch')] ) crisis_name = models.CharField(max_length=50) Currently, the displayed data looks something like this: I am new to django/python in general, and I do not know how to filter the data such that i only display each crisis once, and report ID with the highest value. My desired end result looks like this: Here is my views.py section: def home(request): template = loader.get_template('pmoapp/home.html') planList = Plan.objects.filter(plan_crisisID__crisis_status='Ongoing') context = { #'crisisList': crisisList, 'planList': planList } return HttpResponse(template.render(context, request)) How do I code the loop function to get the max value of the planID for each crisisID? Any help will be greatly appreciated.. Thank you very much SO.. -
queryset vs filter_backends in django rest framework
I am new to DRF. I went through the example of filtering queryset at http://www.django-rest-framework.org/api-guide/filtering/#filtering-and-object-lookups This link contains description about queryset filtering, as well as DjangoFilterBackend. As far as I am able to understand, they are serving the same purpose. But it's not clear when to use any one of them. In some of the cases, both queryset and filter_backends are used :- class UserListView(generics.ListAPIView): queryset = User.objects.all() serializer_class = UserSerializer filter_backends = (filters.OrderingFilter,) ordering_fields = ('username', 'email') Can anyone let me know, what's the difference between these two ?which one of these two have to be used, in which situations, we must prefer one over another ? Thanks in advance -
NoReverseMatch in django when trying without harcoding
I have a music app which has the urls.py urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^(?P<album_id>[0-9]+)/$', views.detail, name='detail'), url(r'^(?P<album_id>[0-9]+)/favorite/$', views.favorite, name='favorite'), ] and in my html code I called this <form action="{% url 'music:favorite' album_id %}" method="post"> Then I am getting NoReverseMatch exception. Reverse for 'favorite' with arguments '('',)' not found. 1 pattern(s) tried: ['music/(?P<album_id>[0-9]+)/favorite/$'] -
Django css and js not loading
I just spent all day deploying a small Django app on cPanel. Python virtual environment set up, Django files are in, dependencies installed... Static css and js files are not being loaded properly. The cPanel host put passenger_wsgi.py inside my Django app directory with .htaccess pointing to the wsgi file, so that's what is handling the requests. The static files are exactly where they were in development, and in settings.py STATIC_URL = "/static/" STATIC_ROOT = "/path/to/public_html/static/" STATICFILES_DIRS = [( "static", "/path/to/myapp/static/" ),] In templates/base/navigation.html (I have also tried {% load static %}) {% load staticfiles %} <!DOCTYPE html> <html> <head> <title>{% block title %}{% endblock %} | SG</title> <script src="{% static 'js/jquery.min.js' %}" type="text/javascript"> </script> <script src="{% static 'js/bootstrap.min.js' %}" type="text/javascript"> </script> <script src="{% static 'js/custom.js' %}" type="text/javascript"></script> <link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet" type="text/css"> ... ... After running python manage.py collectstatic I get all my static files and the only page that actually loads my static files is the landing page. Any other page (admin, blog, etc.) seems to shove the app/dir name into the link/script tag causing errors. added /blog/ between domain and static url added /admin/ between domain and static url And in my templates/blog/blogs.html {% extends … -
Display detailed info using AJAX
I can get my Django app to display scraped news, but how do I make it show the news content only upon clicking on the news headline using AJAX? I know pretty much nothing about JavaScript (and just started learning Django and REST framework a few days ago). models.py: from django.db import models from datetime import datetime class Headline(models.Model): headline_text = models.CharField(max_length=255) pub_date = models.DateTimeField(default=datetime.now, blank=True) def __str__(self): return self.headline_text class Article(models.Model): headline = models.OneToOneField(Headline, on_delete=models.CASCADE, blank=True) article_text = models.TextField() def __str__(self): return self.article_text serializers.py: from rest_framework import serializers from .models import Headline, Article class ArticleSerializer(serializers.ModelSerializer): class Meta: fields = ('article_text',) model = Article class HeadlineSerializer(serializers.ModelSerializer): article = serializers.SerializerMethodField() # For flattening nested relationship class Meta: fields = ('pk', 'headline_text', 'pub_date', 'article') model = Headline def get_article(self, obj): if getattr(obj, 'article', None): return obj.article.article_text views.py: from django.http import HttpResponse def index(request): latest_headline_list = Headline.objects.order_by('-pub_date') template = loader.get_template('pyscraper/index.html') context = { 'latest_headline_list': latest_headline_list, } return HttpResponse(template.render(context, request)) index.html: <tbody> {% if latest_headline_list %} {% for headline in latest_headline_list %} <tr class="{% cycle 'row1' 'row2' %}"><th class="field-__str__"><a href="{% url 'detail' headline.id %}">{{ headline.headline_text }}</a></th></tr> <tr class="{% cycle 'row1' 'row2' %}"><td class="field-__str__"><p>{{ headline.article.article_text }}</p></td></tr> {% endfor %} {% endif %} </tbody> Example JSON … -
Drawing dependencies in a sentence in Django
I have a sentence and some words in the sentence are connected. At each time a new connection is made I would like to show the dependency graph. Each time a request is made I will pass a json file which specifies which words are connected. How can I draw arrows between words to show the dependencies? Right now all I have found are packages from nltk, which will do the dependency parsing for you, but I want the arrows to have costume names. -
Creating Polls app form Django
Trying to create a form for my polls app.But I am not able to include choices as well for it.I can only add polls right now through admin. (Its the official django polls app tutorial and i am trying to extend it further by adding a form) Models.py class Question(models.Model): question_text = models.CharField(max_length=200) publish_date = models.DateTimeField('date published',null=True,blank=True) def __str__(self): return self.question_text def get_absolute_url(self): return reverse('polls:index') class Choice(models.Model): question_text = models.ForeignKey(Question,on_delete=models.CASCADE) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0) def __str__(self): return self.choice_text forms.py class QuestionForm(forms.ModelForm): question_text = forms.CharField(required=True) publish_date = forms.CharField(required=False) choice_text = forms.CharField(required=True) class Meta(): model = Question fields = ('question_text','choice_text') View To create Poll class CreatePoll(CreateView): redirect_field_name = 'polls/index.html' template_name = 'polls/poll_form.html' form_class = QuestionForm model = Question This is My Form View But the choice entered doesnt get saved.Saw in the admin view too -
python manage.py migrate make me frustated
Hi guys I got a problem when I used command of django-admin startproject mysite, it couldn't work but python -m django startproject mysite is ok. there has been another problems in my CneOs6.8, when inputed python manage.py migrate, which would : [root@localhost mysite]# python manage.py migrate Traceback (most recent call last): File "/usr/local/python3.5.0/lib/python3.5/site- packages/django/db/backends/sqlite3/base.py", line 31, in from pysqlite2 import dbapi2 as Database ImportError: No module named 'pysqlite2' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/python3.5.0/lib/python3.5/site- packages/django/db/backends/sqlite3/base.py", line 33, in from sqlite3 import dbapi2 as Database File "/usr/local/python3.5.0/lib/python3.5/sqlite3/init.py", line 23, in from sqlite3.dbapi2 import * File "/usr/local/python3.5.0/lib/python3.5/sqlite3/dbapi2.py", line 27, in from _sqlite3 import * ImportError: No module named '_sqlite3' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "manage.py", line 22, in execute_from_command_line(sys.argv) File "/usr/local/python3.5.0/lib/python3.5/site- packages/django/core/management/init.py", line 364, in execute_from_command_line utility.execute() File "/usr/local/python3.5.0/lib/python3.5/site- packages/django/core/management/init.py", line 338, in execute django.setup () File "/usr/local/python3.5.0/lib/python3.5/site-packages/django/init.py", line 27, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/python3.5.0/lib/python3.5/site-packages/django/apps/registry.py", line 108, in populate app_config.import_models() File "/usr/local/python3.5.0/lib/python3.5/site-packages/django/apps/config.py", line 202, in import_models self.models_module = import_module(models_module_name) File "/usr/local/python3.5.0/lib/python3.5/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 986, in _gcd_import File " importlib._bootstrap>", line 969, in _find_and_load … -
Why does my aging Django 1.3.1 site say ''TemplateDoesNotExist at /admin/" after migration to a new server?
I have a Django v1.3.1 site on a now-compromised server (used to be on Python v2.7.3). I've been able to reconstruct the bulk of the content via a cache of the old admin site but after re-installing Python and Django on a new server instance (Python v2.7.12), I'm running across the following error: TemplateDoesNotExist at /admin/ admin/login.html Request Method: GET Django Version: 1.3.1 Exception Type: TemplateDoesNotExist Exception Value: admin/login.html Exception Location: /usr/local/lib/python2.7/dist-packages/django/template/loader.py in find_template, line 138 Python Executable: /usr/bin/python Python Version: 2.7.12 Python Path: ['/var/django/mysite', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages'] Server time: Sun, 15 Oct 2017 02:31:49 +0100 The relevant info from trying to load the templates: Django tried loading these templates, in this order: Using loader django.template.loaders.filesystem.Loader: /var/django/mysite/templates/admin/login.html (File does not exist) Using loader django.template.loaders.app_directories.Loader: Looking on the new machine for /admin/index.html I get: locate admin/login.html /usr/local/django/contrib/admin/templates/admin/login.html On the old machine I get: locate admin/login.html /root/build/Django/build/lib.linux-x86_64-2.7/django/contrib/admin/templates/admin/login.html /root/build/Django/django/contrib/admin/templates/admin/login.html /root/build/Django/tests/templates/custom_admin/login.html /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/login.html What have I missed in getting this up and running / how do I resolve this before I start upgrading to the latest Django version?