Python 当我尝试运行Django服务器时,我遇到了以下问题
我正在尝试运行Django服务器,我面临以下问题。所以,我是Django的新手,如果您需要任何其他信息,请告诉我。这段代码对我来说非常复杂,我正在挑战自己同时运行多个应用程序Python 当我尝试运行Django服务器时,我遇到了以下问题,python,django,server,request,Python,Django,Server,Request,我正在尝试运行Django服务器,我面临以下问题。所以,我是Django的新手,如果您需要任何其他信息,请告诉我。这段代码对我来说非常复杂,我正在挑战自己同时运行多个应用程序 Environment: Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 2.2.2 Python Version: 3.6.4 Installed Applications:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 2.2.2
Python Version: 3.6.4
Installed Applications:
['registration',
'mailqueue',
'el_pagination',
'social_django',
'django_inlinecss',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main',
'users']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'social_django.middleware.SocialAuthExceptionMiddleware']
您的代码正在查找一个不存在的特定
模式
对象。根据@KlausD.的注释,您的回溯告诉您正在运行此查询:Mode=Mode.objects.get(id=1)
,并且没有具有该id的模式。确定。解决这个问题有什么额外的建议吗?我试图删除这条线,但它不起作用。
Traceback:
File "/home/rnominato/anaconda3/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/home/rnominato/anaconda3/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
115. response = self.process_exception_by_middleware(e, request)
File "/home/rnominato/anaconda3/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
113. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/rnominato/PycharmProjects/Liben_Feb_2020/main/decorators.py" in wrap
20. mode = Mode.objects.get(id=1)
File "/home/rnominato/anaconda3/lib/python3.6/site-packages/django/db/models/manager.py" in manager_method
82. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/rnominato/anaconda3/lib/python3.6/site-packages/django/db/models/query.py" in get
408. self.model._meta.object_name
Exception Type: DoesNotExist at /
Exception Value: Mode matching query does not exist.