How To Run Django Development Server

How To Run Django Development Server

Once you have a new Django project set up and understand the basic file structure, you can begin working with the builtin Django development server. The Django development server provides a wonderful local development server that developers can leverage to preview code updates and test features of the Django-powered website. There is no need to worry about configuring a virtual machine, or configuring Docker, though you could go that route if you choose. Many times, the very convenient can capable Django development server will be enough to get up and running with the basics. In this tutorial, we’ll learn a little bit about the local development server in Django.

The built-in development server is part of what the file offers in any Django Project. To run the development server you’ll want to navigate to the project directory that holds your Django project. This can be done right from Visual Studio code if you like by clicking Terminal-> New Terminal like so.

Django terminal from visual studio code

You’ll notice the new area that shows an integrated terminal right inside of Visual Studio Code where you can type commands.

vs code terminal django

python runserver

At the terminal, we can run a special command using the syntax: python runserver

What this does is use the Python installation on your machine to run the file from the terminal, while also specifying a sub-command of runserver. The runserver command is a built-in subcommand of Django’s file that will start up a development server for this specific Django project. Let’s go ahead and run this command now.

myproject $python runserver
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 migrate' to apply them.
June 07, 2021 - 16:43:35
Django version 3.2.4, using settings 'myproject.settings'
Starting development server at
Quit the server with CTRL-BREAK.

The output in the terminal confirms that an HTTP server is in fact now running on port 8000 for the loopback IP address ( To confirm this, we can point our web browser to this address and we should see a welcome page for the Django web framework as we see here.

django running development server

Terminal Debug Feedback

When we use a web browser to make requests to the local development server, we can look at the terminal to see valuable feedback about what is happening in the application. Below we see the output which shows a series of GET requests to render the welcoming Django webpage.

[07/Jun/2021 16:46:26] "GET / HTTP/1.1" 200 10697
[07/Jun/2021 16:46:27] "GET /static/admin/css/fonts.css HTTP/1.1" 200 423
[07/Jun/2021 16:46:27] "GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1" 200 86184
[07/Jun/2021 16:46:27] "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 85692
Not Found: /favicon.ico
[07/Jun/2021 16:46:27] "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 85876

New Sqlite File

When running the Django development server for the first time, a new file will be created in the Django project directory with the name of db.sqlite3. This is a new file that holds the database for an SQLite installation. SQLite is a software library that provides a relational database management system that is lightweight in terms of setup, database administration, and required resources. SQLite is self-contained, serverless, has zero configuration, and is transactional. This makes it perfect for building applications locally, and may even be used on smaller-scale production websites. We can see this newly created file in Visual Studio Code.

sqlite file created during runserver django

As we begin working on a new Django Project, we will be able to change the URL in the web browser to preview and test the functionality of those new pages. The development server is an ongoing process and will continue to run until you manually quit the process. To do so, you would need to type CTRL and C at the terminal then press Enter to make the server stop.

Learn More About How To Run Django Development Server