Version 3 (modified by 17 years ago) ( diff ) | ,
---|
Django on Windows with Abyss (FastCGI)
Background
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.
Prerequisites:
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/ Download and install version 2.5 or higher of the Abyss web server from http://www.aprelium.com/abyssws/ (free for personal use).
The text below is borrowed and modifed from the Rails configuration details at: http://www.aprelium.com/abyssws/ror.html. Here it assumes you've got a mysite project under c:\django and want to serve your other content from c:\django\public_html.
This was tested using Python 2.5 and Django development version (svn trunk).
Configuration:
Start Django in FastCGI mode
c:\> cd django\mysite c:\django\mysite> python manage.py runfcgi method=threaded host=127.0.0.1 port=3033
- 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.)
Run Abyss Web Server and open its console
- Select the host that will serve the Django application:
- If you have Abyss Web Server X2, you can create a new one for that purpose.
- If you have Abyss Web Server X1, you'll have to use the unique available host.
- Press the Configure button associated with the host you have selected (in the Hosts table).
- Select General.
- Enter in the Documents Path field:
C:\django\public_html
- Press OK.
- Enter in the Documents Path field:
- Select Scripting Parameters and press Add in the Scripting Parameters table.
- Set Interface to FastCGI (Remote - TCP/IP sockets).
- Enter 127.0.0.1 in Remote Server IP Address and set Port field to 3033.
- Make sure the Type is Standard.
- Press Add in the Extensions table, enter fcgi in the Extension field, press OK, then press OK a second time.
- Select URL Rewriting, press Add in the URL Rewriting Rules table.
- Enter in the Virtual Path Regular Expression field:
^(.*)$
- Press Add in the Conditions table.
- Set Variable to REQUEST_FILENAME, set Operator to Is not a file, and press OK.
- Press Add one more time in the Conditions table.
- Set Variable to REQUEST_FILENAME, set Operator to Is not a directory, and press OK.
- Set If this rule matches to Perform an internal redirection.
- Set Redirect to to: /dispatch.fcgi?$1
- Press OK.
- Enter in the Virtual Path Regular Expression field:
Apply the modifications
- Press Restart to restart the server.
Test the application and enjoy.