Hi
-- I'm a Django newbie on Windows and try to follow its official tutorial. I've done everything - as I think - completely fine, but at the last step I get a 404 Error, more precisely, that:
Page not found (404)
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:
- ^polls/
- ^admin/
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.
My directories are laid out like that:
#venv - directory of my virtual environment
venv\
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
where testico\mysite\urls.py is just copypasted from tutorial's page, so:
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),
]
and testico\polls\urls.py is copypasted too, so:
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
views is a short code, copied too:
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.")
Nothing could help, so, as you've seen higher, I've just copied everything from the official website.
Here is what do I do at command prompt:
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.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bf7064c2-9f37-4378-8376-77ae22ddb16c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment