Hello, reader!

My name is Eugene Lazutkin.

I'm a software developer based in the Dallas-Fort Worth metroplex. Lazutkin.com is my professional blog, which contains short writeups and presentations regarding modern web applications. All articles here are written by myself, unless stated otherwise.

Setting up tools 2

This is the 2nd part of Setting up tools on Windows — notes mostly for myself. (No, I don’t run Django with MSSQL under IronPython. Yet.)

In this installment I add more stuff to Eclipse, and set up my apps under FastCGI on Linux-based shared host (I use DreamHost).


This section was updated on 9/30/2006.

I already set it up with PyDev and Subclipse. Now I want to add HTML/CSS editing. And I want to do AJAX.

  1. Run Eclipse and go to Help → Software Updates → Find and Install….
  2. Select Search for new features to install and hit Next.
  3. Select "Callisto Discovery Site", click Finish, and wait.
  4. Select WST (it’s under "Callisto DiscoverySite" ⇒ "Web and J2EE Development"), click Select Required to make sure you selected all components (it will add GEF and some other components).
  5. Click Next, accept licenses, click Next, and Finish to install all components.

Eclipse Web Standard Tools take care of everything but their JavaScript support is not what I consider "good". I need to install one more plug in, which will help me with Dojo-based Ajax: JSEclipse. This plug-in used to be not free for commercial development. Now, when InterACT was bought by Adobe, it appears to be free. The latest version includes a product key and a user name (see readme.txt in the downloaded archive for instructions).

  1. Download it here: http://www.interaktonline.com/Products/Eclipse/JSEclipse/Try-Download/. Their site requires registration but so far I was not spammed from them.
  2. Unzip the archive in your Eclipse directory and start Eclipse.

Sometimes it requires to be manually enabled as described in this JSEclipse KB article.

Now I am set with my web site editors.


These instructions should be good for any FastCGI-based hosting. I use DreamHost, which allows to run Django using FastCGI. They have Python 2.3 and Python 2.4 installed, but not a lot of packages. DreamHost’s Wiki has very good instructions on how to use Django on DreamHost. But I want more than that.

  1. First order of business is to make my own Python using Ian Bicking’s virtual-python.py using PEAK’s instructions. Don’t forget to use python2.4 to run it, otherwise you’ll end up with Python 2.3.
  2. Now I have an installation, which can be administered just like the system Python.
  3. Install all necessary packages using Python Eggs, or whatever method you like. They will be installed locally.
  4. Install flup — it allows more tweaking options than fcgi.py.

Now I have everything installed but how to run it?

  1. Run python (should be an alias to your local python2.4) and enter following lines:
    1. import sys
    2. print sys.path
  2. Save an output of print somewhere.
  3. Create django.fcgi (see below).
  4. Instead of YOUR_PATH include the saved output of print done in the previous step.
  5. Include correct settings module name.
  6. Make it executable using chmod 755 django.py.
#!/usr/bin/env python2.4
if __name__ == '__main__':
    import sys, os
    # your path goes here:
    sys.path = YOUR_PATH
    # your settings module goes here:
    os.environ['DJANGO_SETTINGS_MODULE'] = 'your.settings'
    from flup.server.fcgi import WSGIServer
    from django.core.handlers.wsgi import WSGIHandler
    server = WSGIServer(WSGIHandler(), maxThreads=50)

This file will run the multithreaded version of flup. After consultations with the flup’s creator Allan Saddi I decided to restrict number of threads to 50 — the default was something like MAX_INT, which could overload a server in some cases. I tried to set some well knows FastCGI parameters as well but it looks like mod_fastcgi ignores them. Sigh.

Apache’s .htaccess file should be written according to the DreamHost’s Wiki article.

Now I have working Django on FastCGI under Apache, and I can add more Python packages to my system at will.