Merge branch 'master' into wtforms
Conflicts: app/main.py
This commit is contained in:
commit
1998fcb7d8
|
@ -4,7 +4,13 @@
|
||||||
`docker build --tag=$(basename $PWD) .`
|
`docker build --tag=$(basename $PWD) .`
|
||||||
|
|
||||||
## run in development
|
## run in development
|
||||||
`docker run --name rollerverbrauch -ti -v `pwd`/app:/app -p 5000:5000 rollerverbrauch`
|
|
||||||
|
Include the development version of the code as volume, so the app gets
|
||||||
|
reloaded automatically. The sqlite file will be stored in *tmp* so it
|
||||||
|
can be inspected with tools like *sqlite3*. The switch *DEBUG* enables
|
||||||
|
debugging during development.
|
||||||
|
|
||||||
|
`docker run --name rollerverbrauch -ti -v `pwd`/app:/app -v /tmp/pitstops/:/data -e DEBUG=True -p 5000:5000 rollerverbrauch`
|
||||||
|
|
||||||
## run in production
|
## run in production
|
||||||
`docker run --name pitstops -d -v /data/pitstops/:/data -p 80:5000 rollerverbrauch`
|
`docker run --name pitstops -d -v /data/pitstops/:/data -p 80:5000 rollerverbrauch`
|
|
@ -11,13 +11,13 @@ from functools import wraps
|
||||||
from flask_wtf import Form
|
from flask_wtf import Form
|
||||||
from wtforms import DateField, IntegerField, DecimalField
|
from wtforms import DateField, IntegerField, DecimalField
|
||||||
from wtforms.validators import DataRequired, ValidationError
|
from wtforms.validators import DataRequired, ValidationError
|
||||||
|
import os
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
DATABASE = '/data/rollerverbrauch.db'
|
DATABASE = '/data/rollerverbrauch.db'
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'+DATABASE
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'+DATABASE
|
||||||
sqldb = SQLAlchemy(app)
|
sqldb = SQLAlchemy(app)
|
||||||
|
|
||||||
DEBUG = True
|
|
||||||
SECRET_KEY = 'development key'
|
SECRET_KEY = 'development key'
|
||||||
app.config.from_object(__name__)
|
app.config.from_object(__name__)
|
||||||
|
|
||||||
|
@ -221,4 +221,5 @@ def prepare_pit_stops(pss):
|
||||||
return pitstops
|
return pitstops
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True, host='0.0.0.0')
|
DEBUG = 'DEBUG' in os.environ and os.environ['DEBUG'] != 'False'
|
||||||
|
app.run(debug=DEBUG, host='0.0.0.0')
|
||||||
|
|
Loading…
Reference in New Issue