Webfaction.com. Webfaction is easy to set up, and if you …">

Flaviu's Blog - Read'n'Code

Lessons Learned From a Django Deployment

This website was built with Django 1.2.4, and is hosted by Webfaction.com. Webfaction is easy to set up, and if you are not a deployment expert (i.e. you are not Jacob Kaplan-Moss) that’s what you should use.

I followed James Bennet’s book some of the way. It has a few errors in the code and it is a little dated, but it helped me as a beginner. You can find it .

Use django-taggit

is kind of dead, and Alex Gaynor (who is probably the most productive programmer who can’t buy alcohol legally in the US) has made a better and more extensible alternative: django-taggit. It actually has a couple of extensions and it’s on Eric Holscher’s Read the Docs here.

Pay attention to which Python Version you are using

Webfaction (like just about every computer) has multiple versions of python installed, and one (usually not the one you want) will be used when you type “python” To use the one you want, say 2.6, you either type “python2.6” every time, or you add this line to your ~/.bash_profile (create it if it’s not there):

alias python=python2.6

Some use ~/.profile or ~/.bashrc instead. Read more about the difference (or lack thereof) here. Also, make sure that you use the right version of the python packages you install. You may think you are installing something with pip and then you can’t import it because you should have installed it with pip for that version of python: pip-2.6

render_to_response() does not have the Request Context by default

I had a simple app that had mostly generic views. Naturally, I used MEDIA_URL for all my links to media. But on some pages, no media showed up. A few mental hours later, I figured out that generic views include the Request Context by default, whereas render_to_response does not. So, I had to write:

return render_to_response('template.html', { 'dictionary' : dictionary }, context_instance = RequestContext(request))

That’s it for now. Overall, deployment was a good experience.


Fork Flaviu on GitHub