Updated scripts to enable deploying prod server
This commit is contained in:
parent
d80b07d43d
commit
3eea1d946a
8
app.py
8
app.py
@ -8,9 +8,6 @@ from controllers.web.endpoints import blueprint
|
|||||||
Database manager...
|
Database manager...
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
print(__package__)
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
# Set app secret key to sign session cookies
|
# Set app secret key to sign session cookies
|
||||||
@ -24,8 +21,7 @@ def main():
|
|||||||
|
|
||||||
# Register a blueprint
|
# Register a blueprint
|
||||||
app.register_blueprint(blueprint)
|
app.register_blueprint(blueprint)
|
||||||
app.run(debug=True, host="0.0.0.0")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
app.run(debug=True, host="0.0.0.0", port=8080)
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ services:
|
|||||||
- FILESTORE=static/assets/img/products/
|
- FILESTORE=static/assets/img/products/
|
||||||
tty: true
|
tty: true
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "8080:8080"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
@ -1,2 +1,24 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
pytest --disable-warnings && python ./scripts/create_database.py && python ./app.py
|
pytest --disable-warnings
|
||||||
|
python ./scripts/create_database.py
|
||||||
|
|
||||||
|
EXPECTED_VALUE="test"
|
||||||
|
|
||||||
|
if [ -z "$ENVIRON" ]; then
|
||||||
|
echo "ENVIRON is not set."
|
||||||
|
else
|
||||||
|
echo "ENVIRON is set to: $ENVIRON"
|
||||||
|
|
||||||
|
# Trim leading and trailing whitespaces
|
||||||
|
ACTUAL_VALUE=$(echo "$ENVIRON" | tr -d '[:space:]')
|
||||||
|
|
||||||
|
if [ "$ACTUAL_VALUE" = "$EXPECTED_VALUE" ]; then
|
||||||
|
echo "Launching DEV Server"
|
||||||
|
python ./app.py
|
||||||
|
else
|
||||||
|
echo "Launching PROD Server"
|
||||||
|
waitress-serve --host 0.0.0.0 app:app
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user