Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Changed tutorial2 to use 'django-admin runserver' instead of mod_pyth…

…on. Also updated WSGI mentions in the docs, now that we're WSGI-friendly.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@187 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b55b29c891b6b6b692d3e39f49875163a21e896e 1 parent 62cc287
Adrian Holovaty authored
56  docs/faq.txt
@@ -21,7 +21,6 @@ able to give something back to the open-source community.
21 21
 .. _Python: http://www.python.org/
22 22
 .. _PostgreSQL: http://www.postgresql.org/
23 23
 
24  
-
25 24
 What does "Django" mean, and how do you pronounce it?
26 25
 -----------------------------------------------------
27 26
 
@@ -97,8 +96,8 @@ Lawrence, Kansas, USA.
97 96
 Django appears to be a MVC framework, but you call the Controller the "view", and the View the "template". How come you don't use the standard names?
98 97
 -----------------------------------------------------------------------------------------------------------------------------------------------------
99 98
 
100  
-That's because Django isn't strictly a MVC framework.  We don't really believe in
101  
-any capital-M Methodologies; we do what "feels" right.  If you squint the right
  99
+That's because Django isn't strictly a MVC framework. We don't really believe in
  100
+any capital-M Methodologies; we do what "feels" right. If you squint the right
102 101
 way, you can call Django's ORM the "Model", the view functions the "View", and
103 102
 the dynamically-generated API the "Controller" -- but not really.
104 103
 
@@ -109,7 +108,7 @@ where it makes sense.
109 108
 Do you have any of those nifty "screencast" things?
110 109
 ---------------------------------------------------
111 110
 
112  
-They're in the works. It's amazing how much time those things take!  Stay tuned...
  111
+They're in the works. It's amazing how much time those things take! Stay tuned...
113 112
 
114 113
 Installation questions
115 114
 ======================
@@ -120,13 +119,14 @@ How do I get started?
120 119
     #. `Download the code`_.
121 120
     #. Install Django (read the `installation guide`_).
122 121
     #. Walk through the tutorial_.
123  
-    #. Check out the rest of the documentation_, and ask questions if you
  122
+    #. Check out the rest of the documentation_, and `ask questions`_ if you
124 123
        run into trouble.
125 124
 
126 125
 .. _`Download the code`: http://www.djangoproject.com/download/
127 126
 .. _`installation guide`: http://www.djangoproject.com/documentation/install/
128 127
 .. _tutorial:  http://www.djangoproject.com/documentation/tutorial1/
129 128
 .. _documentation: http://www.djangoproject.com/documentation/
  129
+.. _ask questions: http://www.djangoproject.com/community/
130 130
 
131 131
 How do I fix the "install a later version of setuptools" error?
132 132
 ---------------------------------------------------------------
@@ -136,7 +136,13 @@ Just run the ``ex_setup.py`` script in the Django distribution.
136 136
 What are Django's prerequisites?
137 137
 --------------------------------
138 138
 
139  
-Django requires Python_ 2.3 or later, `Apache 2`_, and mod_python_.
  139
+Django requires Python_ 2.3 or later.
  140
+
  141
+For a development environment -- if you just want to experiment with Django --
  142
+you don't need to have a separate Web server installed; Django comes with its
  143
+own lightweight development server. For a production environment, we recommend
  144
+`Apache 2`_ and mod_python_, although Django follows the WSGI_ spec, which
  145
+means it can run on a variety of server platforms.
140 146
 
141 147
 You'll also need a database engine. PostgreSQL_ is recommended, and MySQL_ is
142 148
 supported.
@@ -144,18 +150,32 @@ supported.
144 150
 .. _Python: http://www.python.org/
145 151
 .. _Apache 2: http://httpd.apache.org/
146 152
 .. _mod_python: http://www.modpython.org/
  153
+.. _WSGI: http://www.python.org/peps/pep-0333.html
147 154
 .. _PostgreSQL: http://www.postgresql.org/
148 155
 .. _MySQL: http://www.mysql.com/
149 156
 
150  
-How do I install mod_python on Windows?
151  
----------------------------------------
  157
+Do I have to use mod_python?
  158
+----------------------------
  159
+
  160
+Not if you just want to play around and develop things on your local computer.
  161
+Django comes with its own Web server, and things should Just Work.
  162
+
  163
+For production use, though, we recommend mod_python. The Django developers have
  164
+been running it on mod_python for about two years, and it's quite stable.
  165
+
  166
+However, if you don't want to use mod_python, you can use a different server,
  167
+as long as that server has WSGI_ hooks. More information on alternate server
  168
+arrangements is forthcoming.
152 169
 
153  
-    * If you are running Python 2.4, check out this `guide to mod_python & Python 2.3`_.
  170
+.. _WSGI: http://www.python.org/peps/pep-0333.html
154 171
 
155  
-    * For Python 2.3, grab mod_python from http://www.mod_python.org/, the read
156  
-      `Running mod_python on Apache on Windows2000`_.
  172
+How do I install mod_python on Windows?
  173
+---------------------------------------
157 174
 
158  
-    * Also try this (not Windows-specific) `guide to getting mod_python working`_.
  175
+* For Python 2.4, check out this `guide to mod_python & Python 2.3`_.
  176
+* For Python 2.3, grab mod_python from http://www.mod_python.org/ and read
  177
+  `Running mod_python on Apache on Windows2000`_.
  178
+* Also, try this (not Windows-specific) `guide to getting mod_python working`_.
159 179
 
160 180
 .. _`guide to mod_python & Python 2.3`: http://www.lehuen.com/nicolas/index.php/2005/02/21/39-win32-build-of-mod_python-314-for-python-24
161 181
 .. _`Running mod_python on Apache on Windows2000`: http://groups-beta.google.com/group/comp.lang.python/msg/139af8c83a5a9d4f
@@ -163,19 +183,12 @@ How do I install mod_python on Windows?
163 183
 
164 184
 (Thanks to deelan for this info.)
165 185
 
166  
-Do I have to use mod_python?
167  
-----------------------------
168  
-
169  
-In the first release, yes. However, WSGI_ support (which will let Django run
170  
-under FCGI, SCGI, medusa, etc.) is in the works. Stay tuned!
171  
-
172  
-.. _WSGI: http://www.python.org/peps/pep-0333.html
173  
-
174 186
 Will Django run under shared hosting (like TextDrive or Dreamhost)?
175 187
 -------------------------------------------------------------------
176 188
 
177 189
 Right now, no, unless you can get your host to install mod_python. However, as
178  
-the previous answer says, WSGI support is coming!
  190
+the community starts to use Django's WSGI bindings with other Web servers, this
  191
+will probably be possible sooner rather than later.
179 192
 
180 193
 Using Django
181 194
 ============
@@ -244,4 +257,3 @@ be possible by editing the CSS stylesheet. We've got a `guide to the CSS used in
244 257
 the admin`_ to get you started.
245 258
 
246 259
 .. _`guide to the CSS used in the admin`: http://www.djangoproject.com/documentation/admin_css/
247  
-
24  docs/install.txt
@@ -7,16 +7,20 @@ This document will get you up and running with Django.
7 7
 Install Apache and mod_python
8 8
 =============================
9 9
 
10  
-Currently, Django runs on Apache_ with `mod_python`_. mod_python is similar to
11  
-mod_perl -- it embeds Python within Apache and loads Python code into memory
12  
-when the server starts. Code stays in memory throughout the life of an Apache
13  
-process, which leads to significant performance gains over CGI.
14  
-
15  
-If you can't use mod_python for some reason, fear not: We're planning full WSGI_
16  
-support, which means Django will run on a variety of server platforms.
17  
-
18  
-For the time being, make sure you have Apache installed, with the mod_python
19  
-module activated.
  10
+If you just want to experiment with Django, skip this step. Django comes with
  11
+its own Web server for development purposes.
  12
+
  13
+If you want to use Django on a production site, use Apache with `mod_python`_.
  14
+mod_python is similar to mod_perl -- it embeds Python within Apache and loads
  15
+Python code into memory when the server starts. Code stays in memory throughout
  16
+the life of an Apache process, which leads to significant performance gains
  17
+over other server arrangements. Make sure you have Apache installed, with the
  18
+mod_python module activated.
  19
+
  20
+If you can't use mod_python for some reason, fear not: Django follows the WSGI_
  21
+spec, which allows it to run on a variety of server platforms. As people
  22
+experiment with different server platforms, we'll update this document to
  23
+give specific installation instructions for each platform.
20 24
 
21 25
 .. _Apache: http://httpd.apache.org/
22 26
 .. _mod_python: http://www.modpython.org/
81  docs/tutorial02.txt
@@ -25,78 +25,36 @@ interface for site administrators to edit content.
25 25
 The admin isn't necessarily intended to be used by site visitors; it's for site
26 26
 managers.
27 27
 
28  
-Expose the admin media files
  28
+Start the development server
29 29
 ============================
30 30
 
31  
-Django's admin is intended to be fully functional and good looking. For that
32  
-reason, Django ships with admin media files -- CSS, JavaScript and images --
33  
-that comprise the admin's design. To set up a Django admin instance, the first
34  
-thing to do is put those media files online somewhere.
  31
+To make things easy, Django comes with a pure-Python Web server that builds on
  32
+the BaseHTTPServer included in Python's standard library. Let's start the
  33
+server and explore the admin site. First, set the ``DJANGO_SETTINGS_MODULE``
  34
+environment variable to the location of your admin settings::
35 35
 
36  
-(Note: Although Django ships with a default design for its admin site, you can
37  
-change it however you'd like. The admin uses Django's own template system and
38  
-is powered -- surprise, surprise -- by Django itself, so it is completely
39  
-customizable.)
  36
+    export DJANGO_SETTINGS_MODULE=myproject.settings.admin
40 37
 
41  
-The files are in the ``media`` directory of the Django distribution. To
42  
-"activate" them, copy that directory under a Web document root somewhere, so
43  
-that you can access them via the Web.
  38
+Then, run this command to start the server::
44 39
 
45  
-Be careful not to put your Python source code under the Web document root. Just
46  
-do the media files.
  40
+    django-admin.py runserver
47 41
 
48  
-Then, tell Django where you put them, via ``ADMIN_MEDIA_PREFIX`` in the
49  
-``myproject.settings.admin`` settings file. Examples::
  42
+It'll start a Web server running locally -- on port 8000, by default. If you
  43
+want to change the server's port, pass it as a command-line argument::
50 44
 
51  
-    # You can leave off the domain if they're on the same domain as your admin
52  
-    # site will be.
53  
-    ADMIN_MEDIA_PREFIX = '/adminmedia/'
  45
+    django-admin.py runserver 8080
54 46
 
55  
-    # Otherwise, use the fully-qualified domain.
56  
-    ADMIN_MEDIA_PREFIX = 'http://www.foo.com/adminmedia/'
57  
-
58  
-Make sure to include a trailing slash.
59  
-
60  
-Hook into mod_python
61  
-====================
62  
-
63  
-Now let's take the opportunity to hook Django into Apache/mod_python. Edit your
64  
-``httpd.conf`` file and add this::
65  
-
66  
-    <Location "/admin/">
67  
-        SetHandler python-program
68  
-        PythonHandler django.core.handlers.modpython
69  
-        SetEnv DJANGO_SETTINGS_MODULE myproject.settings.admin
70  
-        PythonDebug On
71  
-    </Location>
72  
-
73  
-This tells Apache: "Use mod_python for any URL at or under '/admin/', using the
74  
-Django mod_python handler." It also passes the value of ``DJANGO_SETTINGS_MODULE``,
75  
-so mod_python knows which project to use. Note that we're passing the path to
76  
-the ``admin`` settings, not the ``main`` settings. That's because this is the
77  
-admin site, which has slightly different settings.
78  
-
79  
-Also, if you've manually altered your ``PYTHONPATH`` to put your project on it,
80  
-you'll need to tell mod_python::
81  
-
82  
-    PythonPath "['/path/to/project'] + sys.path"
83  
-
84  
-You can also add directives such as ``PythonAutoReload Off`` for performance.
85  
-See the `mod_python documentation`_ for a full list of options.
86  
-
87  
-When you've done that, restart Apache and go to /admin/ on your domain. You
88  
-should see the admin's login screen:
  47
+Now, open a Web browser and go to "/admin/" on your domain. You should see the
  48
+admin's login screen:
89 49
 
90 50
 .. image:: http://media.djangoproject.com/img/doc/tutorial/admin01.png
91 51
    :alt: Django admin login screen
92 52
 
93  
-.. _mod_python documentation: http://modpython.org/live/current/doc-html/directives.html
94  
-
95 53
 Create a user account
96 54
 =====================
97 55
 
98  
-We can't log in, though, because we haven't created an admin user account yet.
99  
-Drop into the Python interactive interpreter and type this::
  56
+You can't log in, though, because you haven't created an admin user account
  57
+yet. Drop into the Python interactive interpreter and type this::
100 58
 
101 59
     # The function django.models.auth.users.create_user() creates a new user
102 60
     # and returns the new auth.User object.
@@ -151,12 +109,9 @@ file and make the following change to add an ``admin`` attribute::
151 109
             ),
152 110
         )
153 111
 
154  
-Reload the Django admin index page. Note that you might have to restart Apache,
155  
-depending on your Apache settings. Because mod_python saves code in memory for
156  
-performance, Python code changes generally aren't reflected until Apache
157  
-restarts. One way around this is to set ``MaxRequestsPerChild 1`` in your
158  
-httpd.conf to force Apache to reload everything for each request. But don't do
159  
-that on a production server, or we'll revoke your Django privileges.
  112
+Restart your development Web server, and reload the Django admin page. You'll
  113
+have to restart the server each time you make a change to Python code -- but
  114
+we're working on changing that.
160 115
 
161 116
 Explore the free admin functionality
162 117
 ====================================

0 notes on commit b55b29c

Please sign in to comment.
Something went wrong with that request. Please try again.