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.
- Run Eclipse and go to Help → Software Updates → Find and Install….
- Select Search for new features to install and hit Next.
- Select "Callisto Discovery Site", click Finish, and wait.
- 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).
- Click Next, accept licenses, click Next, and Finish to install all components.
- 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.
- 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.
- 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.
- Now I have an installation, which can be administered just like the system Python.
- Install all necessary packages using Python Eggs, or whatever method you like. They will be installed locally.
- Install flup — it allows more tweaking options than fcgi.py.
Now I have everything installed but how to run it?
- Run python (should be an alias to your local python2.4) and enter following lines:
- import sys
- print sys.path
- Save an output of print somewhere.
- Create django.fcgi (see below).
- Instead of YOUR_PATH include the saved output of print done in the previous step.
- Include correct settings module name.
- Make it executable using chmod 755 django.py.
1 2 3 4 5 6 7 8 9 10 11
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.