Django Deployment in Azure

Steps to deploy an HTTP API in Azure functions

Create function

Install dependencies

Before you can get started, you should install Node.js which includes npm.

  • Run the following command to install the Core Tools package:

npm install -g azure-functions-core-tools@4 --unsafe-perm true

Create an Azure Functions project

In the terminal window or from a command prompt, navigate to an empty folder for your project, and run the following command:

func init

You will also be prompted to choose a runtime for the project. Select .

Create a function

To create a function, run the following command:

func new

This will prompt you to choose a template for your function. We recommend HTTP trigger for getting started.

Run your function project locally

Run the following command to start your function app:

The runtime will output a URL for any HTTP functions, which can be copied and run in your browser's address bar.

To stop debugging, use Ctrl-C in the terminal.

Deploy your code to Azure

To publish your Functions project into Azure, enter the following command:

You may be prompted to sign into Azure (if not logged in already).

FAQS

Value of AzureWebJobsStorage app setting is invalid

Possible Issues and respective solutions:

  • AzureWebJobsStorage env var not cofigured for the app, set the env var in the azure console to fix the issue.

  • AzureWebJobsStorage value set in the env vars is invalid, check once if it is in the below format:

Django App Deployment

Method 1 (with serverless)

  • create a file azure_handler.py at project root level with below content.

  • create a file serverless.yml at project root level with below content.

  • create a dir inside your django project let say azure_app.

  • create a file azure_handler.py with below content.

Last updated