5
我剛剛開始玩Django,並且大致上遵循了我自己的一套基本要求的教程。到目前爲止我繪製的模型比教程更全面,但它們編譯得很好。否則,一切都應該是一樣的。爲什麼Django 1.0管理應用程序不能工作?
我的問題是與管理應用程序。我可以登錄到它,並查看編輯模式,但是當我點擊一個模型或任何的改變/添加按鈕,我得到一個404
這是確切的錯誤我得到:
Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/admin/auth/user/add/
App u'', model u'auth', not found.
這些都是相關的文件,什麼是在其中:
urls.py
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^daso/', include('daso.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
#(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin(.*)', admin.site.root)
)
admin.py
from daso.clients.models import Person, Client, Contact
from django.contrib import admin
admin.site.register(Person)
admin.site.register(Client)
admin.site.register(Contact)
models.py - 我只是顯示一個模型
class Client(Person):
relationships = models.ManyToManyField("Contact", through="Relationship", null=True)
disabilities = models.ManyToManyField("Disability", related_name="disability", null=True)
medical_issues = models.ManyToManyField("MedicalIssue", related_name="medical_issue", null=True)
medicare_num = models.CharField(max_length=15, blank=True)
insurance = models.OneToOneField("Insurance", null=True, blank=True)
medications = models.ManyToManyField("Medication", through="Medication_Details", null=True)
def __unicode__(self):
client = u"[Client[id: ", self.id, " name: ", self.first_name, " ", self.last_name, "]"
return client
settings.py
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'daso.clients',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)
這些應該是文件有關的文件/章節。如果有人有關於爲什麼我得到一個404的想法,請賜教?
請注意,當在這裏粘貼時,安裝的應用程序有最後2個應用程序選項卡而不是間隔* 4,並且當重新加載管理頁面時,它工作了半秒,然後再次404'd。奇怪。想法?
哇..謝謝!我覺得現在很愚蠢,儘管這個錯誤並不是很有幫助 – 2008-10-31 11:10:13