Changeset 8015 for django/trunk/docs
- Timestamp:
- 07/21/08 02:57:10 (5 months ago)
- Files:
-
- django/trunk/docs/fastcgi.txt (modified) (3 diffs)
- django/trunk/docs/modpython.txt (modified) (3 diffs)
- django/trunk/docs/settings.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/docs/fastcgi.txt
r7294 r8015 80 80 list of all the available options. 81 81 82 You'll need to specify either a ``socket``, ``protocol`` or both ``host`` and ``port``.83 Then, when you set up your Web server, you'll just need to point it at the host/port84 or socket you specified when starting the FastCGI server.82 You'll need to specify either a ``socket``, ``protocol`` or both ``host`` and 83 ``port``. Then, when you set up your Web server, you'll just need to point it 84 at the host/port or socket you specified when starting the FastCGI server. 85 85 86 86 Protocols … … 209 209 210 210 .. _mod_rewrite: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html 211 212 Django will automatically use the pre-rewrite version of the URL when 213 constructing URLs with the ``{% url %}`` template tag (and similar methods). 211 214 212 215 lighttpd setup … … 337 340 .. _modpython: ../modpython/#serving-the-admin-files 338 341 342 Forcing the URL prefix to a particular value 343 ============================================ 344 345 Because many of these fastcgi-based solutions require rewriting the URL at 346 some point inside the webserver, the path information that Django sees may not 347 resemble the original URL that was passed in. This is a problem if the Django 348 application is being served from under a particular prefix and you want your 349 URLs from the ``{% url %}`` tag to look like the prefix, rather than the 350 rewritten version, which might contain, for example, ``mysite.fcgi``. 351 352 Django makes a good attempt to work out what the real script name prefix 353 should be. In particular, if the webserver sets the ``SCRIPT_URL`` (specific 354 to Apache's mod_rewrite), or ``REDIRECT_URL`` (set by a few servers, including 355 Apache + mod_rewrite in some situations), Django will work out the original 356 prefix automatically. 357 358 In the cases where Django cannot work out the prefix correctly and where you 359 wan the original value to be used in URLs, you can set the 360 ``FORCE_SCRIPT_NAME`` setting in your main ``settings`` file. This sets the 361 script name uniformly for every URL served via that settings file. Thus you'll 362 need to use different settings files is you want different sets of URLs to 363 have different script names in this case, but that is a rare situation. 364 365 As an example of how to use it, if your Django configuration is serving all of 366 the URLs under ``'/'`` and you wanted to use this setting, you would set 367 ``FORCE_SCRIPT_NAME = ''`` in your settings file. 368 django/trunk/docs/modpython.txt
r7294 r8015 36 36 PythonHandler django.core.handlers.modpython 37 37 SetEnv DJANGO_SETTINGS_MODULE mysite.settings 38 PythonOption django.root /mysite 38 39 PythonDebug On 39 40 </Location> … … 45 46 Django mod_python handler." It passes the value of ``DJANGO_SETTINGS_MODULE`` 46 47 so mod_python knows which settings to use. 48 49 **New in Django development version:** Because mod_python does not know we are 50 serving this site from underneath the ``/mysite/`` prefix, this value needs to 51 be passed through to the mod_python handler in Django, via the ``PythonOption 52 django.root ...`` line. The value set on that line (the last item) should 53 match the string given in the ``<Location ...>`` directive. The effect of this 54 is that Django will automatically strip the ``/mysite`` string from the front 55 of any URLs before matching them against your ``URLConf`` patterns. If you 56 later move your site to live under ``/mysite2``, you will not have to change 57 anything except the ``django.root`` option in the config file. 58 59 When using ``django.root`` you should make sure that what's left, after the 60 prefix has been removed, begins with a slash. Your URLConf patterns that are 61 expecting an initial slash will then work correctly. In the above example, 62 since we want to send things like ``/mysite/admin/`` to ``/admin/``, we need 63 to remove the string ``/mysite`` from the beginning, so that is the 64 ``django.root`` value. It would be an error to use ``/mysite/`` (with a 65 trailing slash) in this case. 47 66 48 67 Note that we're using the ``<Location>`` directive, not the ``<Directory>`` … … 60 79 PythonHandler django.core.handlers.modpython 61 80 SetEnv DJANGO_SETTINGS_MODULE mysite.settings 81 PythonOption django.root /mysite 62 82 PythonDebug On 63 83 **PythonPath "['/path/to/project'] + sys.path"** django/trunk/docs/settings.txt
r7965 r8015 578 578 579 579 .. _Testing Django Applications: ../testing/ 580 581 FORCE_SCRIPT_NAME 582 ------------------ 583 584 Default: ``None`` 585 586 If not ``None``, this will be used as the value of the ``SCRIPT_NAME`` 587 environment variable in any HTTP request. This setting can be used to override 588 the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version 589 of the preferred value or not supplied at all. 580 590 581 591 IGNORABLE_404_ENDS
