Merge branch 'dev' into rrt/dev

This commit is contained in:
Aaron Louie 2020-05-23 15:12:49 -04:00
commit 1e826bbd21
5 changed files with 19 additions and 3 deletions

View File

@ -22,7 +22,6 @@ COPY . /protocol-builder-mock/
ENV FLASK_APP=/protocol-builder-mock/app.py
# run webserver by default
CMD ["pipenv", "run", "flask", "db", "upgrade"]
CMD ["pipenv", "run", "python", "/protocol-builder-mock/run.py"]
# expose ports

2
app.py
View File

@ -107,7 +107,7 @@ def index():
# display results
studies = db.session.query(Study).order_by(Study.DATE_MODIFIED.desc()).all()
table = StudyTable(studies)
return render_template('index.html', table=table)
return render_template('index.html', table=table, BASE_HREF=app.config['BASE_HREF'])
@app.route('/new_study', methods=['GET', 'POST'])

View File

@ -8,6 +8,7 @@ FLASK_PORT = environ.get('PORT0') or environ.get('FLASK_PORT', default="5001")
CORS_ENABLED = False
DEVELOPMENT = environ.get('DEVELOPMENT', default="true") == "true"
TESTING = environ.get('TESTING', default="false") == "true"
BASE_HREF = environ.get('BASE_HREF', default="/")
DB_HOST = environ.get('DB_HOST', default="localhost")
DB_PORT = environ.get('DB_PORT', default="5432")

View File

@ -2,5 +2,20 @@
# run migrations
export FLASK_APP=./app.py
pipenv run flask db upgrade
if [ "$DOWNGRADE_DB" = "true" ]; then
echo 'Downgrading database...'
pipenv run flask db downgrade
fi
if [ "$UPGRADE_DB" = "true" ]; then
echo 'Upgrading database...'
pipenv run flask db upgrade
fi
if [ "$RESET_DB" = "true" ]; then
echo 'Resetting database...'
pipenv run flask load-example-data
fi
pipenv run python ./run.py

View File

@ -2,6 +2,7 @@
<html lang="en">
<head>
<title>Protocol Builder Mock</title>
<base href="{{ BASE_HREF }}">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://use.typekit.net/kwp6dli.css">
{% assets 'app_scss' %}