I am confused on this part of the Django tutorial. It says something like copying the whole admin templates to dbe/templates, but what is the full path should be and what folders am I suppose to be creating?
I am running Mac OS X and my todo app is located at /Users/hobbes3/Sites/mysite/todo/ and my full Django path is /usr/local/lib/python2.7/site-packges/django/.
I also placed my templates at /Users/hobbes3/Sites/myDjango/templates. Inside this folder I have admin/base_site.html and polls/detail.html, polls/index.html, and polls/results.html. The poll app was created from the official Django tutorial. My copy of the poll app works fine.
The error I get when I run the server with python manage.py runserver and I go to http://127.0.0.1:8000/admin/ is
ImportError at /admin/
No module named dbe.todo.models
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Django Version: 1.3.1
Exception Type: ImportError
Exception Value:
No module named dbe.todo.models
Exception Location: /Users/hobbes3/Sites/mysite/todo/admin.py in <module>, line 1
Python Executable: /usr/local/bin/python
Python Version: 2.7.2
Python Path:
['/Users/hobbes3/Sites/mysite',
'/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg',
'/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.4-x86_64.egg',
'/usr/local/Cellar/python/2.7.2/lib/python27.zip',
'/usr/local/Cellar/python/2.7.2/lib/python2.7',
'/usr/local/Cellar/python/2.7.2/lib/python2.7/plat-darwin',
'/usr/local/Cellar/python/2.7.2/lib/python2.7/plat-mac',
'/usr/local/Cellar/python/2.7.2/lib/python2.7/plat-mac/lib-scriptpackages',
'/usr/local/Cellar/python/2.7.2/lib/python2.7/lib-tk',
'/usr/local/Cellar/python/2.7.2/lib/python2.7/lib-old',
'/usr/local/Cellar/python/2.7.2/lib/python2.7/lib-dynload',
'/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages',
'/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']
Server time: Fri, 24 Feb 2012 05:09:28 -0600
For starters, you should follow the official tutorial: https://docs.djangoproject.com/en/dev/intro/tutorial01/
The tutorial you’re following looks pretty awful (sorry :/)
I suspect that dbe is the project name of this guy. When he shows:
It seems that he has django and the project at the same level. So his dbe == your mysite.
Anyhow, there is no need to prefix app modules with the project module name, this is ridiculous – hard coding the project name in the apps. This totally defeats the purpose of reusable apps. Run this:
This command will remove ‘dbe.’ from everywhere in your code. This tutorial code is so horrible I wonder why you even bother following it …