@@ -69,6 +69,12 @@ create one. We'll use a script installed by Django, ``django-admin.py``:
6969
7070 (djangoenv)$ django-admin.py startproject mysite
7171
72+ If you're on windows, that command is slightly different:
73+
74+ .. code-block :: bash
75+
76+ django-admin.exe startproject mysite
77+
7278 This will create a folder called 'mysite'. The folder contains the following
7379structure::
7480
@@ -169,8 +175,8 @@ folder.
169175Edit your ``settings.py `` to match:
170176
171177.. code-block :: python
172-
173-
178+
179+
174180 DATABASES = {
175181 ' default' : {
176182 ' ENGINE' : ' django.db.backends.sqlite3' ,
@@ -217,7 +223,7 @@ Great! Now we can set up an initial user who'll be able to do anything, a
217223
218224 Notice that as you type your password, it will not appear on the screen. Don't
219225worry, it's actually being recorded. You just can't see it (and neither can
220- than snoopy git looking over your shoulder).
226+ that snoopy git looking over your shoulder).
221227
222228Projects and Apps
223229=================
@@ -244,8 +250,8 @@ Django already includes some *apps* for you.
244250 They're in ``settings.py `` in the ``INSTALLED_APPS `` setting:
245251
246252 .. code-block :: python
247-
248-
253+
254+
249255 INSTALLED_APPS = (
250256 ' django.contrib.admin' ,
251257 ' django.contrib.auth' ,
@@ -322,7 +328,7 @@ following:
322328
323329 from django.db import models # <-- This is already in the file
324330 from django.contrib.auth.models import User
325-
331+
326332 class Post (models .Model ):
327333 title = models.CharField(max_length = 128 )
328334 text = models.TextField(blank = True )
@@ -417,7 +423,7 @@ in your editor, and find the INSTALLED_APPS setting.
417423You extend Django functionality by *installing apps *. This is pretty simple:
418424
419425.. code-block :: python
420-
426+
421427
422428 INSTALLED_APPS = (
423429 ' django.contrib.admin' ,
@@ -515,7 +521,7 @@ And now our instance should validate properly:
515521.. code-block :: python
516522
517523 >> > p1.full_clean()
518- >> >
524+ >> >
519525
520526
521527 Saving New Objects
@@ -525,7 +531,7 @@ Our model has three date fields, two of which are supposed to be
525531auto-populated:
526532
527533.. class :: python
528-
534+
529535 >>> print (p1.created_date)
530536 None
531537 >>> print (p1.modified_date)
@@ -630,11 +636,11 @@ If you are curious, you can see the SQL that a given QuerySet will use:
630636.. code-block :: pycon
631637
632638 >>> print(c.query)
633- SELECT "myblog_post"."id", "myblog_post"."title",
634- "myblog_post"."text", "myblog_post"."author_id",
635- "myblog_post"."created_date", "myblog_post"."modified_date",
636- "myblog_post"."published_date"
637- FROM "myblog_post"
639+ SELECT "myblog_post"."id", "myblog_post"."title",
640+ "myblog_post"."text", "myblog_post"."author_id",
641+ "myblog_post"."created_date", "myblog_post"."modified_date",
642+ "myblog_post"."published_date"
643+ FROM "myblog_post"
638644 WHERE ("myblog_post"."title" LIKE %post% ESCAPE '\'
639645 AND NOT ("myblog_post"."text" LIKE %created% ESCAPE '\' )
640646 )
@@ -731,7 +737,7 @@ Now that we have a fixture, we need to instruct our tests to use it.
731737Edit ``tests.py `` to look like this:
732738
733739.. code-block :: python
734-
740+
735741
736742 from django.test import TestCase
737743 from django.contrib.auth.models import User
@@ -775,7 +781,7 @@ Let's write a test that demonstrates our desired outcome:
775781
776782 To run tests, use the ``test `` management command. Without arguments, it will
777783run all TestCases it finds in all installed *apps *. You can pass the name of a
778- single app to focus on those tests.
784+ single app to focus on those tests.
779785
780786Quit your Django shell and in your terminal run the test we wrote:
781787
@@ -812,7 +818,7 @@ Let's add an appropriate ``__unicode__`` method to our Post class.
812818.. code-block :: python
813819
814820 class Post (models .Model ):
815- # ...
821+ # ...
816822
817823 def __unicode__ (self ):
818824 return self .title
@@ -916,7 +922,7 @@ stroke.
916922 verify the following lines in ``urls.py ``:
917923
918924 .. code-block :: python
919-
925+
920926
921927 from django.contrib import admin # <- should be present already
922928
0 commit comments