-
Notifications
You must be signed in to change notification settings - Fork 30
/
manage.py
executable file
·47 lines (30 loc) · 866 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
# coding: utf-8
"""
manage
~~~~~~
Set of some useful management commands.
:copyright: (c) 2015 by Roman Zaiev.
:license: BSD, see LICENSE for more details.
"""
import subprocess
from flask_script import Shell, Manager
from app import app
from base import User
from ext import db
manager = Manager(app)
@manager.command
def clean_pyc():
"""Removes all *.pyc files from the project folder"""
clean_command = "find . -name *.pyc -delete".split()
subprocess.call(clean_command)
@manager.command
def init_data():
"""Fish data for project"""
db.drop_all()
db.create_all()
user = User(username='John Doe', email='[email protected]', password='test')
user.save()
manager.add_command('shell', Shell(make_context=lambda:{'app': app, 'db': db}))
if __name__ == '__main__':
manager.run()