TemplateDoesNotExist at /admin/

957 views
Skip to first unread message

Guillermo

unread,
Jan 15, 2008, 7:20:21 PM1/15/08
to Django users

Hi all,

I'm using Windows XP SP2 + Django 0.96.1.

Following along the tutorial, I got this error when I tried to access
the admin interface for the first time:

TemplateDoesNotExist at /admin/
admin/login.html
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Exception Type: TemplateDoesNotExist
Exception Value: admin/login.html
Exception Location: C:\Python25\lib\site-packages\django\template
\loader.py in find_template_source, line 72

I've seen in this board that people solved the issue updating to the
dev version, but that's out of the question for me now --can't use
Subversion.

I've gone through the tutorial twice step by step, so I don't think I
forgot any instructions explained there.

Does anyone know how to fix this? I'm dying to start developing
websites with Django!

Regards,

Guillermo

1234

unread,
Jan 15, 2008, 7:37:29 PM1/15/08
to django...@googlegroups.com
settings.py

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    #"./templates/",
    "E:/myproject/wedding/templates/",
)

you can copy python/libs/site_packges/django/contrib/admin/templates in you project templates



2008/1/16, Guillermo <guillerm...@googlemail.com>:

Guillermo

unread,
Jan 16, 2008, 8:21:08 AM1/16/08
to Django users

It doesn't work. :-(

Two things, though I suppose it was a typo:

Instead of:

python/libs/site_packges/django/contrib/admin/templates

... i only found:

python/libs/site_packges/django/contrib/admin/templatetags

Is that correct? There are no html files in this folder, only python
code.

Regards,

Guillermo

On Jan 16, 1:37 am, 1234 <mydja...@gmail.com> wrote:
> settings.py
>
> TEMPLATE_DIRS = (
> # Put strings here, like "/home/html/django_templates" or
> "C:/www/django/templates".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> #"./templates/",
> "E:/myproject/wedding/templates/",
> )
>
> you can copy python/libs/site_packges/django/contrib/admin/templates in you
> project templates
>
> 2008/1/16, Guillermo <guillermo.lis...@googlemail.com>:

J. Cliff Dyer

unread,
Jan 16, 2008, 8:41:53 AM1/16/08
to django...@googlegroups.com
Guillermo wrote:
> It doesn't work. :-(
>
> Two things, though I suppose it was a typo:
>
> Instead of:
>
> python/libs/site_packges/django/contrib/admin/templates
>
> ... i only found:
>
> python/libs/site_packges/django/contrib/admin/templatetags
>
> Is that correct? There are no html files in this folder, only python
> code.
>
>
Nope.


$ ls lib/python2.4/site-packages/django/contrib/admin/
filterspecs.py media templates urls.py views
__init__.py models.py templatetags utils.py


> Regards,
>
> Guillermo
>


Karen Tracey

unread,
Jan 16, 2008, 10:31:12 AM1/16/08
to django...@googlegroups.com
On Jan 16, 2008 8:21 AM, Guillermo <guillerm...@googlemail.com> wrote:
It doesn't work. :-(

Two things, though I suppose it was a typo:

Instead of:

python/libs/site_packges/django/contrib/admin/templates

... i only found:

python/libs/site_packges/django/contrib/admin/templatetags

Is that correct? There are no html files in this folder, only python
code.

How did you get/install 0.96?  I've seen this reported before but I don't know what causes it, and have not been able to recreate it myself.  You are missing the admin templates.  One fix (assuming nothing else is missing) would be to untar the 0.96 release file and manually xcopy the django/contrib/admin/templates tree to where it belongs in your site-packages directory.

Karen

Guillermo

unread,
Jan 16, 2008, 10:38:45 AM1/16/08
to Django users

> How did you get/install 0.96? I've seen this reported before but I don't
> know what causes it, and have not been able to recreate it myself. You are
> missing the admin templates.

I downloaded the official release from the Django Project site and
followed the installation tutorial. I doubt this is the root of the
problem, but I installed Django from a different partition than
Python.

>One fix (assuming nothing else is missing)
> would be to untar the 0.96 release file and manually xcopy the
> django/contrib/admin/templates tree to where it belongs in your
> site-packages directory.

I thought of that as soon as I saw J. Cliff Dyer's post. I'll give it
a try and post back with the results.

Thanks,

Guillermo

Guillermo

unread,
Jan 16, 2008, 4:57:23 PM1/16/08
to Django users

Now it worked! :-)

These two folders were missing in my install:

python/libs/site_packges/django/contrib/admin/templates
python/libs/site_packges/django/contrib/admin/media

Copying them from the downloaded django installation files does the
trick.

Cheers,

Guillermo

aws.python.enthusiast

unread,
Jan 23, 2008, 10:28:22 PM1/23/08
to Django users
What I found is the following:

Platform: Windows-XP

(1) When I check out the trunk from svn (svn co http://code.djangoproject.com/svn/django/trunk
django-source) and then run "python setup.py install" from django-
source, the script does not install the following:

site_packages/django/contrib/admin/templates
site_packages/django/contrib/admin/media

When I look in the "build" directory (django-source/build) which is
generated when I run "python setup.py install", the above two
directories are missing

(2) If I manually copy these two directories from django-source/django/
contrib/admin to site_packages/django/ I no longer get this error on
the tutorial

(3) I do not have this project if I use 0.96, ie the "official
release"

(4) However, when I use the official release, I have a different
problem in that setup.py does not work. This is referenced in another
thread. Apparently there is a bug in setup.py & MANIFEST.in in the
0.96 "official release" that was fixed soon after the release.

I am too new to django to offer to fix this trunk and contribute and
am certain that it will be fixed in the next "official release"

Nathan

unread,
Feb 3, 2008, 7:07:52 PM2/3/08
to Django users
Same error here on Mac OS X Leopard, having installed from the 0.96.1
tarball via setup.py.

TemplateDoesNotExist at /admin/
admin/login.html

Those folders are not present in:
/Library/Python/2.5/site-packages/django/contrib/admin/

A manual copy + authenticate resolved the issue.

RichardH

unread,
Feb 18, 2008, 6:20:37 PM2/18/08
to Django users
Just rebuilt Windows XP on a new hard disk and I have found the same
problem installing Python 2.5 and the latest SVN checkout (rev 7129).
Setup.py install doesn't copy across the templates and media folders
into C:\Python25\Lib\site-packages\django\contrib\admin.
Like Nathan, a manual copy solved the issue.
RichardH

Karen Tracey

unread,
Feb 18, 2008, 7:38:35 PM2/18/08
to django...@googlegroups.com
On Feb 18, 2008 6:20 PM, RichardH <Richar...@i-logue.com> wrote:

Just rebuilt Windows XP on a new hard disk and I have found the same
problem installing Python 2.5 and the latest SVN checkout (rev 7129).
Setup.py install doesn't copy across the templates and media folders
into C:\Python25\Lib\site-packages\django\contrib\admin.
Like Nathan, a manual copy solved the issue.

OK, I finally found a way to recreate this on my WinXP box.  What I have to do is issue the command:

setup.py install

instead of:

python setup.py install

(However this directly contradicts a note earlier in this discussion where the poster says it is 'python setup.py install' that does not work, so ymmv.)

I don't understand the difference, because I thought those two commands were equivalent.  I checked the file type association for .py files and the action on open is defined as:

"C:\bin\Python25\python.exe" "%1" %*

(That's the only python installed on this box.)

"Use DDE" is checked, "DDE Message" is empty, "Application" is python, "DDE Application Not Running" is empty, and "Topic" is System.  Whatever that all means.

Examining the output of the first command shows that 'install_data' part of the process doesn't seem to do anything:

running install_scripts
copying build\scripts-2.5\django-admin.py -> C:\bin\Python25\Scripts
running install_data
running install_egg_info
Writing C:\bin\Python25\Lib\site-packages\Django-0.97_pre-py2.5.egg-info

Whereas with the same command preceded by 'python', the 'install_data' step does work:

running install_scripts
copying build\scripts-2.5\django-admin.py -> c:\bin\Python25\Scripts
running install_data
creating c:\bin\Python25\Lib\site-packages\django\conf\locale
creating c:\bin\Python25\Lib\site-packages\django\conf\locale\ar
creating c:\bin\Python25\Lib\site-packages\django\conf\locale\ar\LC_MESSAGES
copying django\conf\locale\ar\LC_MESSAGES\django.mo -> c:\bin\Python25\Lib\site-packages\django\conf\locale\ar\LC_MESSAGES
[much more snipped, including creating/copying all the admin media and template files]

Other than the 'install_data' difference, the output of the two different ways of invoking setup seems to be identical.

I would be interested if others who have run into this problem can duplicate the different results of these commands.  Also wondering if people who were missing templates and media files are also missing locale files?

Karen

RichardH

unread,
Feb 19, 2008, 4:06:51 PM2/19/08
to Django users
Karen,
Thanks for your analysis. Yes, I can confirm that I don't have the
locale files either.
Deleting my Django install and "running python setup.py install" does
a correct install on mine as well.
I would be interested to hear if anyone knows why the difference
between python setup.py and setup.py?
Regards,
Richard

On Feb 19, 12:38 am, "Karen Tracey" <kmtra...@gmail.com> wrote:

Karen Tracey

unread,
Feb 19, 2008, 4:28:25 PM2/19/08
to django...@googlegroups.com
On Feb 19, 2008 4:06 PM, RichardH <Richar...@i-logue.com> wrote:

Karen,
Thanks for your analysis. Yes, I can confirm that I don't have the
locale files either.
Deleting my Django install and "running python setup.py install" does
a correct install on mine as well.
I would be interested to hear if anyone knows why the difference
between python setup.py and setup.py?

I've dug into this a little further and the different results seem to be caused by different values of the __file__ variable depending on how the script is invoked.  On Windows using 'setup.py install', __file__ is fully-qualified (e.g. 'C:\path\to\django\setup.py') whereas with 'python setup.py install', __file__ is simply 'setup.py'.  The fuly-qualified version causes problems since it finds its way into the destination directory for the data files, so data files don't get copied to the installation target directory. 

Still looking into what the right fix is, but at least now it seems like we've got a handle on what the problem is.  It's been popping up on the list for quite a while, and I've always found it mysterious since I could never recreate it.

Karen
 

Karen Tracey

unread,
Feb 22, 2008, 9:40:38 AM2/22/08
to django...@googlegroups.com
On Tue, Feb 19, 2008 at 4:28 PM, Karen Tracey <kmtr...@gmail.com> wrote:
On Feb 19, 2008 4:06 PM, RichardH <Richar...@i-logue.com> wrote:

Karen,
Thanks for your analysis. Yes, I can confirm that I don't have the
locale files either.
Deleting my Django install and "running python setup.py install" does
a correct install on mine as well.
I would be interested to hear if anyone knows why the difference
between python setup.py and setup.py?

I've dug into this a little further and the different results seem to be caused by different values of the __file__ variable depending on how the script is invoked.  On Windows using 'setup.py install', __file__ is fully-qualified (e.g. 'C:\path\to\django\setup.py') whereas with 'python setup.py install', __file__ is simply 'setup.py'.  The fuly-qualified version causes problems since it finds its way into the destination directory for the data files, so data files don't get copied to the installation target directory. 

Still looking into what the right fix is, but at least now it seems like we've got a handle on what the problem is.  It's been popping up on the list for quite a while, and I've always found it mysterious since I could never recreate it.


Malcolm checked in a fix for this problem yesterday (changeset 7139).  So as of that revision, setup.py on Windows should work regardless of whether the command starts with "python".  Hopefully that's the last of the mysterious missing admin templates.

Cheers,
Karen
Reply all
Reply to author
Forward
0 new messages