Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy Django App serverless on GCP cloud functions

I have a Django webapp (a forum) which have few screens like login, profile, posts, replies, etc..

A regular deployment on dedicated instances (with scalability, performance in mind) seems to be expensive. I have come across serverless deployment of Django apps on AWS Lambda. Here is one such example on AWS. But I couldn't find anything similar on GCP.

Is a similar thing possible using Google cloud functions (GCF)?

In other words, can GCF be used to deploy any of the following:

  • a web app which can serve dynamic pages
  • a microservice with multiple rest endpoints
like image 990
iwekesi Avatar asked Nov 21 '25 05:11

iwekesi


1 Answers

I wouldn't recommend to deploy a Django application in Cloud Functions itself, since I'm not aware of any tool like Zappa (which only works on AWS) to easily build and deploy the WSGI web apps to Cloud Functions. And I'll say that the product itself is more focused on "single-purpose functions that are attached to events emitted from your cloud infrastructure and services" and has the following use cases, such as lightweight APIs, webhooks, etc. rather than deploying a Django application.

I would rather explore other products from Google Cloud Platform, mainly App Engine or Cloud Run if you are interested in the serverless aspect of Cloud Functions (although as you already know you could also rely on Compute Engine instance and Kubernetes Engine if you are also interested in having full control of the application).

To answer your questions above notice that you can easily integrate Firebase Cloud Functions + Firebase hosting to easily serve dynamic content and host microservices (but notice that this solution will specifically require a migration to use a JS web framework like Express.js, since Firebase Cloud Functions can only be written in Node.js and don't support the Python Runtime that Django is based upon).

like image 172
Daniel Ocando Avatar answered Nov 24 '25 22:11

Daniel Ocando



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!