Added a variation on the manage.py script which will pick up our local python virtualenv under env/. This is for use when invoking django management commands externally, for instance in email pipelines from /etc/aliases.
- Legacy-Id: 12625
This commit is contained in:
parent
c7a0d74481
commit
725ce16c4c
23
ietf/virtualenv-manage.py
Normal file
23
ietf/virtualenv-manage.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
# Virtualenv support
|
||||
virtualenv_activation = os.path.join(path, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
else:
|
||||
raise RuntimeError("Could not find the expected virtual python environment.")
|
||||
|
||||
if not path in sys.path:
|
||||
sys.path.insert(0, path)
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
execute_from_command_line(sys.argv)
|
Loading…
Reference in a new issue