how to deploy .py python file on azure webapp without using Flask or Django?

ashish fugat 11 Reputation points
2020-10-24T04:39:53.58+00:00

I do not want to use any framework like Flask or Django

I have a simple python file with continuous loop where I call websocket api and read data.

How can I deploy this file to azure webapp ? I tried azure tutorial but it is using Flask or Django.

Can anyone share any blog?

my sample testingWebAPI.py code

import pandas as pd
import json
import logging

i = 1
while True:
print(i)
i += 1

my some detail code of api

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,807 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 28,286 Reputation points Microsoft Employee
    2020-10-26T00:13:23.26+00:00

    Hi @ashish fugat ,

    Since you're not exposing any http endpoints e.g. ('/'), you're better off creating a webjob. Create your app service as you did in the VS code tutorial you followed or in the portal. But instead of deploying your code to the app service, zip the contents of your app folder, and upload it through the webjob blade. Since your app is a while(true), then you'll want to add your webjob as Continuous. In doing that, you'll have to make sure Always On is enabled under Configuration Settings for your app service. I would suggest creating a run.cmd file that points to your testingWebAPI.py file. See https://github.com/projectkudu/kudu/wiki/WebJobs for more information.

    Regards,
    Ryan

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.