virtualenv and fabric fun (for django)

I enjoy Fabric and virtualenv with django.

What I don't like is this error:
[code]
  File "manage.py", line 2, in ?

from django.core.management import execute_manager
ImportError: No module named django.core.management
[/code]

What I did... was fix it. I tried the `source virtualenv/path/activate && python manage.py blah` CLI stuff. Didn't work.

So pulling out my hack the CLI (linux admin) side of my brain I devised two ways of fixing it.

1. Modify your manage.py she-bang (#!) line to point to your python interpreter of choice (usually the virtualenv one).
2. cd into your app directory (which has the manage.py script) and prepend the absolute path to your python interpreter.

Both were tested and both worked perfectly. I am using option #2, since it will remain in my fabfile and anytime I deploy my virtualenv, I won't have to remember to modify the manage.py file.

If anyone has a more stable or 'sure fire' way to void the above error, drop a line in the comments.

Almost unrelated side note: Webfaction is an amazing django host. High priority tickets and support in general are answered in a timely manner. Great service and support.

Comments

Popular posts from this blog

Python SUDS with Windows Authentication (SOAP)

Text Sherlock the OpenGrok alternative (Source Code Search Engine)

How to remove, update, or replace the WKWebView inputAccessoryView