Deploying a Flask app to Google App Engine
This is the base file tree I use:
lib/
, app.yaml
and appengine_config.py
are needed for the App Engine. The rest is basic Flask.
-
lib/
You will need to have the libraries files in this paste for the deploy to work nicely. To install the required libs inside
lib/
, run:
-
appengine_config.py
Where you can customize Python modules. You should define only the constants or hook functions you wish to override.
-
app.yaml
It contains information about the application code. You can also put the url handlers in this file.
-
static / templates
Where Flask will look for your
.css
and.html
files respectively. -
main.py
Your python code.
-
requirements.py
The list of libraries you’ll use.
Environment set up
1. Make sure you have Python 2.7.9 or later:
2. Download and install the Google App Engine SDK accordingly to this: Google Cloud SDK
3. Install the gcloud component that includes the extension for Python:
4. Create a project:
Deploying the app
1. Test your application
2. Deploy it
My thoughts on App Engine
I didn’t enjoy it very much. Considering I’ve only worked with Heroku so far, I found App Engine to be much more complex than needed and inflexible. That’s my inexperienced opinion, if you have a thing or two to say in favor of App Engine, please comment so I can learn a little bit more.