python - DoesNotExist at /admin -
i'm getting error:
doesnotexist @ /admin quiz matching query not exist. lookup parameters {'url': u'admin'}
but, checked other solution in so, removing #'django.contrib.sites', doesn't work me.
these installed apps:
installed_apps = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', #'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'simulado', 'multichoice', 'django.contrib.admin', )
this urls.py
from django.conf.urls import patterns, include, url # uncomment next 2 lines enable admin: django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # examples: # url(r'^$', 'quiz.views.home', name='home'), # url(r'^quiz/', include('quiz.foo.urls')), # uncomment next line enable admin: url(r'^admin/', include(admin.site.urls)), #################### # quiz base url url(r'^$', 'simulado.views.index'), # quiz category list url(r'^category/(?p<slug>[^\.]+)', 'simulado.views.view_category', name='view_quiz_category'), # cart #url(r'^carrinho$', 'simulado.views.carrinho'), #url(r'^carrinho2$', 'simulado.views.carrinho2', name = "carrinho2"), #url(r'^buyitem$', 'simulado.views.buyitem', name = "buyitem"), # progress url(r'^progress/$', 'simulado.views.progress'), url(r'^progress$', 'simulado.views.progress'), # passes variable 'quiz_name' quiz_take view url(r'^(?p<quiz_name>[\w-]+)/$', 'simulado.views.quiz_take'), # quiz/ url(r'^(?p<quiz_name>[\w-]+)$', 'simulado.views.quiz_take'), # quiz url(r'^(?p<quiz_name>[\w-]+)/take/$', 'simulado.views.quiz_take'), # quiz/take/ url(r'^(?p<quiz_name>[\w-]+)take$', 'simulado.views.quiz_take'), # quiz/take )
this results of syncdb
creating tables ... creating table auth_permission creating table auth_group_permissions creating table auth_group creating table auth_user_groups creating table auth_user_user_permissions creating table auth_user creating table django_content_type creating table django_session creating table simulado_category creating table simulado_quiz creating table simulado_progress creating table simulado_sitting creating table multichoice_question_quiz creating table multichoice_question creating table multichoice_answer creating table django_admin_log installed django's auth system, means don't have superusers defined. admin.autodiscover() installed django's auth system, means don't have superusers defined. create 1 now? (yes/no): yes username (leave blank use 'filipeferminiano'): email address: filipe.ferminiano@gmail.com password: password (again): superuser created successfully.
this traceback
environment: request method: request url: http://127.0.0.1:8000/admin django version: 1.5 python version: 2.7.6 installed applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'simulado', 'multichoice', 'django.contrib.admin') installed middleware: ('django.middleware.common.commonmiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware') traceback: file "/usr/local/cellar/python/2.7.6/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 115. response = callback(request, *callback_args, **callback_kwargs) file "/users/filipeferminiano/documents/django/quiz/quiz/simulado/views.py" in quiz_take 71. quiz = quiz.objects.get(url=quiz_name.lower()) file "/usr/local/cellar/python/2.7.6/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/django/db/models/manager.py" in 143. return self.get_query_set().get(*args, **kwargs) file "/usr/local/cellar/python/2.7.6/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/django/db/models/query.py" in 401. (self.model._meta.object_name, kwargs)) exception type: doesnotexist @ /admin exception value: quiz matching query not exist. lookup parameters {'url': u'admin'}
then django creates superuser not showing error. should do?
i found problem.
you trying localhost:8000/admin
without slash @ end, , there url in urls.py matches that:
url(r'^(?p<quiz_name>[\w-]+)$', 'simulado.views.quiz_take'), # quiz
the exception raised in view, has nothing admin. fix urls , that's all.
Comments
Post a Comment