On Fri, Mar 26, 2010 at 5:45 PM, Phlip <phlip2...@gmail.com> wrote:
> os.environ['DJANGO_SETTINGS_MODULE'] = 'dev2_settings'  #  TODO  look
> up which one

My local copy actually has the following code in it:

********************
import os
import re
import sys

m = re.search(r'^([a-zA-Z0-9_]+)-shell$', os.path.basename(sys.argv[0]))
mn = 'avclub'
if m:
    g = m.group(1)
    if g in ['avclub', 'onion']:
        mn = g
    del g
del m
os.environ['DJANGO_SETTINGS_MODULE'] = 'afns.sites.local_%s.settings'
% (mn,)  # "afns" is the Onion's Python package
********************

This way I can just make symlinks named "avclub-shell" and
"onion-shell" to the original executable, and it will use the
respective settings files automatically without having to maintain
separate copies.  You could also get fancier with optparse, I suppose.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to