Anonymous user
Django for ISchoolers: Difference between revisions
no edit summary
imported>Aldeka No edit summary |
imported>Aldeka No edit summary |
||
Line 256:
== Starting yer app ==
In this tutorial, we’ll create our
* Open your terminal and navigate into the mysite folder
Line 365:
* Save and commit.
Review: When somebody requests a page from your Web site – say, “/questions/23/”, Django will load the urls.py Python module, because it’s pointed to by the ROOT_URLCONF setting. It finds the variable named urlpatterns and traverses the regular expressions in order. When it finds a regular expression that matches – r'^
<code>detail(request=<HttpRequest object>, '23')</code>
Line 380:
* Fetch “http://127.0.0.1:8000/questions/” in your browser. You should get a pleasantly-colored error page with the following message:
<code>ViewDoesNotExist at /
Tried index in module qandabear.views. Error was: 'module'
Line 399:
'/Users/adalovelace/gits/mysite/questions/views.py'</code>
So, a mystery? Where is the view!? It’s nowhere! The URL parsing is going fine, but there is no one listening at the other end of the phone! This ViewDoesNotExist error happened because you haven’t written a function index() in the module
Well, I guess we should do that!
Line 571:
===Fix The Hideous Default Representation===
Wait a minute! <Question: Question object> is an utterly unhelpful, truly wretched, beyond contemptable representation of this object. Let’s fix that by editing the Question model. Use your text editor to open the
<code>class Question(models.Model):
|