Cloud Explainers

The Django Roadmap for Beginners

Django (Python web framework)10 min video

A Django roadmap for beginners: eight stages in the order that keeps each one from surprising you, from Python and a virtual environment to URLs and views, templates, models and migrations, the admin, forms and CSRF, tests, and the real-world settings most tutorials skip. We build one small potluck sign-up site through all eight on Ubuntu, with every error real.

The Django Roadmap for Beginners, the full picture: diagram of Python + venv, URLs and views, Templates, Models, The admin, Forms, Tests, Real-world settings, One page, from the database to the browser, A site people can use
The whole picture, from the video's recap.

Works on the laptop, not for real

You finished a Django tutorial, and your site works on your laptop. Dave's does too. It's the sign-up page for his church potluck, nicely styled, with Beth's lasagna and an apple pie already on the list.

Works on the laptop, not for real: browser screenshot from the video

Then he gets it ready to go online for the church. He turns off DEBUG, the setting that shows detailed error pages. And the server won't even start: you must set ALLOWED_HOSTS if DEBUG is False. By the end, Dave's server starts with DEBUG off, and you'll have an order for learning Django where no stage surprises you like that.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ grep -n '^DEBUG\|^ALLOWED_HOSTS' potluck/settings.py26:DEBUG = False
28:ALLOWED_HOSTS = []
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py runserverCommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False.

The order

Here's an order that works, in eight stages. Think of flat-pack furniture: the instructions go frame, then shelves, then doors, because each part screws into the one before. Django is the same. The first four stages get one page from the database to the browser. The next four make it a site people can use. We'll build Dave's potluck site again from an empty folder, through all eight, including the stage most tutorials skip.

Stage 1: Python and a venv

Stage one is Python itself. If functions, lists and dictionaries are new, start with our Python roadmap first: Django code is ordinary Python. Then give the project its own virtual environment. That's a private folder of packages, so this site's Django can't clash with anything else on the laptop. Dave makes one called dot venv, switches it on, and installs Django with pip install django.

Dave's laptop: ~/potluck
python3 -m venv .venv
Dave's laptop: ~/potluck
source .venv/bin/activate
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ pip install djangoCollecting django
  Downloading django-6.1.3-py3-none-any.whl.metadata (3.9 kB)
Collecting asgiref>=3.9.1 (from django)
  Downloading asgiref-3.13.0-py3-none-any.whl.metadata (12 kB)
Collecting sqlparse>=0.5.0 (from django)
  Downloading sqlparse-0.6.1-py3-none-any.whl.metadata (6.9 kB)
Downloading django-6.1.3-py3-none-any.whl (8.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.4/8.4 MB 57.9 MB/s eta 0:00:00
Downloading asgiref-3.13.0-py3-none-any.whl (27 kB)
Downloading sqlparse-0.6.1-py3-none-any.whl (51 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.2/51.2 kB 16.7 MB/s eta 0:00:00
Installing collected packages: sqlparse, asgiref, django
Successfully installed asgiref-3.13.0 django-6.1.3 sqlparse-0.6.1

django-admin startproject makes the project. The dot at the end puts it right in the folder he's in. He gets manage.py, the command you'll run for everything, and a folder of settings. runserver starts Django's development server. Two lines to notice. Eighteen unapplied migrations: we'll meet those in stage four. And a warning that this server is for development only.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ django-admin startproject potluck .
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ lsmanage.py  potluck
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py runserverWatching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
November 24, 2026 - 15:00:15
Django version 6.1.3, using settings 'potluck.settings'
Starting WSGI development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see: https://docs.djangoproject.com/en/6.1/howto/deployment/
[24/Nov/2026 15:00:15] "GET / HTTP/1.1" 200 12149
[24/Nov/2026 15:00:15] "GET / HTTP/1.1" 200 12149

And in the browser, there's Django's rocket page. The install worked.

Stage 1: Python and a venv: browser screenshot from the video

Stage 2: URLs and views

The rocket page is Django's, not Dave's. So how does Django decide what to show for an address? Stage two is the path every request takes. Django reads the address, finds the matching pattern in urls.py, and calls that pattern's view: a Python function that takes the request and returns a response. Templates and models come later, and they plug into the view.

Every request takes the same path: diagram of the browser, urls.py, the view, a template, a model

A project is split into apps, one folder for each part of the site, and Dave makes one called signups. His view is a function that returns one line of text, and there are now two urls.py files. The project's file sends any address starting with signups to the app, and the app's file points what's left, nothing, at the view. curl, a browser for the terminal, fetches the page: no dishes yet. Then he asks for signup, without the s, and curl shows just the status code: 404, Not Found.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py startapp signups
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ cat signups/views.pyfrom django.http import HttpResponse


def dish_list(request):
    return HttpResponse("Potluck sign-ups: no dishes yet")
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ cat signups/urls.pyfrom django.urls import path

from . import views

urlpatterns = [
    path("", views.dish_list),
]
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ curl -s localhost:8000/signups/Potluck sign-ups: no dishes yet
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ curl -s -o /dev/null -w '%{http_code}\n' localhost:8000/signup/404

With DEBUG on, Django's 404 page lists every pattern it tried, in order: admin, then signups. When a page won't load, that list is the first place to look.

Stage 2: URLs and views: browser screenshot from the video

Stage 3: templates

One line of text won't make a sign-up sheet. Stage three is templates: HTML files with gaps that Django fills in, like a loop that writes one line per dish. Dave's view now renders signups slash list.html, which means it fills in that template and sends it back. The file lives at signups, templates, signups, list.html. The second signups folder keeps its name from clashing with another app's. Guess first: will the page load? No. It's a 500, a server error. The log says: TemplateDoesNotExist.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ cat signups/templates/signups/list.html<h1>Potluck sign-ups</h1>
<ul>
{% for dish in dishes %}
  <li>{{ dish.name }} ({{ dish.kind }}), brought by {{ dish.person }}</li>
{% empty %}
  <li>No dishes yet</li>
{% endfor %}
</ul>
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ curl -s -o /dev/null -w '%{http_code}\n' localhost:8000/signups/500
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py runserverWatching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
November 24, 2026 - 15:00:17
Django version 6.1.3, using settings 'potluck.settings'
Starting WSGI development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see: https://docs.djangoproject.com/en/6.1/howto/deployment/
Internal Server Error: /signups/
Traceback (most recent call last):
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 199, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/signups/views.py", line 5, in dish_list
    return render(request, "signups/list.html", {"dishes": []})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/shortcuts.py", line 27, in render
    content = loader.render_to_string(template_name, context, request, using=using)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/template/loader.py", line 61, in render_to_string
    template = get_template(template_name, using=using)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/template/loader.py", line 19, in get_template
    raise TemplateDoesNotExist(template_name, chain=chain)
django.template.exceptions.TemplateDoesNotExist: signups/list.html
[24/Nov/2026 15:00:17] "GET /signups/ HTTP/1.1" 500 69339

Django only looks for templates inside apps it knows about, and nobody told it about signups. In settings.py there's a list called INSTALLED_APPS: the apps Django knows about. Add signups to it, and the page renders. Every new app goes in that list.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ grep -A8 '^INSTALLED_APPS' potluck/settings.pyINSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'signups',
]
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ curl -s localhost:8000/signups/<h1>Potluck sign-ups</h1>
<ul>

  <li>No dishes yet</li>

</ul>

Stage 4: models

Right now the page can only say no dishes yet: there's nowhere to keep them. Stage four is the database, the last piece of the frame. A database keeps data in tables, a bit like spreadsheets. A model is a Python class that describes one table, and each field becomes a column: the dish, who brings it, and the kind: main, side or dessert. The dish name must be unique, so nobody brings the same thing twice. makemigrations writes the change down as a migration file, a small Python file that says create this table.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ sed -n '4,9p' signups/models.pyclass Dish(models.Model):
    KINDS = [("main", "main"), ("side", "side"), ("dessert", "dessert")]
    name = models.CharField(max_length=60, unique=True)
    person = models.CharField(max_length=60)
    kind = models.CharField(max_length=10, choices=KINDS)
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py makemigrationsMigrations for 'signups':
  signups/migrations/0001_initial.py
    + Create model Dish

Then Dave changes his view to fetch every dish from the database, and hand them to the template, and the page fails again: no such table, signups_dish. A migration file doesn't change the database by itself.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ curl -s -o /dev/null -w '%{http_code}\n' localhost:8000/signups/500
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py runserverWatching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 19 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions, signups.
Run 'python manage.py migrate' to apply them.
November 24, 2026 - 15:00:18
Django version 6.1.3, using settings 'potluck.settings'
Starting WSGI development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see: https://docs.djangoproject.com/en/6.1/howto/deployment/
Internal Server Error: /signups/
Traceback (most recent call last):
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/backends/sqlite3/base.py", line 359, in execute
    return super().execute(query, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: signups_dish

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 199, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/signups/views.py", line 7, in dish_list
    return render(request, "signups/list.html", {"dishes": Dish.objects.all()})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/shortcuts.py", line 27, in render
    content = loader.render_to_string(template_name, context, request, using=using)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
    return self.template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/template/base.py", line 174, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/template/base.py", line 166, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/template/base.py", line 1107, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/template/base.py", line 1068, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 202, in render
    len_values = len(values)
                 ^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 455, in __len__
    self._fetch_all()
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 2287, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 131, in __iter__
    results = compiler.execute_sql(
              ^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1643, in execute_sql
    cursor.execute(sql, params)
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 122, in execute
    return super().execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 79, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 100, in _execute
    with self.db.wrap_database_errors:
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/utils.py", line 94, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dave/potluck/.venv/lib/python3.12/site-packages/django/db/backends/sqlite3/base.py", line 359, in execute
    return super().execute(query, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: no such table: signups_dish
[24/Nov/2026 15:00:18] "GET /signups/ HTTP/1.1" 500 152426

migrate applies it, along with Django's own eighteen. Now Dave opens manage.py shell, which runs Python inside the project, and uses the ORM: Django's way of reading and writing the database in plain Python. He adds Beth's lasagna and his own coleslaw, then asks for only the mains, and gets back the lasagna.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py migrateOperations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, signups
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying sessions.0001_initial... OK
  Applying signups.0001_initial... OK
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py shell -c "from signups.models import Dish; Dish.objects.create(name='Lasagna', person='Beth', kind='main'); Dish.objects.create(name='Coleslaw', person='Dave', kind='side'); print(Dish.objects.count(), 'dishes')"13 objects imported automatically (use -v 2 for details).

2 dishes
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py shell -c "from signups.models import Dish; print(Dish.objects.filter(kind='main'))"13 objects imported automatically (use -v 2 for details).

<QuerySet [<Dish: Lasagna>]>

Stage 5: the admin

Typing dishes into a Python shell won't work for Beth. Stage five gives her a screen, and it's nearly free. Register the model in admin.py, and create a superuser. That's an account allowed into the admin. Now Django's admin site lists every dish, with a button to add more, and forms to change or delete them. For a small site, it can be the whole back office. But the admin is only for people you trust, like Beth, who runs the potluck. Everyone else needs a page of their own, and that's stage six.

Stage 5: the admin: browser screenshot from the video

Stage 6: forms

Stage six is that page. A browser asks for the empty form with a GET request, and sends it back filled in with a POST. A ModelForm builds the form from the model, and checks what people type. Every form that sends data also needs one extra line in its template, the CSRF token. It proves the post came from your own page, not someone else's. The token comes with a cookie. Dave's curl request has no cookie, so Django refuses it: 403, CSRF cookie not set.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ grep -n 'form\|csrf' signups/templates/signups/new.html4:<form method="post">
5:  {% csrf_token %}
6:  {{ form.as_p }}
8:</form>
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ curl -s -o /dev/null -w '%{http_code}\n' -X POST -d 'name=Chili&person=Dave&kind=main' localhost:8000/signups/new/403
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py runserverWatching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
November 24, 2026 - 15:00:21
Django version 6.1.3, using settings 'potluck.settings'
Starting WSGI development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see: https://docs.djangoproject.com/en/6.1/howto/deployment/
Forbidden (CSRF cookie not set.): /signups/new/
[24/Nov/2026 15:00:21] "POST /signups/new/ HTTP/1.1" 403 2908
[24/Nov/2026 15:00:21] "GET /signups/new/ HTTP/1.1" 200 870
[24/Nov/2026 15:00:21] "GET /static/signups/style.css HTTP/1.1" 200 157
[24/Nov/2026 15:00:21] "POST /signups/new/ HTTP/1.1" 200 1045
[24/Nov/2026 15:00:21] "GET /static/signups/style.css HTTP/1.1" 304 0
[24/Nov/2026 15:00:22] "POST /signups/new/ HTTP/1.1" 302 0
[24/Nov/2026 15:00:22] "GET /signups/ HTTP/1.1" 200 275
[24/Nov/2026 15:00:22] "GET /static/signups/style.css HTTP/1.1" 304 0

And the model's rules come along for free. A dish name must be unique, so when Dave signs up a second lasagna, the form says: Dish with this Name already exists. No double lasagna at the potluck.

Stage 6: forms: browser screenshot from the video

Stage 7: tests

Every time Dave changes something, how does he know sign-ups still work, without clicking through the whole site? Stage seven is tests: small functions that use your site the way a visitor would, and check what comes back. Django's test runner builds a fresh, empty database for every run. Dave writes two tests: the list shows a dish, and the same dish twice is refused. Ran 2 tests: OK. Now he can change anything and know within a second whether he broke it.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ sed -n '7,10p' signups/tests.py    def test_list_shows_dish(self):
        Dish.objects.create(name="Lasagna", person="Beth", kind="main")
        page = self.client.get("/signups/")
        self.assertContains(page, "Lasagna")
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py testFound 2 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
..
----------------------------------------------------------------------
Ran 2 tests in 0.006s

OK
Destroying test database for alias 'default'...

Stage 8: real-world settings

Stage eight is the one most tutorials skip, and the one that stopped Dave's server. DEBUG shows those detailed error pages to anyone who asks, with your code, your settings and your URL list, so it must be off on a real site. With DEBUG off, Django wants a list of the addresses your site answers to, and it turns away a request sent to any other. Dave lists them, and the server starts.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ grep -n '^DEBUG\|^ALLOWED_HOSTS' potluck/settings.py26:DEBUG = False
28:ALLOWED_HOSTS = ['localhost', '127.0.0.1']
Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ curl -s -o /dev/null -w '%{http_code}\n' localhost:8000/signups/200

The page loads, but bare: the stylesheet comes back 404, Not Found. Static files are your CSS, images and scripts. Django's development server only serves them while DEBUG is on, as a convenience. On a real server, a web server like nginx serves them, and our video on Django static files shows exactly how. It's the kind of surprise this stage is for: nothing is broken in your code, the setting changed the rules.

Stage 8: real-world settings: browser screenshot from the video

Last, manage.py check --deploy lists what's still missing. Six issues on Dave's site. Three of them: the secret key Django made for development, cookies not marked secure, and an email setting that only prints to the console. Work through that list before anyone else sees your site.

Dave's laptop: ~/potluck
(.venv) dave@laptop:~/potluck$ python manage.py check --deploySystemCheckError: System check identified some issues:

ERRORS:
?: (mail.E001) Your MAILERS setting uses a development-only email backend in the 'default' entry (django.core.mail.backends.console.EmailBackend).
    HINT: Use a production-ready email backend, such as the SMTP backend, otherwise email will not be sent.

WARNINGS:
?: (security.W004) You have not set a value for the SECURE_HSTS_SECONDS setting. If your entire site is served only over SSL, you may want to consider setting a value and enabling HTTP Strict Transport Security. Be sure to read the documentation first; enabling HSTS carelessly can cause serious, irreversible problems.
?: (security.W008) Your SECURE_SSL_REDIRECT setting is not set to True. Unless your site should be available over both SSL and non-SSL connections, you may want to either set this setting True or configure a load balancer or reverse-proxy server to redirect all connections to HTTPS.
?: (security.W009) Your SECRET_KEY has less than 50 characters, less than 5 unique characters, or it's prefixed with 'django-insecure-' indicating that it was generated automatically by Django. Please generate a long and random value, otherwise many of Django's security-critical features will be vulnerable to attack.
?: (security.W012) SESSION_COOKIE_SECURE is not set to True. Using a secure-only session cookie makes it more difficult for network traffic sniffers to hijack user sessions.
?: (security.W016) You have 'django.middleware.csrf.CsrfViewMiddleware' in your MIDDLEWARE, but you have not set CSRF_COOKIE_SECURE to True. Using a secure-only CSRF cookie makes it more difficult for network traffic sniffers to steal the CSRF token.

System check identified 6 issues (0 silenced).

What can wait

And what can wait? APIs with Django REST Framework, async views, background jobs, and Docker. They're all worth learning, and they all sit on top of these eight stages. An API is still URLs, views and models. An async view is still a view. Learn each one when your site needs it, not before.

Worth learning, after the eight stages: cards of REST APIs, Async views, Background jobs, Docker

Can you change the order? A little. Tests can start as soon as you have one view, and the earlier the better. And the admin only needs a model, so you can open it the day you write one. But stages one to four hold each other up, like the frame and the shelves. And stage eight always comes before anyone else uses your site.

Recap

Eight stages: one page from the database to the browser, then an admin, forms, tests, and settings for the real world.

If this gave your Django learning an order, a like helps YouTube show it to more beginners, and subscribing brings each stage's next episode your way.

All the lab files and commands are linked in the description. Thanks for watching Cloud Explainers.

Sources

Demos: a container on our own Mac standing in for a laptop; the potluck is made up. Django was downloaded from PyPI during the run. Every command, error and number was real. Watch the full video on YouTube.

More videos

PostgreSQL9 min

Every PostgreSQL Setting to Change After You Install It

Docker9 min

What Happens When You Install Docker on Ubuntu

Python8 min

How to Fix Python 'Address Already in Use' Errors

Go (Golang)5 min

Golang Interfaces and Mocks in 5 Minutes

Git7 min

How to Fix Git 'Detached HEAD' State

Linux21 min

Linux Firewall with ufw: Full Tutorial for Beginners

Go (Golang)5 min

Golang defer Statements in 5 Minutes

Auth (OAuth, JWT)9 min

How to Fix OAuth 'invalid_grant' Errors

Databases & SQL11 min

The SQL Roadmap for Beginners

Go (Golang)5 min

Golang make() for Slices and Maps in 5 Minutes

Networking7 min

How to Fix Network 'No Route to Host' Errors on Linux

Linux6 min

How to Fix Linux 'Too Many Open Files' Errors

Django (Python web framework)11 min

Every Django Concept a Beginner Needs to Know

Linux24 min

SSH on Linux: Full Tutorial for Beginners

Go (Golang)5 min

Golang for range Loops in 5 Minutes

Databases & SQL10 min

SQL Databases: SQLite vs PostgreSQL

Go (Golang)5 min

Golang Structs in 5 Minutes

Caching & Redis22 min

Redis: Full Tutorial for Beginners

Go (Golang)5 min

Golang context.Context in 5 Minutes

Databases & SQL7 min

How to Fix MySQL Database Error 1045: Access Denied for User

Go (Golang)5 min

Golang Method Receivers in 5 Minutes

Python8 min

How to Fix Python SSL: CERTIFICATE_VERIFY_FAILED Errors

Django (Python web framework)9 min

How to Fix Django Static Files Not Loading in Production

OpenRouter (one API for many AI models)8 min

OpenRouter vs Direct API Keys: Which One Should You Use?

Go (Golang)5 min

Golang if err != nil Checks in 5 Minutes

Go (Golang)8 min

How to Fix Golang 'go.mod File Not Found' Errors

AI agents & MCP22 min

MCP Servers: Full Tutorial for Beginners

Go (Golang)5 min

Golang Error Return Values in 5 Minutes

Python8 min

How to Fix Python ModuleNotFoundError: No Module Named

Go (Golang)5 min

Golang Pointers in 5 Minutes

Kubernetes8 min

How to Fix a Kubernetes Pod Stuck in CrashLoopBackOff

Homelab & self-hosting9 min

How to Fix a Homelab ESXi Host Not Responding

PostgreSQL24 min

PostgreSQL: Full Tutorial for Beginners

Load balancing & Nginx9 min

How a Load Balancer Works with HAProxy

Python9 min

How Python Virtual Environments Work

Homelab & self-hosting9 min

How to Fix Cloudflare Tunnel Errors in a Homelab

APIs9 min

How to Fix API CORS Errors: No 'Access-Control-Allow-Origin'

Auth (OAuth, JWT)9 min

How Authenticator App Login Codes Work (TOTP)

Git22 min

Git and GitHub: Full Tutorial for Beginners

Homelab & self-hosting10 min

How a Homelab Hypervisor Works (VMware ESXi)

Kubernetes9 min

How to Fix Kubernetes ImagePullBackOff Errors

DNS8 min

How to Fix DNS 'Temporary Failure in Name Resolution' on Linux

AWS8 min

How to Fix AWS CLI 'Unable to Locate Credentials'

Homelab & self-hosting10 min

Proxmox vs ESXi for Your Homelab: When Each One Wins

PostgreSQL10 min

PostgreSQL UUID vs Auto Increment: Which Primary Key Should You Use?

Kubernetes21 min

Kubernetes: Full Tutorial for Beginners

Networking9 min

How TCP Sockets Work

PostgreSQL7 min

How to Fix PostgreSQL 'Could Not Connect to Server'

Claude & the Claude Developer Platform9 min

Claude Code Hooks Will Finally Make Sense After This

DevOps & CI/CD9 min

DevOps with Ansible Will Finally Make Sense After This

Networking9 min

How SNMP Network Monitoring Works

Git8 min

How to Fix GitHub 'Permission Denied (publickey)' Errors

Docker21 min

Docker: Full Tutorial for Beginners

PostgreSQL7 min

How to Fix PostgreSQL 'Password Authentication Failed'

Linux8 min

Why One Linux Server Handles More Users Than You Think

Networking7 min

How to Fix Network 'Connection Refused' Errors

DevOps & CI/CD9 min

DevOps Pipelines: Jenkins vs GitHub Actions

Linux11 min

Linux Nginx Reverse Proxy: Full Tutorial for Beginners

Networking11 min

Every Networking Term a Beginner Needs in 12 Minutes

Docker6 min

How to Fix Docker 'Permission Denied' on docker.sock

Git7 min

How to Fix Git 'Updates Were Rejected' When You Push

Linux7 min

How to Fix nginx 502 Bad Gateway Errors on Linux

Linux8 min

How to Fix Linux apt 'Could Not Get Lock' Errors (Ubuntu)

Networking9 min

How Email Works on the Internet (SMTP) in 10 Minutes

Python8 min

The Python Roadmap for Beginners

Go (Golang)21 min

Golang REST API with Gin: Full Tutorial for Beginners

Networking10 min

How a WireGuard VPN Network Works

Linux9 min

Linux Makefiles Will Finally Make Sense After This

Auth (OAuth, JWT)9 min

SAML vs OAuth vs OpenID Connect: What's the Difference?

Python7 min

How to Fix Python cron Jobs That Never Run

Linux22 min

Linux Bash Scripting: Full Tutorial for Beginners

Networking10 min

How PXE Network Boot Works

Active Directory9 min

How Active Directory Works

Linux10 min

How to Fix a Linux systemd Service That Won't Start

Linux9 min

Linux Logs: syslog vs journald

Auth (OAuth, JWT)9 min

JWT vs Session Cookies: Which One Should You Use?

Docker10 min

Docker vs Docker Compose: Which One Should You Use?

Docker9 min

How to Fix Docker Compose Containers That Can't Talk to Each Other

Django (Python web framework)22 min

Django Full Tutorial for Beginners

Linux9 min

How Linux systemd Works

Networking8 min

How to Fix 'Windows Cannot Access' Network Share Errors (SMB)

APIs10 min

REST vs gRPC: Which One Should You Use?

Certificates & PKI (ADCS)9 min

How to Fix SSL Certificate Chain Errors (Missing Intermediate)

Python9 min

Every Python Concept for Beginners in 10 Minutes

Databases & SQL9 min

Every SQL Join Type in 10 Minutes

OpenRouter (one API for many AI models)9 min

Why OpenRouter Free Models Hit Their Limit So Fast

Gemini API & Google AI Studio9 min

Why Your Gemini API Free Tier Runs Out So Fast

OpenRouter (one API for many AI models)10 min

OpenRouter Will Finally Make Sense After This

Caching & Redis10 min

How Redis Caching Works

Gemini API & Google AI Studio10 min

Gemini API vs Vertex AI: Which One Should You Use?

Gemini API & Google AI Studio8 min

How to Fix a Leaked Gemini API Key

Go (Golang)9 min

Why Golang Uses Goroutines Instead of Threads

Gemini API & Google AI Studio9 min

How to Fix Gemini API Error 429: Resource Exhausted

Claude & the Claude Developer Platform10 min

Claude Token Pricing Will Finally Make Sense After This

Python11 min

Why Python Web Scraping Returns Nothing (and the Fix)

Python10 min

Python uv vs pip: Which One Should You Use?

Python22 min

Python Automation: Full Tutorial for Beginners

Auth (OAuth, JWT)9 min

How OAuth Login Works

Gemini API & Google AI Studio10 min

Google AI Studio Will Finally Make Sense After This

Docker10 min

What Happens When You Run a Docker Container

Claude & the Claude Developer Platform8 min

How to Fix Claude Code Billing Your API Key Instead of Your Plan

Auth (OAuth, JWT)9 min

Why Passkeys Can't Be Phished Like Passwords

PowerShell10 min

PowerShell vs Bash: Which One Should You Learn?

Linux10 min

The Linux Roadmap for Beginners

Django (Python web framework)9 min

Django vs FastAPI: Which One Should You Use?

Databases & SQL10 min

Why SQLite Is the Most Used Database in the World

Databases & SQL11 min

How a NoSQL Database Like MongoDB Works

Python11 min

How to Fix Python pip error: externally-managed-environment

Databases & SQL9 min

How to Fix MySQL Too Many Connections Database Errors

Go (Golang)9 min

Golang Concurrency Will Finally Make Sense After This

AWS10 min

How Amazon S3 Works

Kubernetes10 min

How Kubernetes Works

Git10 min

How Git Works

Docker10 min

How to Fix Docker Port Already Allocated Errors

PostgreSQL10 min

How PostgreSQL Works

Git8 min

How to Fix Git Merge Conflicts

Linux9 min

How to Fix No Space Left on Device in Linux

Networking10 min

How the Internet Works

Databases & SQL9 min

SQL vs NoSQL: When Each One Wins

Auth (OAuth, JWT)8 min

How to Fix JWT Token Expired Errors (401 Unauthorized)

Claude & the Claude Developer Platform9 min

Claude API vs Claude Pro: Why Your Subscription Doesn't Include It

AI agent skills9 min

Why AI Agent Skills Beat Giant Prompts

Linux10 min

Linux Cron Jobs Will Finally Make Sense After This

Cybersecurity10 min

Security Logs Will Finally Make Sense After This

Cybersecurity8 min

How to Fix a Security Leak: An API Key Pushed to GitHub

DNS9 min

DNS Will Finally Make Sense After This

Cybersecurity9 min

Never Ignore a Security Update

Auth (OAuth, JWT)9 min

Two-Factor Authentication Will Finally Make Sense

Networking8 min

Never Expose a Database to the Internet

Cybersecurity10 min

SSH Keys vs Passwords: Which Is Safer for Security?

Linux10 min

The 5 Levels of Linux Boot: From Power On to Login

Networking12 min

The 5 Levels of Network Firewalls

Cybersecurity10 min

Password Security: Why Hackers Crack Weak Passwords

Linux9 min

Why Your Linux Server Runs Out of Memory

Networking10 min

HTTP vs HTTPS: What Actually Changes on Your Network

Linux12 min

Every Linux File Permission You Need to Know

Linux10 min

Linux Processes vs Threads: When Each One Wins

Networking11 min

The OSI Model Will Finally Make Sense After This

Git11 min

The 7 Levels of Git

Networking10 min

Every Network Troubleshooting Command You Need

Cybersecurity10 min

Hashing vs Encryption in Cybersecurity: When Each One Wins

Networking11 min

Why the Internet Ran Out of IP Addresses

Linux11 min

Linux Package Managers: apt vs Snap vs Flatpak

Python9 min

Why Python Is Slow (and When It Doesn't Matter)

Networking11 min

TCP vs UDP: When Each One Wins

Linux8 min

Stop Running Linux as Root (Do This Instead)

Linux11 min

Linux Users and Groups Will Finally Make Sense

Cybersecurity9 min

Why Phishing Beats Good Security (and How to Spot It)

Docker12 min

The 7 Levels of Docker

AI agents & MCP12 min

AI Agents Will Finally Make Sense After This

Git8 min

Stop Using git push --force (Use This Instead)

AI agent skills10 min

Agent Skills vs MCP: When Each One Wins

Networking12 min

Networking Will Finally Make Sense After This

Linux12 min

Every Linux Command You Actually Need

Cybersecurity12 min

The 7 Levels of Cybersecurity

System design12 min

Every System Design Concept You Need, in One Diagram

PostgreSQL10 min

Why PostgreSQL Ignores Your Index