Django
Django
by DigitalOcean

VERSION 1.11.11

OS Ubuntu 18.04

Create Django Droplet

Description

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.

Software Included

PackageVersionLicense
Django1.11.11Custom
Nginx1.14.0Custom
Certbot0.23.0Apache 2
Gunicorn19.7.1MIT
Postgres10Postgres SQL
Postfix3.3.0IBM Public

Getting started after deploying Django

After you create a Django One-Click Droplet:

  • The Django user password, Postgres password and secret keys are in /root/.digitalocean_passwords.

  • The Django project is served by Gunicorn, which listens on /home/django/gunicorn.socket.

  • Gunicorn is proxied by Nginx, which listens on port 80. The Nginx configuration file is located at /etc/nginx/sites-enabled/django.

  • Gunicorn is started on boot by a Systemd file at /etc/systemd/system/gunicorn.service.

    This Systemd script also sources a configuration file located at /etc/gunicorn.d/gunicorn.py that sets the number of worker processes. You can find more information on configuring Gunicorn in the Gunicorn project’s documentation.

  • The Django project itself is located at /home/django/django_project.

    If you rename the Django project folder, you will also need to make two configuration file updates: in the Nginx configuration, change the path to your static files; and in the Gunicorn Systemd file, update the WorkingDirectory, name, and pythonpath.

Once the Droplet is running, you can immediately start using Django.

API Creation

In addition to creating a Droplet from the Django 1-Click App via the control panel, you can also use the DigitalOcean API.

As an example, to create a 4GB Django Droplet in the SFO2 region, you can use the following curl command. You’ll need to either save your API access token to an environment variable or substitute it into the command below.


  curl -X POST -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer '$TOKEN'' -d \
      '{"name":"choose_a_name","region":"sfo2","size":"s-2vcpu-4gb","image":"django-18-04"}' \
      "https://api.digitalocean.com/v2/droplets"
      

Support Details

Supported By:DigitalOceanDigitalOcean
Support URL:https://www.djangoproject.com/community/

Learn More

Product Docs

Technical overviews, how-tos, release notes, and support material

Tutorials

DevOps and development guidelines

API Docs

Run your resources programmatically

Ask a question

Connect, share and learn