How to deploy your Django app to anynines

django deployment on anyninesBefore we can deploy a Python app to anynines we have to take care of some preparations. In this post I’d like to demonstrate the Python application deployment prerequisites and process using the example of a simple Django application. The demo application’s source code can be found on Github.

Prerequisites

Configure environment

At first we have to ensure that our desired Python version is specified in the runtime.txt file. In addition we need to specify our dependencies within the requirements.txt file.

Hint: You can use the pip freeze command to show a list of installed packages.

The Python buildpack uses a Procfile in the root directory of your application specifying the app’s start command.

Adjust deployment manifest

Anynines uses so called manifest files to specify deployment details for applications. The example application contains an example manifest.yml file. The most important lines within this file are the application name, the application host and the buildpack url pointing to the Heroku Python buildpack:

Deployment

As we prepared our application environment and deployment configuration with our manifest file, we are ready to deploy the app to anynines by running the push command from our application’s root directory:

The CLI will output logs during each step of the deployment process informing of the currently executed tasks. After finishing the staging phase your application will transferred to a container and started using the Procfile’s start command.

At the end of the deployment process the current state of your application along with other information like the RAM usage and bound urls is displayed.

You can copy the link and play around with your fresh Django application running on anynines. Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *