I'm trying to learn to use the django REST framework via the tutorial. I've gotten to the section "Testing our first attempt at a Web API".
When I start the server, I get:
System check identified no issues (0 silenced).
June 15, 2015 - 00:34:49
Django version 1.8, using settings 'tutorial.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[15/Jun/2015 00:35:17]"GET /snippets/ HTTP/1.1" 500 74404
But when I do the next step: /Library/Frameworks/Python.framework/Versions/3.3/bin/http http://127.0.0.1:8000/snippets/
I get an error which says, among other things:
You're seeing this error because you have <code>DEBUG = True</code> in your
Django settings file. Change that to <code>False</code>, and Django will
display a standard page generated by the handler for this status code.
So, when I change settings.py to say:
DEBUG = False
ALLOWED_HOSTS = ['*']
And then start the server, this happens: In the first terminal window:
^$ python3 manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
June 15, 2015 - 00:52:29
Django version 1.8, using settings 'tutorial.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Then in the second terminal window:
$ /Library/Frameworks/Python.framework/Versions/3.3/bin/http http://127.0.0.1:8000/snippets/
HTTP/1.0 500 Internal Server Error
Content-Length: 59
Content-Type: text/plain
Date: Mon, 15 Jun 2015 00:52:42 GMT
Server: WSGIServer/0.2 CPython/3.3.5
A server error occurred. Please contact the administrator.
And simultaneously, in the first terminal window, a bunch of stuff ending in:
File "/tutorial/tutorial/urls.py", line 9, in <module>
url(r'^admin/', include(snippets.urls)),
NameError: name 'snippets' is not defined
I don't understand how to get this to work. I see that at least one person has asked a similar question about the "DEBUG=False" setting in the context of their own project, but frankly the answer is over my head. Can someone please explain this in the context of the tutorial?
Many thanks!