| 1 | = Django on Windows with Abyss (FastCGI) = |
| 2 | |
| 3 | == Background == |
| 4 | Developing with Django in Windows and want a more production-like environment? This is a solution I've got working now that seems really nice and lightweight. |
| 5 | |
| 6 | == Prerequisites: == |
| 7 | This assumes you've got your Python and Django environment up and working and prepared it for FastCGI as detailed here: http://www.djangoproject.com/documentation/fastcgi/ |
| 8 | Download and install version 2.5 or higher of the Abyss web server from http://www.aprelium.com/abyssws/ (free for personal use). |
| 9 | |
| 10 | The text below is borrowed and modifed from the Rails configuration details at: http://www.aprelium.com/abyssws/ror.html |
| 11 | Here it assumes you've got a mysite project under c:\django and want to serve your other content from c:\django\public_html. |
| 12 | |
| 13 | ''This was tested using Python 2.5 and Django development version (svn trunk).'' |
| 14 | |
| 15 | == Configuration: == |
| 16 | '''Start Django in FastCGI mode''' |
| 17 | {{{ |
| 18 | c:\> cd django\mysite |
| 19 | c:\django\mysite> python manage.py runfcgi method=threaded host=127.0.0.1 port=3033 |
| 20 | }}} |
| 21 | |
| 22 | * Create an empty file called dispatch.fcgi in public_html. This seems to be required for the URLRewrite of Abyss to kick in. (There might be some other prettier solution to this though.) |
| 23 | |
| 24 | |
| 25 | |
| 26 | '''Run Abyss Web Server and open its console''' |
| 27 | |
| 28 | * Select the host that will serve the Django application: |
| 29 | * If you have Abyss Web Server X2, you can create a new one for that purpose. |
| 30 | * If you have Abyss Web Server X1, you'll have to use the unique available host. |
| 31 | |
| 32 | * Press the Configure button associated with the host you have selected (in the Hosts table). |
| 33 | |
| 34 | * Select General. |
| 35 | * Enter in the Documents Path field: |
| 36 | {{{ |
| 37 | C:\django\public_html |
| 38 | }}} |
| 39 | * Press OK. |
| 40 | |
| 41 | * Select Scripting Parameters and press Add in the Scripting Parameters table. |
| 42 | * Set Interface to FastCGI (Remote - TCP/IP sockets). |
| 43 | * Enter 127.0.0.1 in Remote Server IP Address and set Port field to 3033. |
| 44 | * Make sure the Type is Standard. |
| 45 | * Enter in the Arguments field: |
| 46 | * Press Add in the Extensions table, enter fcgi in the Extension field, press OK, then press OK a second time. |
| 47 | * Select URL Rewriting, press Add in the URL Rewriting Rules table. |
| 48 | * Enter in the Virtual Path Regular Expression field: |
| 49 | {{{ |
| 50 | ^(.*)$ |
| 51 | }}} |
| 52 | * Press Add in the Conditions table. |
| 53 | * Set Variable to REQUEST_FILENAME, set Operator to Is not a file, and press OK. |
| 54 | * Press Add one more time in the Conditions table. |
| 55 | * Set Variable to REQUEST_FILENAME, set Operator to Is not a directory, and press OK. |
| 56 | * Set If this rule matches to Perform an internal redirection. |
| 57 | * Set Redirect to to: |
| 58 | /dispatch.fcgi?$1 |
| 59 | * Press OK. |
| 60 | |
| 61 | Apply the modifications |
| 62 | * Press Restart to restart the server. |
| 63 | |
| 64 | Test the application and enjoy. |