login community faq

Maybe there's a better way to do this, but...

I'd like to be able to have a "releases" directory in which I upload different version of my Django app (e.g., "v1.0", "v1.1", "v2.0", etc.) and a symbolic link called "current" that points to whichever version I want/need to run.

Then $HOME/webapps/<appname> contains a symbolic link to $HOME/releases/current.

What this buys me is the ability to:

  1. Install a new version while another (older) version is running, then...
  2. Quickly switch over to the newer version by switching the symbolic link and restarting the app
  3. Rollback quickly if necessary

As I say, there might be a cleaner, simpler, more straightforward way to do all of this...and I'm open to suggestions.

(I stole this idea from the way Capistrano did things.)

However...the thing that is creating a problem right now is that running manage.py (i.e., python2.7 manage.py) in a Django project in $HOME/release/v1.0/ directory complains that:

Traceback (most recent call last): File "manage.py", line 2, in <module> from django.core.management import execute_manager ImportError: No module named django.core.management

I'm sure this is just a Python path issue. But I can't figure out where/how the Python path is getting set.

Is this all being handled in /home/<username>/webapps/<app_name>/lib/python2.7/site.py?

Any hints on this?

Thanks.

asked Jul 30 '12 at 21:00

ccuilla's gravatar image

ccuilla
111


It does sound like a path issue, see our documentation on python path for more info.

answered Jul 30 '12 at 22:45

johns's gravatar image

johns ♦♦
340427

Thanks for the pointer to the documentation. I've reviewed that document. It looks like it might be out of date though. For example:

$HOME/webapps/app/lib/pythonX.Y is added to the Python search path when the current working directory is $HOME/webapps/app/ or below, where app is the name of an application as it appears in the control panel.

Does not appear to be true (at least from what I can tell). Though, interestingly, I suspect that my problem has something to do with exactly what the above says it is doing.

And, the reference to:

/usr/lib/pythonX.Y/sitecustomize.py contains the complete implementation of the Python search path modifications.

Doesn't appear to exist.

(Jul 31 '12 at 09:20) ccuilla ccuilla's gravatar image

For Python 2.7, the customization implementation is at /usr/local/lib/python2.7/sitecustomize.py

I've just checked your account, and your /home/xxxx/webapps/xxxx/lib/python2.7 directory is definitely present for python2.7 when the cwd is at or below your xxxxx app directory.

(Jul 31 '12 at 14:31) seanf ♦♦ seanf's gravatar image

You're right. I must've been in the wrong directory by mistake. Thanks.

(Jul 31 '12 at 19:25) ccuilla ccuilla's gravatar image

It's also possible that you're running manage.py with with wrong Python version - for example, using "python manage.py" instead of "python2.7 manage.py"

answered Jul 30 '12 at 23:14

ryans's gravatar image

ryans ♦♦
28411420

This did not provide a different result.

(Jul 31 '12 at 09:17) ccuilla ccuilla's gravatar image

As for a suggestion of a clean way to do all of this, I think using git with a Django application is by far the best way to do this - and setting it up only takes about 5 minutes (feel free to open a support ticket if you get stuck).

answered Jul 30 '12 at 23:16

ryans's gravatar image

ryans ♦♦
28411420

edited Jul 30 '12 at 23:17

Thanks for the suggestion on the git setup. I will look into that approach. Maybe that's the better way of doing what I need to do.

(Jul 31 '12 at 09:17) ccuilla ccuilla's gravatar image
Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×643
×12
×2

Asked: Jul 30 '12 at 21:00

Seen: 375 times

Last updated: Jul 31 '12 at 19:25

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited