-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
37 lines (31 loc) · 1.01 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
from flask.ext.script import Manager
from flask_frozen import Freezer
from app import app
manager = Manager(app)
@manager.command
def freeze(*args):
import shutil
from flask import url_for
freezer = Freezer(app)
freezer.freeze()
# Copy the boilerplate files (favicon, robots.txt) to the freezer
for filename in app.config.get('BOILER_FILES'):
shutil.copy(app.config.get('BOILER_FULL_URL') + filename, app.config.get('FREEZER_DESTINATION'))
@manager.command
def deploy(*args, **kwargs):
from modules.deployutils import BucketConn
initial_kwargs = {
'access_secret': app.config.get('AWS_SECRET_ACCESS_KEY'),
'access_key': app.config.get('AWS_ACCESS_KEY_ID'),
'bucket_name': app.config.get('S3_BUCKET_NAME'),
'working_directory': app.config.get('FREEZER_DESTINATION'),
'interactive': True
}
bucket = BucketConn(**initial_kwargs)
bucket.rebuild_from_working_directory()
@manager.command
def frozenserver():
freezer = Freezer(app)
freezer.run(debug=True)
if __name__ == "__main__":
manager.run()