Web.py? anyone?

software development

#1

Raise your hand if you’ve ever successfully installed a web.py-based app here at dreamhost!

I have a very compact, simple application that I’m trying to deploy. Thus far, deployment has taken twice as long as development.

core.fcgi
web.py
templates/*.html
site-packages/Cheetah

The contents of my .htaccess file follow (between the lines):

AddHandler fastcgi-script .fcgi

SetHandler fastcgi-script

I can’t seem to escape one Internal Server Error after another. The latest:

FastCGI: comm with (dynamic) server . . .
FastCGI: incomplete headers (0 bytes) received from server . . .

If anyone has any suggestions, I’d very much appreciate the assistance.

Cheers,

Keith


#2

Hi,

I’ve been running a couple sites on dreamhost with web.py (http://www.colr.org is one of them)

A couple things I learned:

  • You don’t have to put Cheetah under any “site-packages” directory. If you have just one site, it’s simpler to have the Cheetah directory in the same directory as your app (at the same level as the “web” directory if you’re using web.py 0.2 or greater). Same deal with flup.

  • You don’t need any “AddHandler” directive in .htaccess. If fastcgi is enabled for your account, any file with a .fcgi extension will be treated run as fastcgi.

  • It’s a very good idea to test your app in non-fastcgi mode first. This means renaming the file from .fcgi to .py and pointing your browser at it like this: http://www.mysite.com/my_app.py/ (note the end slash).

  • When you switch from .fcgi to .py and back, don’t forget to comment/uncomment the “web.wsgi.runwsgi =…” line in your app.

  • Lastly, if you want the app to run upon a GET request to the empty directory/, don’t use DirectoryIndex in .htaccess. Try this instead:

RewriteEngine On
RewriteCond %{REQUEST_URI} !.css$
RewriteCond %{REQUEST_URI} !.html$
RewriteCond %{REQUEST_URI} !.gif$
RewriteCond %{REQUEST_URI} !.png$
RewriteCond %{REQUEST_URI} !.js$
RewriteRule ^(.*) /my_app.fcgi/$1 [L]

Hope this helps!

  • Lloyd