Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 62 lines (47 sloc) 1.592 kb
80ee5a9 BUST A MOVE
Jeff Balogh authored
1 #!/usr/bin/env python
80fdffd add a vendor lib
Jeff Balogh authored
2 import os
3 import site
4 import sys
5
6 ROOT = os.path.dirname(os.path.abspath(__file__))
7 path = lambda *a: os.path.join(ROOT,*a)
8
9
10 # Adjust the python path and put local packages in front.
11 prev_sys_path = list(sys.path)
12
13 site.addsitedir(path('apps'))
14 site.addsitedir(path('lib'))
8bde790 @fwenzel Added local vendor library to facilitate upgrades of playdoh-lib. Iss…
fwenzel authored
15
16 # Global (upstream) vendor library
80fdffd add a vendor lib
Jeff Balogh authored
17 site.addsitedir(path('vendor'))
18 site.addsitedir(path('vendor/lib/python'))
19
8bde790 @fwenzel Added local vendor library to facilitate upgrades of playdoh-lib. Iss…
fwenzel authored
20 # Local (project) vendor library
21 site.addsitedir(path('vendor'))
22 site.addsitedir(path('vendor/lib/python'))
23
24
80fdffd add a vendor lib
Jeff Balogh authored
25 # Move the new items to the front of sys.path. (via virtualenv)
26 new_sys_path = []
27 for item in list(sys.path):
28 if item not in prev_sys_path:
29 new_sys_path.append(item)
30 sys.path.remove(item)
31 sys.path[:0] = new_sys_path
32
a1930af try to find settings_local instead of settings.py
Jeff Balogh authored
33 from django.core.management import execute_manager, setup_environ
34
80ee5a9 BUST A MOVE
Jeff Balogh authored
35 try:
a1930af try to find settings_local instead of settings.py
Jeff Balogh authored
36 import settings_local as settings
80ee5a9 BUST A MOVE
Jeff Balogh authored
37 except ImportError:
a1930af try to find settings_local instead of settings.py
Jeff Balogh authored
38 try:
39 import settings
40 except ImportError:
41 import sys
42 sys.stderr.write(
43 "Error: Tried importing 'settings_local.py' and 'settings.py' "
44 "but neither could be found (or they're throwing an ImportError)."
45 " Please come back and try again later.")
46 raise
80ee5a9 BUST A MOVE
Jeff Balogh authored
47
5527311 @fwenzel Added schematic.
fwenzel authored
48 # If we want to use django settings anywhere, we need to set up the required
49 # environment variables.
50 setup_environ(settings)
51
52 # Configure Celery
477c59d adding celery
Jeff Balogh authored
53 import djcelery
54 djcelery.setup_loader()
55
88755f7 @fwenzel Added nuggets (for safe django forms). Closes #18.
fwenzel authored
56 # Monkey-patch django forms to avoid having to use Jinja2's |safe everywhere.
57 import safe_django_forms
58 safe_django_forms.monkeypatch()
59
80ee5a9 BUST A MOVE
Jeff Balogh authored
60 if __name__ == "__main__":
61 execute_manager(settings)
Something went wrong with that request. Please try again.