Posts tagged ‘dreamhost’ 0.2

I updated today… I mean yesterday.

I made one painful decision: users need to create an account before they can add trails. Another option would have been to create a system where changes need to be moderated. The main reason I decided to do user accounts instead is because most web applications will actually need user accounts at some point and I wanted to learn to deal with those sooner rather than later. I looked at AuthKit, but the documentation regarding the Pylons integration seems to be a little misleading or incomplete based on the comments on the Pylons wiki. That is what I would probably choose for a production system, still. But given how easy it is to bolt user management into standalone Pylons I decided to do that first (and learn a bit more about Pylons in the process). All the hard work went into making the login forms, and the part that I was originally most concerned about – tracking the logged in status – was trivial with Pylons session object. Add a little decorator to ensure users are logged in for certain controller actions and you are good to go.

Most visible in the new version is of course much better UI, although some work still remains. It also seems to work reasonably well in other browsers, although I noticed a small gap in IE7 under the menu buttons and the banner lower border on which they are supposed to rest. The add trail page is perhaps the most polished, with WYSIWYG HTML editors and stars you can click to rate the trail.

After deploying on Dreamhost I noticed one regression. The FastCGI script shows in the URLs even though I put in the fix for broken routes. This worked in the 0.1 version so I am not sure what is going on yet. (Update: Found a typo that had slipped in, all good now. Need more tests…)

Pylons on Dreamhost

So finally, after a few false starts, I have a Pylons-based application running on Dreamhost.

My experience was that the only way to get a working Python installation was to use Virtual Python, as described in the Python on Dreamhost wiki page. The Python 2.5.1 that I compiled myself was crashing left and right, and rather than try and figure that one out I used Virtual Python with python2.4.

Another piece of the puzzle is that you need to use FastCGI on Dreamhost, because Dreamhost seems to kill long running processes like Python. Also, you need to go with the “obsolete” rather than Flup, because Flup seems to be too slow for Dreamhost. The FastCGI script does not need to be named dispatch.fcgi – I have used other scripts with .fcgi suffix successfully, all chmod 755. Using differently named FastCGI script has the benefit that you can easily kill just the FastCGI for a specific application of yours. This post provided a usable FastCGI script for Pylons-based application. The Pylons documentation includes other samples, like this, but I have not yet deployed a real application so just noting that for reference.

Python on Dreamhost

In my previous post I described how I kind of got TurboGears running on Dreamhost. The problem was that it died after a few seconds. Crawling the wiki and other sources, it seems like there is a process that will kill the Python process, unless it happens to be named dispatch.fcgi. So I scrapped that plan (rm -fr and decided to start again.

Looking at the Python FastCGI page I first easy_installed Flup (as described at the end of the page), created .htaccess file to redirected everything to dispatch.fcgi like instructed on that page, and made the dispatch.fcgi like in the Flup section of that page, chmod 755 dispatch.fcgi, waited a little, and tried browsing to my site. After a long time, it finally returned server error. Not good. But since there is so little code now, it is easy to debug. I put just a little exception handler around the whole script, and made it write to a log file any exceptions. And sure enough, there was error! Now we were getting somewhere. The error was about being unable to import flup. Hmm, so it looks like my Python environment wasn’t working through FastCGI as I expected.

So I did an alternative approach by using (wget into Then I edited the dispatch.fcgi to match the dispatch.fcgi like in the beginning of the Python FastCGI wiki page on Dreamhost. Waited a while. Browsed to my site. Waiting, waiting, waiting…. IT WORKED!

So, I think I’ll either do my own Python 2.5 installation or virtual Python setup. Both approaches are described on the Python on Dreamhost wiki page.

I think I am also going to forget TurboGears and move to Pylons, since it seems Pylons is the future.

Update: See my Pylons on Dreamhost post for the final details.

TurboGears on Dreamhost

I have been reading comparisons about TurboGears and Django and the other Python web frameworks. There doesn’t seem to be a clear winner in the documents I’ve read, but there are quite a few comparisons I have yet to read. But my initial impression is that with Django you can get an application up quickly, while TG would give you more power to tweak things. And that TG reuses 3rd party packages, while Django project creates similar packages for itself. This latter point made me start my experimentation with TG, although that commentary was from 2006 so maybe things have changed.

I read the documentation on how to set up TurboGears on Dreamhost, and it all seems dated and overly complicated. I plan on updating those instructions, but here’s what I did to get the Wiki20 sample running:

mkdir -p ~/bin
mkdir -p ~/python2.4/site-packages

cat >>.bash_profile
alias python=python2.4
export PYTHONPATH=/home/<username>/python2.4/site-packages
export PATH=/home/<username>/bin

source .bash_profile

python –install-dir=/home/<username>/python2.4/site-packages –script-dir=/home/<username>/bin

tg-admin quickstart

mv Wiki-20/* .

# edit .htaccess
# edit dev.cfg


#at this point I run into the following error:
You are required to install SQLObject but appear not to have done so.
Please run your projects or run `easy_install SQLObject`.
#end error

easy_install –install-dir=/home/<username>/python2.4/site-packages –script-dir=/home/<username>/bin “SQLObject>=0.7.1dev-r1860,<=0.7.99”


#at this point it complained the port was taken, so I experimented until it found an unused port
#browsed over to which showed the app running
# but alas! it died immediately after serving that one page:
2008-01-31 21:14:00,909 cherrypy.msg INFO ENGINE: SystemExit raised: shutting down autoreloader
2008-01-31 21:14:00,910 cherrypy.msg INFO HTTP: HTTP Server shut down
2008-01-31 21:14:00,914 cherrypy.msg INFO ENGINE: CherryPy shut down

Update: TG seems to actually go down soon after start, regardless of whether it serves any pages or not.

Update 2: See my second attempt at just using Python on Dreamhost, followed by the final bits for working Pylons on Dreamhost.

Webmastering for the Finnish Language School of Silicon Valley

I volunteered as webmaster for the Finnish Language School of Silicon Valley non-profit. First I needed to renew the domain, which was just about to expire. I then took a look at the current hosting provider, They don’t offer a lot, but the hosting is free without banner ads on your site, and you also get an email address. The downside is that they require you to register the domain through them, and this is at least 2-3 times more expensive than domain registrations elsewhere. All in all, not too bad but I thought I could do better.

Since I host at Dreamhost myself and I am reasonably happy with them, I asked if they had discounts for non-profits. Turns out they offer free hosting for non-profits, and I believe this also includes free domain registration. So off I went, faxed the needed documents and finally got email informing me the account was set up.

At first I set up various email addresses (unlimited number available, basically) to manage the site, and created the old contact address as well. I then set up a Subversion repository which automatically pushes changes to the live website, and sends out a commit message to me as well.

Compared to the old setup, Dreamhost offers secure shell access via ssh, unlimited accounts, more disk and bandwith, backups, and overall more tools to manage the site. And with the Subversion setup, any change can be rolled back, rather than relying on daily backups from Dreamhost. Not to mention that the commits list alerts me to any changes (via Subversion at least).

The major issue at this point is finding some free cross-platform WYSIWYG HTML tool(s) that can edit the simple HTML files via WebDAV folders. All major OSes can now mount WebDAV folders, but I was bummed to note that Kompozer does not support WebDAV (it does not even seem to help when a WebDAV folder is mounted). It is also somewhat a hassle to deal with SSL without paying for a dedicated IP and certificate, because what Dreamhost offers for free is created by them; expect warnings about unknown CA and mismatched domains. Better than nothing, I guess.

Now that the infrastructure is in place, including DNS updates, I can concentrate on updating the site content, and eventually migrate the domain registrar to Dreamhost as well.

Update: The non-profit hosting plan actually seems to include some free IPs as well as a free certificate, so I’ll need to take a look at enabling that.

Update2: I found out Seamonkey Composer supports WebDAV upload, so I am all set with open source, cross-platform WYSIWYG HTML editor that I can recommend to my users.