-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathmanage.py
49 lines (37 loc) · 1.11 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.assets import ManageAssets
from livereload import Server
from gather import create_app
from gather.extensions import db
app = create_app()
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command("db", MigrateCommand)
manager.add_command("assets", ManageAssets())
@manager.command
def create_all():
db.create_all()
@manager.command
def clear_cache():
from gather.extensions import cache
with app.app_context():
cache.clear()
@manager.command
def clean_junk_users():
from gather.account.models import Account
with app.app_context():
Account.clean_junk_users()
@manager.command
def livereload():
db.create_all()
app.debug = True
server = Server(app)
server.watch("gather/*.py")
server.watch("gather/templates/*.html")
server.watch("gather/assets/stylesheets/*.sass")
server.watch("gather/assets/stylesheets/*/*.sass")
server.watch("gather/assets/javascripts/*.coffee")
server.serve(port=8000)
if __name__ == "__main__":
manager.run()