Deploying Django to Google cloud platform - python

I'm working on a project which is a django backend application , the application at some point relies on the file system to read and write videos and also load tensorflow models.
Is it possible to use google app engine to run my django app or do I need to rent a VM ?
Thanks

Yes, it is possible to run your Django App on App Engine.
You cannot write to App Engine file system but you can read files from your own project.
A possible solution would be to use Cloud Storage to read and write videos and load tesorflow models.
Reading and Writing to Google Cloud Storage
How to restore Tensorflow model from Google bucket without writing to filesystem?

Yes, you can run Django on App Engine, see https://cloud.google.com/python/django/appengine for more details.
There are other options as well for running Django on Google Cloud, see https://cloud.google.com/python/django/ for a complete list.

Related

How to run python programs for android app in cloud for each user

I have a python programs & classes combined together by main.py for the backend algorithms and works. I was developing the app for android using Jetpack compose in android studio.
Last week I started my research for cloud services that can run my python programs for my android.
I find that App Engine of Google Cloud Platform and Firebase. But after looking for tutorials I couldn’t find a way to work with App engine so I decided to go for Firebase.
In Firebase page, they had a service called - Cloud function. Now as per my understanding even I if I had gone with App engine, I would have used the Cloud function too.
How my app works?
My app is a social media app. I have a MongoDB server cluster in MongoDB Atlas that store every data. For authentication I had decided to go just for plain custom username & password stored encrypted on my same MongoDB server, but I was open to Firebase Authentication too. Since my app had a feed where photos, videos are stored - I needed a cloud storage for that. I found that Google Cloud storage for that.
So back to my question. Is there any service that is server-less (as I’ve very less people in my team to manage a server too) that can run Python programs for different requests from different users of my android app.
For sake of comparison, my app can be compared to Instagram without Reels!
My question is how to upload my python project, which contains different classes that are used to as algorithms for my app. It's like this, for ex., if an user goes to feed page then it has to call function in my python program that gets the feeds as per calling user's preference & followed accounts. My understanding is that I have to call this function from my android app.
I need help to find a tutorial for following things:
How to set up Firebase or App Engine & implement it in Android Studio
How to deploy my python files to firebase or App Engine for Cloud Functions
How to call this function from Android app (Kotlin + Compose) and receive in Python.
Note: I've already implemented the class that communicate with my MongoDB Atlas, So I also have functions in Python that updates the MongoDB.
Finally, how to upload the files from user input in Android app to Cloud Storage through my Python functions. And how to download files from Cloud Storage to Android app through my Python functions.

How to deploy a streamlit app in compute engine

I want to deploy a python streamlit app using compute engine as my company does not provide access to app engine yet. Is there a way to deploy the app using compute engine rather than app engine on google cloud. I have searched multiple forum but unable to find relevant answers.
Sorry for the more general question; I hope someone can help me get over this hurdle or maybe point me to a resource.
If your application is containerized, I would suggest deploying it to Google Cloud Run instead of Compute Engine. Cloud Run is a serverless cloud service used to easily deploy pre-built applications. One of its main advantages is that it automates most of the resources management process. Therefore, all you have to do is to tell Cloud Run where your Docker image is, and then Cloud Run will deploy it on a serverless environment without needing to specify the optimal number of resources for example.

How to Deploy Flask ML model in Google cloud

I have built three ML keras models for image classification and implement their weights in a Flask application for a comparative analysis about the testing accuracies. It works perfectly with the Flask server in the localhost.
Now I want to deploy this Flask app so it would be accessible anywhere for testing with new data.
I am new to cloud platform. Can you just guide me how to deploy this Flask app.
I have watched tutorials but Im not getting any relevant one about models weight above 700Mb. It would be great if u could help me to deploy this in Google Cloud.
You can use AI Platform within Google Cloud, is a service for develop, analyze or deploy customize models and implement it as a service.
This is the link. https://cloud.google.com/ai-platform?hl=es-419
I think that Compute engine (GCE) is the GCP product that matches with you use case,in compute engine you can upload your flask application.
Compute engine is technically a VM on the cloud, you can install an uninstall packages or SW without any limitation.
In this link you can find information about how to deploy a python web application on GCE.

How can I edit the NGINX configuration on Google App Engine flexible environment?

How can I edit the Google App Engine NGINX configuration?
There doesn't seem to be much support in the Google docs in regards to the NGINX configuration for apps running in the Google App Engine flexible environment.
My app is running fine, but I get this 413 error when I try and upload an audio file (.wav or .mp3).
413 Request Entity Too Large -- nginx
My app is running Django (python 3), with Cloud Postgres SQL and Cloud Storage enabled.
I researched the error, and it seems I can set a nginx.config file so that it includes "client_max_body_size 80M" - but like I said, there is no documentation regarding how to manually config NGINX on deploy.
Any suggestions?
You should be able to create a nginx-app.conf file in the same directory as your app.yaml file. There is an example of using the nginx configuration file in a Flex environment located here: https://github.com/GoogleCloudPlatform/getting-started-php/tree/master/4-auth .
This same file is referenced in Google's documentation here: https://cloud.google.com/appengine/docs/flexible/php/runtime#customizing_nginx
Once you have that file created, you should be able to add any property you need and then rebuild your project to see the changes take effect.
So upon contacting Google Support, the suggested solution for uploading files larger than 32MB is as follows:
"The way to circumvent App Engine's 32MB limit is to send the requests directly to Cloud Storage, for instance using the resumable upload process. You can still use App Engine to serve your app, but the clientside portion of the app would be the one handling the upload to Google Cloud Storage. For this you would have your application generate a signed URL which the client can use to gain access to your Cloud Storage bucket for the purpose of uploading an image."
I went with this solution. It saves money in the end.

Deploy webapp on GAE then do changes online from GAE console

I deployed a webapp2 python application on GAE. Is there any way with which i can explore the source code or make changes in the project files from GAE console. Is it possible that if i only want to update a single .py file on already deployed app rather than again deploying the whole project?
I think you're looking for this :
https://console.cloud.google.com/code/develop
I pushed my code on Google Cloud Platform with git, and I'm able to change text files directly online.
The doc is here :
https://cloud.google.com/source-repositories/

Categories