-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
31 lines (24 loc) · 1.04 KB
/
manage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
# from pytz import all_timezones
from flask.ext.script import Manager, Command, prompt_bool, prompt, prompt_pass, prompt_choices
from habitat import app
from celery.task.control import discard_all as celery_discard_all
class Setup(Command):
def run(self):
local_config_exists = os.path.isfile('local_config.py')
if local_config_exists:
if not prompt_bool("Overwrite existing settings?"):
return
admin_username = prompt('Choose an admin user name')
admin_pass = prompt_pass('Choose an admin password')
email_address = prompt('What email address do you want to send alerts to?')
time_zone = prompt('What time zone are we in?', default='Europe/London')
database_name = prompt_pass('Choose a database name', default='habitat')
class ResetQueues(Command):
def run(self):
celery_discard_all()
manager = Manager(app)
manager.add_command('reset-queues', ResetQueues())
manager.add_command('setup', Setup())
if __name__ == "__main__":
manager.run()