Skip to content

ianychoi/rest-framework-tutorial-with-azure

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AzureGithub - REST framework tutorial

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.

Testing with your local environment

  1. [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 .
  1. Satisfy Python library requirements by referring to requirements.txt. Using pip would be great like:
  $ pip install -r requirements.txt
  1. You can test by running manage.py. Here are sample commands to test locally. Also, restore.sh loads sample fixtures for users and snippets.
  # 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

Deploying to Azure

This for mainly shows the first deployment method but there are other ways for web applications with Azure:

1. as App Services

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.

2. using application settings with PostgreSQL and Azure Storage

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.

3. as serverless (Azure Functions)

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.

Related resources

About

The Django REST framework tutorial with Azure. 🎓

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.8%
  • Shell 1.2%