Reloading Django applications without root access

23 views
Skip to first unread message

Vincent Foley

unread,
Apr 27, 2009, 4:32:01 PM4/27/09
to modwsgi
Hello,

I am a web programmer for a small firm in Canada and we use Django for
all our work. We currently use mod_python to deploy our web sites,
but I have a big problem with this solution: it forces me to have root
access in order to restart Apache when we make even the littlest
changes to a Python file. Our current host is gracious enough to have
given us the root password of his servers, but I am uneasy about that
for two reason:

1) I could screw things up really badly.
2) If I need to use another host, I'm hosed; most hosting providers in
our area only provide FTP access. No shell and certainly no root
access.

I read that mod_wsgi 2 supports reloading a WSGI process when a script
file is touched. This is very interesting to me, as it would allow me
to simply re-upload the script file to reload the changes that were
made in the application. However, I also read that to be able to use
the process WSGIReloadMechanism, I need to use the daemon mode of
mod_wsgi, which can only be configured in the main apache
configuration file, which would require root access.

Using only .htaccess files, is it possible to reload the entire Django
application? If not, do you have any advice on other techniques or
tricks that I could use to force the application to reload?

Thank you very much for your time,

Vincent Foley

Graham Dumpleton

unread,
Apr 28, 2009, 1:25:21 AM4/28/09
to mod...@googlegroups.com
2009/4/28 Vincent Foley <vfo...@gmail.com>:

You only need root access to setup daemon mode and define delegation
of your virtual host to that daemon process once at setup time. After
that you have means to trigger restarts without needing to be root.

See:

http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

There are a couple of blog posts of mine about reloading on:

http://blog.dscpl.com.au

These are:

http://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django.html
http://blog.dscpl.com.au/2009/02/source-code-reloading-with-modwsgi-on.html

As mentioned before, you do at least need administrators to set you up
with daemon process first and have your WSGI application correctly
delegated to it.

Graham

Vincent Foley

unread,
Apr 28, 2009, 11:14:11 AM4/28/09
to modwsgi
But that step needs to be done for every site that we deploy, doesn't
it? Our motivation for wanting to be "rootless" is to be able to more
freely choose shared hosting providers who won't necessarily give us
the same flexibility our current provider does. ("Why not stick with
this nice provider," you might ask? Just a precaution.)

I understand that their execution models are different, but I'd love
if I could emulate the PHP experience of dropping files with a FTP
client in a directory on the shared host and have the site up and
running.

Vincent

On Apr 28, 1:25 am, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
>  http://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django...
>  http://blog.dscpl.com.au/2009/02/source-code-reloading-with-modwsgi-o...

gert

unread,
Apr 28, 2009, 6:08:05 PM4/28/09
to modwsgi
You are looking at it the wrong way, all is nice and well until you
realize your PHP host provider did not include for example a image
library (=screwed). mod_wsgi provide this flexibility to customize you
own interpreter without screwing with others. Think of it this way, a
new client means new web space, new web space means getting 'root'
access anyway to create the user and the space in the first place.
Apache can handle hot config files pretty well, its the reason why
apache is so popular because admins can screw around allot without
turning it off. mod_wsgi allows you to code a admin web site with
hosting tasks that will create new user space for you what would be
impossible with PHP.

Graham Dumpleton

unread,
Apr 28, 2009, 8:04:20 PM4/28/09
to mod...@googlegroups.com
2009/4/29 Vincent Foley <vfo...@gmail.com>:
>
> But that step needs to be done for every site that we deploy, doesn't
> it?  Our motivation for wanting to be "rootless" is to be able to more
> freely choose shared hosting providers who won't necessarily give us
> the same flexibility our current provider does. ("Why not stick with
> this nice provider," you might ask?  Just a precaution.)
>
> I understand that their execution models are different, but I'd love
> if I could emulate the PHP experience of dropping files with a FTP
> client in a directory on the shared host and have the site up and
> running.

Yes, understand where you are coming from. At the moment mod_wsgi uses
static configuration and doesn't support either dynamic or external
configuration options as provided by fastcgi systems. I have explained
this limitation and what might be done about it in blog posts
previously. See for example:

http://blog.dscpl.com.au/2009/03/future-roadmap-for-modwsgi.html
http://blog.dscpl.com.au/2009/04/improving-commercial-pythonwsgi-hosting.html

There are hacky workarounds, but not anything that is going to be
satisfactory for commodity web hosting.

Thus, for commodity web hosting, only options at this point is fastcgi
and perhaps Phusion Passenger if web hosting company even understands
that it has some support for WSGI.

That or you use a web hosting company like WebFaction that gives you
your own Apache instance, but still within a shared system.

Graham
Reply all
Reply to author
Forward
0 new messages