Request Method: | GET |
---|---|
Request URL: | http://127.0.0.1:8000/ |
Using the URLconf defined in mysite.urls
, Django tried these URL patterns, in this order:
The current URL, , didn't match any of these.
You're seeing this error because you have DEBUG = True
in your Django settings file. Change that to False
, and Django will display a standard 404 page.
testico\
mysite\
__pycache__
__init__.py
settings.py
urls.py
wsgi.py
polls\
__pycache__
migrations
__init__, admin, apps, models, test - .py
urls.py
views.py
db.sqlite3
manage.py
#virtual environment files and directories below
Include, Lib, Scripts, pyvenv.cfg
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^polls/', include('polls.urls')),
url(r'^admin/', admin.site.urls),
]
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
and in my web browser, g chrome:
I have no idea what to do :/ I've read at least 5 answers to problems like mine on stackoverflow, but their solves dont solve that. Can you tell me why doesn't it work? I tried to run it outside of that venv directory, but it changes nothing.
On Sunday 26 March 2017 07:41:06 Paweł Balawender wrote:
> I'm a Django newbie on Windows and try to follow its official tutorial
> <https://docs.djangoproject.com/en/1.10/intro/tutorial01/>. I've done
> everything - as I think - completely fine
Almost. You're told to test runserver *before* creating the app. This is because the "it worked" page is a little magic that depends on DEBUG=True and only the admin urlpatterns registered.
As soon as you add more urls the magic stops working and since you did not define a homepage url, it is a genuine 404.
--
Melvyn Sopacua