Skip to content
Example UWSGI application for the Linux Academy NGINX Deep Dive
Python HTML JavaScript Shell Makefile CSS
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.

Example UWSGI Application

This Django 2 note-taking app is designed to be used to demonstrate UWSGI in combination with NGINX.


To run this application you'll need the following:

  • Python 3
  • Pipenv
  • MySQL/MariaDB Client & Shared Libraries (for compiling the native database client package)
  • Access to a MySQL/MariaDB Database


The Makefile provides a few helper tasks to make setting up the application a little easier than it might otherwise be. Here are the tools at your disposal:

  • make install - Creates a virtualenv local to the project and installs the Python dependencies.
  • make service - Creates a notes.uwsgi systemd service to run the application. Assumes use with NGINX and changes ownership of application to nginx:nginx
  • make migrate - Migrates the database. This is the default task.
  • make static - Gathers all static assets to /var/www/$NOTES_HOST/

Environment Variables

Note: for make migrate you'll need to have some environment variables set before running the command:

  • NOTES_DB - The name of the database you've created.
  • NOTES_DB_USER - The database user that the application will use.
  • NOTES_DB_PASSWORD - The database user's password.

If no other values are set, then it is assumed that the database is on the same server. Here are optional environment variables when running the database on a separate server:

  • NOTES_DB_HOST - The domain or IP address of the server housing the database.
  • NOTES_DB_PORT - Defaults to 3306, but you can set this if you're using a non-standard MySQL port.

For the running of the application, you'll want to set the following HOST related environment variables or the application will default to

  • NOTES_HOST - The application's primary hostname, and the destination for static assets at /var/www/$NOTES_HOST/
  • NOTES_ALLOWED_HOSTS - All of the host names that Django should except traffic for. Defaults to $NOTES_HOST, localhost, and
You can’t perform that action at this time.