I get this error when trying to go to my Django app's admin panel:
TemplateDoesNotExist at /admin/index.html
Exception Location: /home/mhb11/.virtualenvs/redditpk/local/lib/python2.7/site-packages/django/template/loader.py in find_template, line 139
Template-loader postmortem Django tried loading these templates, in this order: Using loader django.template.loaders.filesystem.Loader: Using loader django.template.loaders.app_directories.Loader: /home/mhb11/folder/project/templates/admin/index.html (File does not exist) /home/mhb11/.virtualenvs/projectenv/local/lib/python2.7/site-packages/bootstrap_pagination/templates/admin/index.html (File does not exist)
I have a new Django installation, haven't moved any files, and settings.py has django.contrib.admin added in INSTALLED_APPS.
If I go to /.virtualenvs/projectenv/local/lib/python2.7/site-packages/django/contrib/admin/ I do NOT find a /templates/ folder there (which would contained index.html and a bunch of other files). 
However, exactly the same project, installed in a different machine DOES HAVE that /templates/ folder. I uninstalled and reinstalled Django in my virtual environment, but to no avail. 
Installed apps in settings.py has the following:
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    #'django.contrib.sessions',
    'user_sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'django.contrib.comments',
    'myapp',
    'myproject',
    'south',
    'registration',
    'bootstrap_pagination',
    'djcelery',
    'tweepy',
    'django.contrib.humanize',
    'analytical',
    'mathfilters',
    #'request',
    #'debug_toolbar',
    #'analytical',
    #'django_whoshere',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)
And the full trace of the error I get is:
Internal Server Error: /admin/ Traceback (most recent call last):   File "/home/mhb11/.virtualenvs/projectenv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 140, in get_response
    response = response.render()   File "/home/mhb11/.virtualenvs/projectenv/local/lib/python2.7/site-packages/django/template/response.py", line 105, in render
    self.content = self.rendered_content   File "/home/mhb11/.virtualenvs/projectenv/local/lib/python2.7/site-packages/django/template/response.py", line 80, in rendered_content
    template = self.resolve_template(self.template_name)   File "/home/mhb11/.virtualenvs/projectenv/local/lib/python2.7/site-packages/django/template/response.py", line 58, in resolve_template
    return loader.get_template(template)   File "/home/mhb11/.virtualenvs/projectenv/local/lib/python2.7/site-packages/django/template/loader.py", line 146, in get_template
    template, origin = find_template(template_name)   File "/home/mhb11/.virtualenvs/projectenv/local/lib/python2.7/site-packages/django/template/loader.py", line 139, in find_template
    raise TemplateDoesNotExist(name) TemplateDoesNotExist: admin/index.html
Have you ever seen anything like it? How do I solve this?
I had to install an old django 1.3 with pip and I faced a similar problem. The templates folder was missing in the django app.
Thanks to @manu comment on @shahz answer, I fixed the problem by reinstalling with
pip install --no-binary django django==1.3.7
A recent version of pip is required. It may be updated with 
pip install --upgrade pip
                        I've seen this before. /templates/ isn't the only folder you're probably missing. And note that you have a django folder placed here /yourvirtualenv/django/ that has all the required folders. What will solve the problem for you is copying the files (without over-writing) from /yourvirtualenv/django/ to /yourvirtualenv/local/lib/python2.7/site-packages/django/ via the following ubuntu command: rsync -a -v --ignore-existing src dstwhere src is /yourvirtualenv/django/ (i.e. source) and dst is /yourvirtualenv/local/lib/python2.7/site-packages/django/ (i.e. destination). Next, just fire up Django admin again and it should work!
I'm not exactly sure why this happens - anecdotally, it's pip misbehaving with legacy Django installations. I'll update this answer if I get new information on it. Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With