Run The Development Server

Start the local dev server with manage.py runserver, change host and port, use auto-reload, and fix common issues like port conflicts or DisallowedHost errors.

1. Introduction

In this guide we will start Django's built-in development server and open our project in the browser for the first time. The development server is a lightweight server that comes with Django — you do not need to install anything extra.

  • Your Django project must already be created. If not, see Create First Project.
  • Your .venv must be active and Django 5.2 installed.
  • You must be inside your project folder — the one that contains manage.py.

2. Start the server

With your .venv active, run this command from your project folder:

python manage.py runserver

You will see output like this:

Watching 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.

May 07, 2026 - 10:00:00
Django version 5.2, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Open your browser and go to http://127.0.0.1:8000/. You should see the Django welcome page with a rocket icon.

3. Auto-reload

The development server watches your project files for changes. When you edit and save a Python file, the server restarts itself automatically. You do not need to stop and start it manually every time you make a change.

The only files that do not trigger a reload are template files and static files in some configurations. For those, a manual browser refresh is enough.

4. Change the host and port

By default the server runs on 127.0.0.1:8000. You can change the port if something else is already using 8000:

# Run on port 8080
python manage.py runserver 8080

# Run on a specific IP and port
python manage.py runserver 0.0.0.0:8000

Using 0.0.0.0:8000 makes the server accessible from other devices on your local network — useful for testing on a phone or tablet. If you do this, add your machine's local IP address to ALLOWED_HOSTS in settings.py first.

5. Fix the DisallowedHost error

If you see a DisallowedHost error when opening the browser, it means the hostname you are using is not in Django's ALLOWED_HOSTS setting. This happens when you access the server using a hostname other than 127.0.0.1 or localhost.

To fix it, open mysite/settings.py and add the hostname:

# mysite/settings.py
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '192.168.1.x']

Replace 192.168.1.x with your actual local IP address. During development with DEBUG = True, Django is more forgiving, but it is a good habit to keep ALLOWED_HOSTS accurate.

6. Stop the server

To stop the development server, press CONTROL-C in your terminal. The server shuts down immediately.

You can restart it at any time by running python manage.py runserver again from the same folder with your .venv active.

7. Development server limitations

The development server is designed for development only. Do not use it in production.

  • It handles one request at a time — it cannot handle real traffic.
  • It has not been through security audits — it is not safe to expose to the internet.
  • It does not serve static files efficiently — a real web server handles this much better.

8. Next steps

The server is running and your project is live in the browser. The next step is to create your first Django app — a self-contained module inside your project where you will write your first view and URL.


Never miss a story on Django.wiki

Subscribe for fresh tutorials, snippets, and updates.

By subscribing you agree to our Privacy Policy.