2010-02-04 02:09:30 +03:00
|
|
|
#!/usr/bin/env python
|
2010-04-01 23:45:15 +04:00
|
|
|
import os
|
2010-08-12 04:15:29 +04:00
|
|
|
import sys
|
2015-09-26 18:27:31 +03:00
|
|
|
import traceback
|
2010-02-04 02:11:43 +03:00
|
|
|
|
2010-08-12 04:15:29 +04:00
|
|
|
# Now we can import from third-party libraries.
|
2011-08-24 02:39:57 +04:00
|
|
|
|
2017-11-15 10:33:39 +03:00
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'kitsune.settings')
|
2010-02-04 02:11:43 +03:00
|
|
|
|
2014-12-01 18:08:28 +03:00
|
|
|
# MONKEYPATCH! WOO HOO!
|
|
|
|
# Need this so we patch before running Django-specific commands which
|
2016-01-08 19:45:10 +03:00
|
|
|
# then result in a circular import.
|
2015-09-26 18:27:31 +03:00
|
|
|
try:
|
|
|
|
from kitsune.sumo.monkeypatch import patch # noqa
|
|
|
|
patch()
|
|
|
|
except ImportError:
|
2020-01-16 21:44:50 +03:00
|
|
|
print('OH NOES! There was an import error:')
|
|
|
|
print('')
|
|
|
|
print(''.join(traceback.format_exception(*sys.exc_info())))
|
2015-09-29 18:30:35 +03:00
|
|
|
if 'VIRTUAL_ENV' in os.environ:
|
2020-01-16 21:44:50 +03:00
|
|
|
print('Have you installed requirements? Are they up-to-date?')
|
2015-09-29 18:30:35 +03:00
|
|
|
else:
|
2020-01-16 21:44:50 +03:00
|
|
|
print('Have you activated your virtual environment?')
|
2015-09-26 18:27:31 +03:00
|
|
|
sys.exit(1)
|
2014-12-01 18:08:28 +03:00
|
|
|
|
2012-10-04 13:07:41 +04:00
|
|
|
# Import for side-effect: configures our logging handlers.
|
2015-04-10 05:42:59 +03:00
|
|
|
from kitsune import log_settings # noqa
|
2012-10-04 13:07:41 +04:00
|
|
|
|
2010-02-04 02:09:30 +03:00
|
|
|
if __name__ == "__main__":
|
2014-01-24 00:06:40 +04:00
|
|
|
from django.core.management import execute_from_command_line
|
|
|
|
execute_from_command_line(sys.argv)
|