Backend Development 8 min read

Getting Started with Django: Installation, Project Setup, and Debug Toolbar on a Cloud Server

This guide walks you through installing Django and the django-debug-toolbar on an Ubuntu cloud server, creating a new project, running migrations and the development server, configuring allowed hosts, and integrating the toolbar via settings and URLs to monitor queries, templates, and performance in real time.

Didi Tech
Didi Tech
Didi Tech
Getting Started with Django: Installation, Project Setup, and Debug Toolbar on a Cloud Server

Django is the most popular Python web development framework, widely used by many companies. It provides a powerful ORM, a flexible template engine, built‑in security features, comprehensive testing support, and an extensible architecture.

Key features of Django include:

Full support for Python 3.

Database support for SQLite, MySQL, PostgreSQL with an automatic migration system.

Flexible template engine with inheritance and built‑in filters/tags.

High‑level security (CSRF, XSS, SQL injection protection) out of the box.

Complete unit‑test framework that can simulate cookies, sessions, etc.

Powerful debugging with detailed stack traces and variable inspection.

Rich ecosystem of third‑party extensions.

One especially useful extension is django-debug-toolbar , which provides real‑time insights into database queries, template rendering time, static file access, and more.

Installing the development environment on a cloud server

The tutorial assumes an Ubuntu 16.04.4 LTS cloud instance (e.g., from Didi Cloud) with a public IP. The default login is dc2-user ; use sudo for privileged commands.

After logging in via SSH key, configure the pip source to use the cloud provider’s fast mirror, then install Django and the debug toolbar with:

pip3 install Django django-debug-toolbar

Creating a Django project

Use django-admin startproject djsite to generate the project skeleton. The generated manage.py script is used for common tasks such as creating a superuser, applying migrations, and running the development server.

Initialize the default SQLite database:

python3 manage.py migrate

Start the development server (listening on 127.0.0.1:8000 by default):

python3 manage.py runserver

To expose the server publicly, run it on port 80 (requires sudo ) or adjust ALLOWED_HOSTS in settings.py . When DEBUG=True , you can either set DEBUG=False for production or add your public IP to ALLOWED_HOSTS .

Integrating django-debug-toolbar

Modify settings.py :

Add 'debug_toolbar' to INSTALLED_APPS .

Insert 'debug_toolbar.middleware.DebugToolbarMiddleware' into MIDDLEWARE .

Define INTERNAL_IPS (e.g., include your server’s public IP or 127.0.0.1 ).

Update urls.py to include the toolbar URLs:

import debug_toolbar urlpatterns = [ path('__debug__/', include(debug_toolbar.urls)), # ... other patterns ... ]

After restarting the server, accessing http://YOUR_HOST_IP/admin/ will display the toolbar on the top‑right corner, showing SQL queries, cache usage, template rendering times, and request details.

PythondeploymentDjangoweb developmentCloud serverDebug Toolbar
Didi Tech
Written by

Didi Tech

Official Didi technology account

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.