WebFaction
Community site: login 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 30 Jul '12, 21:00

ccuilla
1139
accept rate: 0%


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

permanent link

answered 30 Jul '12, 22:45

johns
5.4k312
accept rate: 23%

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.

(31 Jul '12, 09:20) ccuilla

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.

(31 Jul '12, 14:31) seanf

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

(31 Jul '12, 19:25) ccuilla

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"

permanent link

answered 30 Jul '12, 23:14

ryans ♦♦
5.0k93360
accept rate: 43%

This did not provide a different result.

(31 Jul '12, 09:17) ccuilla

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).

permanent link

answered 30 Jul '12, 23:16

ryans ♦♦
5.0k93360
accept rate: 43%

edited 30 Jul '12, 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.

(31 Jul '12, 09:17) ccuilla
Your answer
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

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×15
×2

question asked: 30 Jul '12, 21:00

question was seen: 2,475 times

last updated: 31 Jul '12, 19:25

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM