Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 100 lines (78 sloc) 2.667 kb
2c501a43 »
2009-10-20 THIS IS ZAMBONI
1 #!/usr/bin/env python
edd5b43b » Jeff Balogh
2011-07-29 protect us from wayward localizers
2 import logging
7b8dd859 » clouserw
2010-01-29 Site footer (bug 542666), r=jbalogh. Stile some TODO: language dropdo…
3 import os
4af097c6 »
2009-10-21 creating apps and lib directories
4 import site
d9346472 » davedash
2010-03-12 Fixed manage.py to work with cProfile (/via ianb)
5 import sys
4e5e812d » Jeff Balogh
2011-05-03 disable deprecation warnings in prod (bug 654562)
6 import warnings
4af097c6 »
2009-10-21 creating apps and lib directories
7
a153f11d »
2009-10-21 try importing from local_settings first
8
7b8dd859 » clouserw
2010-01-29 Site footer (bug 542666), r=jbalogh. Stile some TODO: language dropdo…
9 ROOT = os.path.dirname(os.path.abspath(__file__))
d9346472 » davedash
2010-03-12 Fixed manage.py to work with cProfile (/via ianb)
10 if os.path.splitext(os.path.basename(__file__))[0] == 'cProfile':
11 if os.environ.get('ZAMBONI_PATH'):
12 ROOT = os.environ['ZAMBONI_PATH']
13 else:
14 print 'When using cProfile you must set $ZAMBONI_PATH'
15 sys.exit(2)
16
7b8dd859 » clouserw
2010-01-29 Site footer (bug 542666), r=jbalogh. Stile some TODO: language dropdo…
17 path = lambda *a: os.path.join(ROOT, *a)
18
45f6ec4d »
2010-05-20 move all our sys.path goodies to the front
19 prev_sys_path = list(sys.path)
20
7b8dd859 » clouserw
2010-01-29 Site footer (bug 542666), r=jbalogh. Stile some TODO: language dropdo…
21 site.addsitedir(path('apps'))
22 site.addsitedir(path('lib'))
9f725dde »
2010-05-18 switching to a vendor repo (bug 562220)
23 site.addsitedir(path('vendor'))
59ce2dbd » Jeff Balogh
2010-09-17 addsitedir vendor/lib/python
24 site.addsitedir(path('vendor/lib/python'))
9f725dde »
2010-05-18 switching to a vendor repo (bug 562220)
25
45f6ec4d »
2010-05-20 move all our sys.path goodies to the front
26 # Move the new items to the front of sys.path. (via virtualenv)
27 new_sys_path = []
28 for item in list(sys.path):
29 if item not in prev_sys_path:
30 new_sys_path.append(item)
31 sys.path.remove(item)
32 sys.path[:0] = new_sys_path
33
9f725dde »
2010-05-18 switching to a vendor repo (bug 562220)
34 # No third-party imports until we've added all our sitedirs!
6e38edf1 » andymckay
2011-07-14 move to django-mozilla-product-details and add update into the deploy…
35 from django.core.management import (call_command, execute_manager,
36 setup_environ)
4af097c6 »
2009-10-21 creating apps and lib directories
37
2c501a43 »
2009-10-20 THIS IS ZAMBONI
38 try:
f5588504 »
2010-01-08 switching local_settings to settings_local
39 import settings_local as settings
2c501a43 »
2009-10-20 THIS IS ZAMBONI
40 except ImportError:
a153f11d »
2009-10-21 try importing from local_settings first
41 try:
42 import settings
43 except ImportError:
44 import sys
45 sys.stderr.write(
f5588504 »
2010-01-08 switching local_settings to settings_local
46 "Error: Tried importing 'settings_local.py' and 'settings.py' "
a153f11d »
2009-10-21 try importing from local_settings first
47 "but neither could be found (or they're throwing an ImportError)."
48 " Please come back and try again later.")
d9346472 » davedash
2010-03-12 Fixed manage.py to work with cProfile (/via ianb)
49 raise
a153f11d »
2009-10-21 try importing from local_settings first
50
4e5e812d » Jeff Balogh
2011-05-03 disable deprecation warnings in prod (bug 654562)
51 if not settings.DEBUG:
52 warnings.simplefilter('ignore')
53
b2c42219 »
2009-12-15 now we can all be lumberjacks
54 # The first thing execute_manager does is call `setup_environ`. Logging config
55 # needs to access settings, so we'll setup the environ early.
56 setup_environ(settings)
57
69b03605 » Jeff Balogh
2011-02-01 apply the safe-form monkeypatch (bug 627449)
58 # Hardcore monkeypatching action.
59 import safe_django_forms
60 safe_django_forms.monkeypatch()
61
93c61de9 » Jeff Balogh
2011-04-20 protect the login page with @anonymous_csrf
62 import session_csrf
63 session_csrf.monkeypatch()
64
edd5b43b » Jeff Balogh
2011-07-29 protect us from wayward localizers
65 # Fix jinja's Markup class to not crash when localizers give us bad format
66 # strings.
67 from jinja2 import Markup
68 mod = Markup.__mod__
69 trans_log = logging.getLogger('z.trans')
70
71
72 def new(self, arg):
73 try:
74 return mod(self, arg)
75 except Exception:
76 trans_log.error(unicode(self))
77 return ''
78
79 Markup.__mod__ = new
80
b2c42219 »
2009-12-15 now we can all be lumberjacks
81 # Import for side-effect: configures our logging handlers.
609ec546 » davedash
2010-02-23 Improved the pylint settings.
82 # pylint: disable-msg=W0611
b2c42219 »
2009-12-15 now we can all be lumberjacks
83 import log_settings
84
7439c02b » Jeff Balogh
2010-08-16 hopping up to celery 2.0.3
85 import djcelery
86 djcelery.setup_loader()
87
aa23d1aa » Jeff Balogh
2010-09-24 use safe_signals instead of async_signals. Threads suck.
88 import safe_signals
89 safe_signals.start_the_machine()
cfcf6c8b » Jeff Balogh
2010-09-23 trying async again, disabled during testing
90
4d4764c0 »
2009-10-23 add the right packages independent of the cwd
91
2c501a43 »
2009-10-20 THIS IS ZAMBONI
92 if __name__ == "__main__":
6e38edf1 » andymckay
2011-07-14 move to django-mozilla-product-details and add update into the deploy…
93 # If product details aren't present, get them.
94 from product_details import product_details
95 if not product_details.last_update:
96 print 'Product details missing, downloading...'
97 call_command('update_product_details')
98 product_details.__init__() # reload the product details
99
2c501a43 »
2009-10-20 THIS IS ZAMBONI
100 execute_manager(settings)
Something went wrong with that request. Please try again.