Ich befolge das Tutorial in Django Dokumentation. Ich habe genau wie gesagt in der tutorial getan."Die Ansicht" polls.views.index "hat kein HttpResponse-Objekt zurückgegeben. Stattdessen wurde" None "zurückgegeben." Fehler in Django
Valueerror auf/Umfragen/
Wenn ich auf Browser laden "http://localhost:8000/polls/" Ich bekomme diese Fehlermeldung:
The view polls.views.index didn't return an HttpResponse object. It returned None instead.
Request Method: GET
Request URL: http://localhost:8000/polls/
Django Version: 1.10.1
Exception Type: ValueError
Exception Value:
The view polls.views.index didn't return an HttpResponse object. It returned None instead.
Exception Location: /home/jack/anaconda2/envs/py3k/lib/python3.4/site-packages/django/core/handlers/base.py in _get_response, line 198
Python Executable: /home/jack/anaconda2/envs/py3k/bin/python
Python Version: 3.4.5
Python Path:
['/home/jack/Documents/Django Learning/mysite',
'/home/jack/anaconda2/envs/py3k/lib/python34.zip',
'/home/jack/anaconda2/envs/py3k/lib/python3.4',
'/home/jack/anaconda2/envs/py3k/lib/python3.4/plat-linux',
'/home/jack/anaconda2/envs/py3k/lib/python3.4/lib-dynload',
'/home/jack/anaconda2/envs/py3k/lib/python3.4/site-packages/Sphinx-1.4.1-py3.4.egg',
'/home/jack/anaconda2/envs/py3k/lib/python3.4/site-packages/setuptools-23.0.0-py3.4.egg',
'/home/jack/anaconda2/envs/py3k/lib/python3.4/site-packages']
Server time: Thu, 6 Oct 2016 10:32:20 +0000
Code Of mysite/polls/views.py
from django.shortcuts import render
from django.http import HttpResponse
def index(request):
HttpResponse("Welcome to poll's index!")
# Create your views here.
Bitte fügen Sie den Code Ihrer Ansicht 'Umfragen.Views.index' zu der Frage hinzu. –
Es tut mir leid, ich habe es vorher nicht hinzugefügt. Ich habe es jetzt hinzugefügt. Sie wissen, welchen Fehler ich gemacht habe, der diesen Fehler verursachte? @KlausD. – Omee