From 44ae037e81d0ca24e28a3506564a92e1ac247eb1 Mon Sep 17 00:00:00 2001 From: Peter Baehr Date: Tue, 15 Dec 2015 21:17:52 -0500 Subject: [PATCH] Move urls.py changes down and add necessary import The previous location of editting urls.py did not allow migrations to be created and the default import needs to be modified --- docs/tutorial/1-serialization.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index 890f8d561..bd3fce33d 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -48,12 +48,6 @@ We'll need to add our new `snippets` app and the `rest_framework` app to `INSTAL 'snippets', ) -We also need to wire up the root urlconf, in the `tutorial/urls.py` file, to include our snippet app's URLs. - - urlpatterns = [ - url(r'^', include('snippets.urls')), - ] - Okay, we're ready to roll. ## Creating a model to work with @@ -299,6 +293,14 @@ Finally we need to wire these views up. Create the `snippets/urls.py` file: url(r'^snippets/$', views.snippet_list), url(r'^snippets/(?P[0-9]+)/$', views.snippet_detail), ] + +We also need to wire up the root urlconf, in the `tutorial/urls.py` file, to include our snippet app's URLs. + + from django.conf.urls import url, include + + urlpatterns = [ + url(r'^', include('snippets.urls')), + ] It's worth noting that there are a couple of edge cases we're not dealing with properly at the moment. If we send malformed `json`, or if a request is made with a method that the view doesn't handle, then we'll end up with a 500 "server error" response. Still, this'll do for now.