My Django application on Dreamhost is running fine since I did one simple trick. There is one problematic moment, though. Namely, new Python code to upload and application restart.
I usually develop my applications locally and submit the new code to a repository. To make the changes live, I check out the new code from the repository to my Dreamhost account and issue a command:
If my application still doesn’t restart, I push a little harder.
If I do just one restart, it goes fine. The problems start, when I do it few times in a row. In such a case, the old version of the application is already killed (killall’ed) but the new application isn’t alive yet and I get some 500 and incomplete headers error for a while. The application eventually starts up and works fine.
When the code is ready, one check-out and one restart is enough, but it’s sometimes necessary to make small changes on-site and frequently restart the application.
Frequent restarts are solved very nicely by the development server. It monitors all the Python files and restarts itself on every change detected. It would be perfect to run an development server on Dreamhost to make the necessary changes and then restart the application just once.
It’s easy to run the development server itself.
The problem is, how to display what it serves, in a local browser?
EDIT: As Ryan Berg suggested, it’s enough to tell the development server to listen on an external interface:
./manage.py runserver http://www.mydomain.com:8001
The Dreamhost servers aren’t firewalled, which means that you can open your development site by pointing your web browser to “http://www.mydomain.com:8001”.
Please note: if you host more domains on Dreamhost, your development site will be available under all the domains you’re hosting, for example firstdomain.com:8001, seconddomain.com:8001, and so forth.
You can make frequent small changes and numerous development server restarts, and once You’re satisfied, do just one restart of the application served via FCGI.