-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanage.py
28 lines (21 loc) · 872 Bytes
/
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
from flask.ext.script import Manager, prompt_bool
from beckton import app
from mongoengine import connect
from celery.task.control import discard_all as celery_discard_all
manager = Manager(app)
@manager.command
def reset():
"Delete all data, reset everything"
if prompt_bool("Are you absolutely certain you want to delete all this things?"):
#reset mongo
# mongo_settings = app.config['MONGODB_SETTINGS']
# db = connect(mongo_settings['DB'])
db = connect(app.config['MONGODB_DB'], host=app.config['MONGODB_HOST'], port=app.config['MONGODB_PORT'])
db.drop_database(app.config['MONGODB_DB'])
print("Deleted all collections from database ...")
#reset celery
celery_discard_all()
print("Deleted all pending tasks from the message que ...")
print("Done")
if __name__ == "__main__":
manager.run()