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
- Make sure you create virtual env from Python 3.7 version
python.exe -m venv venv
- After creating it…Activate venv as below
- 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
- Replace application.py content with below (In line 6 “your djangoapp.settings”)
- Include Allowed hosts in settings.py file
- Navigate to Azure Portal.
- Create Web App on Linux.
- Setup Continuous Deployment or Use local git to push your code to azure.
- 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.
- My Sample output with static file.