I've been reading through this thread http://community.webfaction.com/questions/4253/simple-virtualenv-usage-with-django and successfully set up a virtualenv, however, now I'm wondering how I should use this when my websites/applications are all set up through the GUI on the webfaction site.
I'm basically new to Django/python and am trying to use best practices. VirtualEnvs seems to be the best first step. Now that I have a virtualenv set up, don't I need to create a new Django project within this VE? If so, how do I wire that up to my domain through webfaction?
asked 28 Sep '12, 09:12
in your wsgi file you have to activate your virtualenv. That's it!
In your webapp project folder find the wsgi file
add this to your wsgi file, something like this
answered 21 Dec '12, 08:39
Since there is no way to create virtualenvs from the control panel you can't really 'wire' them up to the Control Panel.
I am sure there are many ways to do this. The way that I personally do it is to create one mod_wsgi3.x/python2.x application which provides you with an apache/wsgi instance only. Then I have a .virtualenvs directory in my home directory that I keep my projects in. Then I use virtualhosts in my httpd.conf to point to the projects.
The only thing you need to do after this is create the applications to point to your static media files for the individual projects. This should be done whichever way you go so that they are served by the front end nginx server which is faster for this type of media.
The benefit of this is that you only have one apache instance consuming your account memory and only one place that you need to go to make any changes.
I initially started with this as a guide. So maybe take a look at that to help get some ideas on how you would like to structure your setup.
answered 28 Sep '12, 12:01