In this blog I’m creating Django app with Python 3.7 image from Azure Web App on Linux

  • Create an app and open visual studio code
  • Create requirements.txt with below content

    django==2.1.2

  • Make sure you create virtual env from Python 3.7 version

    python.exe -m venv venv

  • After creating it…Activate venv as below

    .\venv\Scripts\activat.bat

  • Install requirements.txt

    pip install -r requirements.txt

`
  • Check if Django is installed correctly

    python -m django –version

`
  • Do django-admin startproject <somename> that creates auto-generate code to start Django app with

    django-admin startproject mydjangoapp

  • Include Allowed hosts in settings.py file
  • Navigate to Azure Portal.
  • Create Web App on Linux.
  • You can find a sample Python Django project with above operations @GitHub Link

SERVING STATIC FILES:

  • Add whitenoise plugin to serve static files on Azure.

https://pypi.org/project/whitenoise/

https://devcenter.heroku.com/articles/django-assets

  • My Sample output with static file.