Django 1.0 관리자 애플리케이션이 작동하지 않는 이유는 무엇입니까?

StackOverflow https://stackoverflow.com/questions/252531

  •  05-07-2019
  •  | 
  •  

문제

방금 Django와 함께 연주를 시작했고 자체 기본 요구 사항 세트와 함께 튜토리얼을 느슨하게 팔로우했습니다. 내가 지금까지 스케치 한 모델은 튜토리얼보다 훨씬 포괄적이지만 잘 컴파일합니다. 그렇지 않으면 모든 것이 동일해야합니다.

내 문제는 관리자 응용 프로그램에 관한 것입니다. 로그인하고 편집 가능한 모델을 볼 수 있지만 모델이나 변경/추가 버튼을 클릭하면 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를 받고 있는지에 대한 아이디어가 있다면 나를 밝히십시오.

여기에 붙여 넣을 때 설치된 앱에는 Spaced*4 대신 마지막 2 개의 앱 탭이 있었고 관리 페이지를 다시로드 할 때는 0.2 초 동안 작동 한 다음 다시 404'd로 작동했습니다. 이상한. 아이디어?

도움이 되었습니까?

해결책

당신이 쫓아 내기 때문입니다 / 안에 urls.py. 관리 라인을 다음으로 변경하십시오.

(r'^admin/(.*)', admin.site.root),

내 서버에서 이것을 확인했고 당신의 라인과 동일한 오류가 발생했습니다. urls.py.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top