| 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/port |
|---|
| 84 | | 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. |
|---|
| | 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 | want 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 if 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 | |
|---|