Hosting and deploying django apps on Dreamhost
Posted by gabriel - 02/12/08 at 09:12:00 amAbout two years ago, I’ve signed up to Dreamhost. My goals were and still being to host my personal projects, websites and so on.
Once I am a Django web developer, one of my first actions were to create a django deployment setup, good and flexible enough. The time passed on and have been got new experiences, and the best desision, i think, was to create a new python sandbox, i mean, a customized python environment.
How is it possible ?
Simple! Just compiling python from scratch, with a fake root path (a prefix)
Anyway, the deployment process involves more variables, like setting both htaccess and dispatch files for each project, installing some basic modules such PIL and MySQL and so on…
So, i ever wanted to create a super duper script to do all that “dirty” work. And i did it last weekend!
I were working ia a freelance job and decided to create a subdomain to host test instance of them.
A new sandbox, ready to make my tests to create the super script.
So folks, i present you the brand new: django_dreamhost.sh
It’s composed by 4 files:
- django_dreamhost.sh itself
- djangify.template – a template with will become a script to setup new projects (htaccess and dipatch files, for instance)
- htaccess.template – a template that will become the .htaccess of each project of yours
- dispatch.template – will become the dispatch.fcgi for your projects as well
“But do i need to download all them ?”, of course NO!
You just download the main script, and he will do all do hard work!
“I wanna contribute, modify or do anything with that script, can I ?”, of course yes! All parts of the script are GPLv2 +
You can also always get the development version through git repository:
git clone http://git.nacaolivre.org/django_dreamhost
Don’t want to get all code, just the script ?
Download it at: http://gnu.gabrielfalcao.com/django_dreamhost/django_dreamhost.sh
What does that script do ?
He will do the following steps:
- Download Python, Django, Python-setuptools, Python-fastcgi to a directory called downloads
- Extract all
- Create a local root at $HOME/.myroot and the subdirs etc and usr
- Set the new bin path to you global path through bashrc and bash_profile
- Compile and install python to the new prefix: $HOME/.myroot/usr
- Install Django, rename django-admin.py to django-admin
- Setup your bash-completion to support django scripts
- Install the python modules above with the new python
- Install PIL and MYSQL modules through easy_install (setuptools)
- Download the template scripts to $HOME/projects/script_templates
- Replace the custom tags in templates
- Move the djangify.template to the new bin PATH: $HOME/usr/bin and give it execution permission
I thinks it’s all.
I currently use Fabric to help on deployment, and i have a quite smart basic setup for it to work with this dreamhost django environment, but it will be approached in the next blog post
See you, folks!
11 Comentários »
Feed RSS dos comentários deste post TrackBack URI
Deixe um comentário
Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds.
Valid XHTML and CSS.
[...] post original sobre isso está no meu blog pessoal, mas vou replicar alguns pontos [...]
Pingback por Nação Livre » Blog Archive » Django no dreamhost (super script) — 2 de dezembro de 2008 #
[...] Continued here: GBlog *blog = g_object_ref(self); » Hosting and deploying django … [...]
Pingback por » GBlog *blog = g_object_ref(self); » Hosting and deploying django … Web Hosting 2009 Review: Learn Which Host is Best For You With Web Expert Ratings — 3 de dezembro de 2008 #
Thanks for post. Nice to see such good ideas.
Comentário por Olechka-persik — 10 de dezembro de 2008 #
[rkirmizi@laptux][21:11:03][~/tmp]git clone http://git.nacaolivre.org/django_dreamhost
Initialized empty Git repository in /home/rkirmizi/tmp/django_dreamhost/.git/
fatal: http://git.nacaolivre.org/django_dreamhost/info/refs not found: did you run git update-server-info on the server?
Comentário por Recep KIRMIZI — 12 de dezembro de 2008 #
excellent work,
Comentário por mozey — 31 de dezembro de 2008 #
haha ^^ nice, is there a section to follow the RSS feed
Comentário por Malca — 1 de março de 2009 #
Ainda não testei, mas era exatamente oq eu procurava. Parabéns pela iniciativa.
Comentário por Polo — 2 de março de 2009 #
Awesome! thanks
I’ve had problems with PIL and flup tho.
The process for installing PIL should be changed, as it should not be installed as an egg, since Django doesn’t support that. This is the correct method:
http://weblog.fredalger.net/2009/04/problems-installing-easyinstall-pil.html
For flup, a simple “easy_install flup” worked fine.
Comentário por LKRaider — 1 de julho de 2009 #
I absolutely love your script! Great work! I still had to run easy_install flup.
Comentário por Thadeus — 8 de julho de 2009 #
Cara, eu usei seu script há um tempo atrás mas acabei não desenvolvendo nada com Django na minha conta DreamHost desde então. Agora que eles estão suportando oficialmente o Django, eu resolvi tirar um pouco a poeira do código e desenvolver algo.
Tentei fazer o procedimento descrito na wiki deles, mas não consegui porque a versão do Python que estou usando é a 2.5.2 (instalada pelo seu script), e eles dizem pra “reverter para a versão default” (que, ao que me parece é a 2.4.4). Como eu faço pra ter novamente a versão 2.4 como default?
Abraço
Comentário por Jader Rubini — 26 de dezembro de 2009 #
Esquece, cara. Simplesmente fiz um link simbólico do
/usr/bin/pythonpara o~/.myroot/usr/bin/python.O problema – aparentemente – era que, por algum motivo, o Python 2.5 instalado pelo seu script não tinha instalado o MySQLdb.
Comentário por Jader Rubini — 26 de dezembro de 2009 #