codeDojo
codeDojo

Reputation: 359

How to deploy a Python 3 Flask project on Google Cloud

I have searched a lot on how to deploy a Python 3 Flask project on Google Cloud. I always end up with explanations on Python 2 or old versions for Google Cloud. The YouTube videos I have seen are at least 1 or 2 years old, and most of the services, buttons, and procedures are changed now.

I downloaded Google Cloud SDK to use it with PyCharm, but still I wasn't that lucky to get it work. Even Google docs are on Python 2 Check this link. These docs are not upgraded. Could anyone help me on how to do that using PyCharm? Or at least point me to more recent docs. I appreciate any help!

Upvotes: 1

Views: 2036

Answers (2)

Rodrigo C.
Rodrigo C.

Reputation: 1184

Since you want to use Python 3, your App Engine application should be developed in a Flexible environment (Standard only supports Python 2).

To deploy your Python 3 app, you can try this quickstart and then adapt your code to work the same way. This supports @ingernet and his answer to configure app.yaml in a way that the app recognizes Python 3 as the language used.

Upvotes: 1

ingernet
ingernet

Reputation: 1524

If you're using App Engine to deploy this thing, you've got an app.yaml file. The Python Runtime page on the GCP docs describes how to specify a Python version:

runtime: python
env: flex

runtime_config:
    python_version: 3

... looks like the major release number defaults to the most recent stable patch, e.g. 3 -> 3.6.4.

Hope this helps!

Upvotes: 2

Related Questions