Added clear_db command to manage.py

This commit is contained in:
Francesco Siddi 2015-04-08 18:09:04 +02:00
parent e453050404
commit 7f1b36f134

View File

@ -21,6 +21,23 @@ def runserver():
debug=DEBUG) debug=DEBUG)
@manager.command
def clear_db():
"""Wipes the database
"""
from pymongo import MongoClient
from pymongo.errors import DuplicateKeyError
from bson import ObjectId
from datetime import datetime
client = MongoClient()
db = client.eve
db.drop_collection('nodes')
db.drop_collection('node_types')
db.drop_collection('tokens')
db.drop_collection('users')
@manager.command @manager.command
def populate_db_test(): def populate_db_test():
"""Populate the db with sample data """Populate the db with sample data