Running scripts on cloud - python

I'm new to cloud computing domain. Here is what I've:
1) A domain.
2) A hosting space (on HostGator).
3) A Microsoft Azure account.
And here is what I need to do:
1) Take an input file from the user using HTML.
2) Processing the input file using a Python script.
3) Returning an output file generated by the script to the user.
How do I do this? Any rough steps?
I want to implement this using Microsoft Azure.
Though HostGator supposedly supports Python 2.7, I couldn't run my scripts there and got an Internal Server Error 500.

As Azure is a cloud platform which provides a growing collection of integrated services.You can leverage Azure Web Apps to approach your need.
You can build your python project on local first, then create a Web app on Azure portal, and deploy your project to Azure Web app with Git, FTP or Visual Studio.
Here is an official reference about how to deploy python project on Azure Web app step by step.
Also, you can configure a custom domain name in Azure Web Apps, for more information you can find in Configure a custom domain name in Azure App Service

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 host Azure Python API via Azure Data Storage

I have python scripts that I want to host as a web app in azure.
I want to keep the function scripts in azure data storage and host them as a python API in azure.
I want some devs to be able to change the scripts in the azure data storage and reflect the changes live without having to deploy.
How can I got about doing this?
Create Function App of Runtime Stack Python supported only in Linux Version in any Hosting Plan through Azure Portal.
Make the Continuous Deployment setting to GitHub under Deployment Center of the function app in the portal like below:
After authorizing, provide your GitHub Repository details in the same section.
Create the Azure Python Functions from VS Code and deploy to the GitHub Repository using Git Clone through Command Palette.
After that, you can deploy the functions to azure function app.
Here after publishing to azure, you'll get the Azure Functions Python Rest API.
I want some devs to be able to change the scripts in the azure data storage and reflect the changes live without having to deploy.
Whenever you or dev's make changes the changes in code through GitHub and commit the changes, then it automatically reflects in the Azure Portal Function App.
For more information, please refer this article and GitHub actions of editing the code/script files.

How to deploy a flask application on Azure?

I am working on a Flask application and I need to deploy it on Azure.
I am totally new to Azure and I have built a project using Python Flask and HTML. In the application, I have one main Flask app and two HTML pages. I need to deploy the whole project to an Azure app service.
Can anyone please let me know how to do it on Windows?
Thanks.
As PGHE said, at present, Python is supported on Azure App Service for Linux.
You can refer to this article about Deploy Python apps to Azure App Service on Linux from Visual Studio Code.
If you still want to publish python application to azure webapp on windows you can refer to this article while the features about publishing to Azure App Service on Windows are deprecated but continue to work.

File version different between Azure Portal and Azure Portal Kudu for the same file

Currently my Azure Function shows a different file version in the portal as compared to Kudu.
I am using Azure App Service /w Azure Functions V2 and Python 3.7.
I publish my function app using:
func azure functionapp publish <functionappname>
It successfully performs a remote build.
Now if I look at my Function App in the portal I can see the updated version of my init.py. However, when I use Kudu (Platform features > Advanced tools (Kudu)) to look into the file /home/site/wwwroot//init.py I still see the old version. Shouldn't these versions be identical?
I hope some experienced user can shed light on this.
I test it in my side, when I create a new azure function app(python) and deploy the python code from VS Code to azure portal. It will not create a "init.py" under the directory /home/site/wwwroot. In this directory, it just exists a "host.json"(shown as below).
So you can see the new version of your "init.py" after your deployment on azure portal, but it seems the old version "init.py" in the directory /home/site/wwwroot may be created by a deployment in the past or created because some other reasons in the past. I think it has nothing to do with your new deployment.

How to deploy and use custom python package on azure as a service and consume it

I have created a custom python package which has few machine learning algorithms in it.
I would like to deploy this custom python package on azure as a service that can be consume by my other applications like a batch job and a website.
I have bought an azure license but have no clue on the deployment strategy. Please advice
I'd recommend using the following documentation, it will allow you to Deploy Python application to Azure App Service using VSTS.The lab would provide you with the same skills to deploy your app to Azure App service.

Categories