Created
August 30, 2023 20:08
-
-
Save chadwcarlson/f4697706dda4cf4db34b384da84b2987 to your computer and use it in GitHub Desktop.
Flask (cookiecutter-flask) local on Platform.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Cleanup | |
rm -rf env | |
rm -rf migrations | |
rm -rf Platformify_Cookies/static | |
rm -rf node_modules | |
platform tunnel:close -y | |
# Setup a virtual environment | |
python3 -m venv env | |
source env/bin/activate | |
# Install dependencies | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
npm install | |
# setup local | |
platform tunnel:open -y | |
export PLATFORM_RELATIONSHIPS="$(platform tunnel:info --encode)" | |
# Mock vars | |
export PORT=8888 | |
export PLATFORM_PROJECT_ENTROPY=oooososupersecretshhh | |
export PLATFORM_ENVIRONMENT_TYPE=production | |
source .environment | |
# static files | |
npm run build | |
# Migrations | |
flask db init | |
flask db migrate | |
flask db upgrade | |
# run the server | |
# (DEV) | |
# flask run -p $PORT | |
# (PROD) | |
gunicorn -w 4 'app:app' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PORT
Using gunicorn +
SOCKET
(requiresunix
)source env/bin/activate
pip install unix
pip freeze