Procfile and changes for deployment
This commit is contained in:
parent
a9d145576b
commit
0f1536fabe
3 changed files with 13 additions and 3 deletions
1
Procfile
Normal file
1
Procfile
Normal file
|
@ -0,0 +1 @@
|
|||
web: python run.py
|
8
run.py
8
run.py
|
@ -1,4 +1,8 @@
|
|||
from smash import app
|
||||
import os
|
||||
from smash import app, conf
|
||||
|
||||
if __name__=='__main__':
|
||||
app.run()
|
||||
if 'HEROKU' in conf.config and conf.config['HEROKU']==1:
|
||||
app.run(host= '0.0.0.0', port=os.environ['PORT'])
|
||||
else:
|
||||
app.run(debug=True)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
from flask import Flask
|
||||
from . import config, database, log, models
|
||||
|
||||
|
@ -5,7 +6,11 @@ from . import config, database, log, models
|
|||
log.configure_logging()
|
||||
app = Flask(__name__)
|
||||
conf = config.Config('config.json')
|
||||
conf.save()
|
||||
|
||||
# This flag tells the program it's deployed on heroku
|
||||
if 'HEROKU' in os.environ:
|
||||
conf.add(('HEROKU', 1))
|
||||
|
||||
db = database.Database(conf.config["DBNAME"])
|
||||
models.init_models(db)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue