Livestreams Web Development

Developing Flask Apps on Google Cloud

We just had a webinar with Abby Carey from Google, where we discussed deploying Flask applications on GCP, using all the differerent services that it gives you.

In the webinar, Abby covered:

  • Using Cloud Code (A PyCharm plugin) that can be used to create new projects with a Flask or a Django template
  • Building your flask Cloud Run application locally, and then deploying it to GCP
  • Automatic rebuilds and redeploys on changes made to the codebase using Cloud Code
  • Managing Secrets using Cloud Code
  • Confugiruing and working with Cloud SQL Databases
  • Using Google Pub/Sub to as a means of communication between different services, which include but are not limited to Cloud Run and Google Storage.

The code to the first application can be found on GitHub.

Questions

Throughout the talk, there were a few questions that were asked, so we thought it would be a good idea to share the questions as well as the answers with you on this blog post.

  • Does Cloud Code have debug support?
    • Currently, it does not, but it is being worked on.
  • Do you need to install Gcloud sdk to use any of the plugins?
    • Cloud Code should install all these plugins.
  • Does Pub/Sub provide a Kafka-like interface?
    • Yes, with the addition that Pub/Sub is fully managed by Google Cloud.
  • Does Cloud Code work on PhpStorm?
  • Can we have access to this code later on?
  • Does the Secret manager handle the Flask app config variables too?
    • Yes, Secret Manager can be used to set any environment variables, and Flask can be configured to take its configuration from the same environment variables.
      But, anything that does not actually need protection, you can just add them as regular environment variables when deploying.
  • Is it possible to use a local database or does it have to be cloud based?
    • It has to be cloud based.
  • Is Pub/Sub something you would use for Android App Notifications?
    • No. It is more of a tool that is used to communicate between GCP apps and services.
  • Is it possible to run a Dart application on Cloud Run?
    • Yes. Anything that can be containerized can be run on Cloud Run.
image description