forked from forktofu/fork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
executable file
·45 lines (29 loc) · 864 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
manage
~~~~~~
Set of some useful management commands.
"""
import subprocess
from flask.ext.script import Server, Shell, Manager
from app import app
from libs.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='john@doe.com', password='test')
# user.save()
manager.add_command('shell', Shell(make_context=lambda:{'app': app, 'db': db}))
server = Server(host="0.0.0.0", port=8777)
manager.add_command("runserver", server)
if __name__ == '__main__':
manager.run()