Changeset 5488 for django/branches/per-object-permissions/docs/fastcgi.txt
- Timestamp:
- 06/17/07 17:18:54 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/per-object-permissions/docs/fastcgi.txt
r3810 r5488 1 ============================== 2 How to use Django with FastCGI 3 ============================== 1 =========================================== 2 How to use Django with FastCGI, SCGI or AJP 3 =========================================== 4 4 5 5 Although the `current preferred setup`_ for running Django is Apache_ with 6 `mod_python`_, many people use shared hosting, on which FastCGI is the only 7 viable option. In some setups, FastCGI also allows better security -- and, 8 possibly, better performance -- than mod_python. 6 `mod_python`_, many people use shared hosting, on which protocols such as 7 FastCGI, SCGI or AJP are the only viable options. In some setups, these protocols 8 also allow better security -- and, possibly, better performance -- than mod_python. 9 10 .. admonition:: Note 11 12 This document primarily focuses on FastCGI. Other protocols, such as SCGI 13 and AJP, are also supported, through the ``flup`` Python package. See the 14 "Protocols" section below for specifics about SCGI and AJP. 9 15 10 16 Essentially, FastCGI is an efficient way of letting an external application … … 18 24 persistent process. 19 25 20 .. _current preferred setup: http://www.djangoproject.com/documentation/modpython/26 .. _current preferred setup: ../modpython/ 21 27 .. _Apache: http://httpd.apache.org/ 22 28 .. _mod_python: http://www.modpython.org/ … … 75 81 list of all the available options. 76 82 77 You'll need to specify either a ``socket`` or both ``host`` and ``port``. Then,78 when you set up your Web server, you'll just need to point it at the host/port83 You'll need to specify either a ``socket``, ``protocol`` or both ``host`` and ``port``. 84 Then, when you set up your Web server, you'll just need to point it at the host/port 79 85 or socket you specified when starting the FastCGI server. 86 87 Protocols 88 --------- 89 90 Django supports all the protocols that flup_ does, namely fastcgi_, `SCGI`_ and 91 `AJP1.3`_ (the Apache JServ Protocol, version 1.3). Select your preferred 92 protocol by using the ``protocol=<protocol_name>`` option with 93 ``./manage.py runfcgi`` -- where ``<protocol_name>`` may be one of: ``fcgi`` 94 (the default), ``scgi`` or ``ajp``. For example:: 95 96 ./manage.py runfcgi --protocol=scgi 97 98 .. _flup: http://www.saddi.com/software/flup/ 99 .. _fastcgi: http://www.fastcgi.com/ 100 .. _SCGI: http://python.ca/scgi/protocol.txt 101 .. _AJP1.3: http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html 80 102 81 103 Examples … … 182 204 Alias /media /home/user/python/django/contrib/admin/media 183 205 RewriteEngine On 184 RewriteRule ^/(media.*)$ /$1 [QSA,L ]206 RewriteRule ^/(media.*)$ /$1 [QSA,L,PT] 185 207 RewriteCond %{REQUEST_FILENAME} !-f 186 208 RewriteRule ^/(.*)$ /mysite.fcgi/$1 [QSA,L] … … 275 297 Then, create a small script that tells Apache how to spawn your FastCGI 276 298 program. Create a file ``mysite.fcgi`` and place it in your Web directory, and 277 be sure to make it executable ::299 be sure to make it executable:: 278 300 279 301 #!/usr/bin/python … … 305 327 306 328 touch mysite.fcgi 329 330 Serving admin media files 331 ========================= 332 333 Regardless of the server and configuration you eventually decide to use, you will 334 also need to give some thought to how to serve the admin media files. The 335 advice given in the modpython_ documentation is also applicable in the setups 336 detailed above. 337 338 .. _modpython: ../modpython/#serving-the-admin-files 339
