Running Emacs with Django project

I don't want to spend my time on repeating tasks. When starting Emacs, I always had to initialize DJANGO_SETTINGS_MODULE and PYTHONPATH for a project (so code evaluation and Rope works).

Here is script to automate this task:

$ cat runemacs.py 
#!/usr/bin/env python
import sys
import os

SITE_ROOT = os.path.dirname( os.path.abspath(sys.argv[0]) )
PROJECT_ROOT = os.path.split( SITE_ROOT )[0]

os.putenv('DJANGO_SETTINGS_MODULE','djyp.settings')
os.putenv('PYTHONPATH',PROJECT_ROOT)
os.putenv('LANG','en_US.UTF-8')
os.system('emacs')

Comments: 1

#1 alex commented, on 20 May 2008:

Btw, tried to make it via 'exec' so emacs replaces current process, but it seems I lack the experience - instead of expected result I got "segmentation fault". So, kept 'system'.


Post a comment

Guests can\'t leave comments.