UPDATE: The app is no longer hosted, as my free trial for Google Cloud reached its end.
Note: The following steps were carried out on an Ubuntu machine.
Type this into your terminal
git clone https://github.com/adelicia-js/htmx-contact-app.git
cd htmx-contact-app
code .
python3-m venv venv
source venv/bin/activate
(Remember to do the activation step every time)
pip install -r requirements.txt
flask run
Navigate to http://127.0.0.1:5000/contacts :D
pip install gunicorn
cat > gunicorn_config.py
workers = 4
bind = '0.0.0.0:8000'
accesslog = '-'
errorlog = '-'
Ctrl + C to exit editor mode
gunicorn -c gunicorn_config.py app:app
Navigate to http://0.0.0.0:8000 :D
Relevant references:
Read through these docs before anything:
-
https://cloud.google.com/appengine/docs/standard/python3/building-app
-
https://cloud.google.com/appengine/docs/standard/python3/building-app/creating-gcp-project
Installation link for gcloud CLI:
In the project folder, create a file called app.yaml
cat > app.yaml
runtime: python
env: flex
entrypoint: gunicorn -b :$PORT app:app
runtime_config:
operating_system: "ubuntu22"
Ctrl + C to exit editor mode
(Assuming you've installed the SDK already)
Navigate to project location
gcloud init
Select app to be deployed/set up
Navigate to Console > Navigation Menu > IAM & Admin > IAM
Add following roles for your gmail account & the [project_name]@appspot.gserviceaccount.com:
- App Engine Deployer (most relevant role)
- App Engine Viewer
- App Engine Code Viewer
Go back to project location
gcloud app deploy
Now, you wait. :)
In case gcloud app deploy
still throws an error
Retry using
gcloud auth login
gcloud app deploy
Reference for help just in case: https://stackoverflow.com/questions/56126481/gcloud-error-gcloud-app-deploy-permissions-error-fetching-application