You forgot to say what is going wrong... I guessing you're getting a:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/
Using the URLconf defined in |noobie.urls|, Django tried these URL
patterns, in this order:
1. ^admin/
2. ^hello/
The empty path 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.
The error message says a lot already: by the urls.py, your defining your
view "hello" to be in http://127.0.0.1:8000/hello.
Django will not assume anything to your hostname and port number, but
when you run it with "./manage.py runserver" you get a tip about:
~/django/noobie$ ./manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
You have 13 unapplied migration(s). Your project may not work properly
until you apply the migrations for app(s): admin, auth, contenttypes,
sessions.
Run 'python manage.py migrate' to apply them.
July 05, 2017 - 21:32:06
Django version 1.11.1, using settings 'noobie.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Not Found: /
[05/Jul/2017 21:32:12] "GET / HTTP/1.1" 404 2019
Not Found: /favicon.ico
[05/Jul/2017 21:32:12] "GET /favicon.ico HTTP/1.1" 404 2070
Not Found: /favicon.ico
[05/Jul/2017 21:32:12] "GET /favicon.ico HTTP/1.1" 404 2070
[05/Jul/2017 21:32:18] "GET /hello HTTP/1.1" 301 0
[05/Jul/2017 21:32:18] "GET /hello/ HTTP/1.1" 200 11
[05/Jul/2017 21:32:33] "GET /hello/ HTTP/1.1" 200 11
Performing system checks...
Em 05/07/2017 18:23, ahickm...@tamu.edu escreveu:
So I literally just started django, I know 0 about backend dev, but im
going through the djangobook tutorial (also, please excuse me if I use
the wrong syntax). He shows us how to get content to show up on our
temporary domain (a simple Hello World).
The hello world setup looks like so, with the file named views.py,
located in the same directory as urls.py
from django.httpimport HttpResponse
def hello(request): return HttpResponse("Hello world")
And the urls.py file looks like this
from django.conf.urlsimport url
from django.contribimport admin
from mysite.viewsimport hello
urlpatterns= [ url(r'^admin/', admin.site.urls),
url(r'^hello/$', hello),
]
I feel like somethings wrong with the path, or something like that?
I'm kinda of clueless at this point though, I've been working on it
for a while. I don't even know how to go about de-bugging, since this
is vastly different from coding a simple "get all the odd numbers from
a list" problem.
Thanks
--
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+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto: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/7c751df1-c209-455c-bf83-f5fa2ddf3d8b%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/7c751df1-c209-455c-bf83-f5fa2ddf3d8b%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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+unsubscr...@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/a80c70a7-29f1-c671-db9a-f382529d7de8%40gmail.com.
For more options, visit https://groups.google.com/d/optout.