This is my fork of the example code from the Django REST Tramework tutorial code with explanation of how to deploy with Azure for part of Accelerate web development with Azure and GitHub webinar demos.
- [Recommended] Use your Python virtual environment with your preferred IDE such as Visual Studio Code (with Python extension is so great!). On command line, for example,
$ python -m venv my_venv
$ cd rest-framework-tutorial-with-azure
$ code .
- Satisfy Python library requirements by referring to requirements.txt. Using pip would be great like:
$ pip install -r requirements.txt
- You can test by running
manage.py
. Here are sample commands to test locally. Also, restore.sh loads sample fixtures forusers
andsnippets
.
# Run a local server with 8080 port number
$ python manage.py runserver 8080
# Create an initial migration for our snippet model, and sync the database for the first time.
$ python manage.py makemigrations snippets
$ python manage.py migrate
This for mainly shows the first deployment method but there are other ways for web applications with Azure:
The current source code uses sqlite
with local test support. It can be easily deployed on VSCode as a Web App. After installing Azure App Service extension, login on Azure and create your new app.
carltongibson's fork - azure/2-appservice
branch shows how to integrate with Azure Database for PostgreSQL as database backend, and Azure Storage to store and load static web files. Also, see how environment and application settings are being managed through local environment variables and simple Python scripts.
See commits on carltongibson's fork - azure/4-functions
branch to figure how to easily migrate from App Services to Azure Functions for serverless web applications.
- (Azure Webinar) Accelerate web development with Azure and GitHub by Sudhir and Ian
- (Azure Friday) Python on Azure - Part 1, 2, 3, and 4
- Visual Studio Code - snippets for use with Django REST Framework