0
0
Djangoframework~5 mins

Development server and runserver in Django

Choose your learning style9 modes available
Introduction

The development server lets you see your Django website while you build it. It runs your site on your computer so you can test and fix things easily.

When you want to check how your website looks and works during development.
When you need to test new features or changes before making the site live.
When you want to quickly see error messages and debug your code.
When you are learning Django and want to try out code changes immediately.
When you want to share your local site temporarily on your network.
Syntax
Django
python manage.py runserver [optional_port]

You run this command in your project folder where manage.py is located.

If you don't give a port, it uses 8000 by default (like http://127.0.0.1:8000/).

Examples
Starts the server on the default address and port (127.0.0.1:8000).
Django
python manage.py runserver
Starts the server on port 8080 instead of 8000.
Django
python manage.py runserver 8080
Makes the server available on all network interfaces, so others on your network can access it.
Django
python manage.py runserver 0.0.0.0:8000
Sample Program

This command starts the Django development server on your local machine at http://127.0.0.1:8000/. You can open this address in your browser to see your website as you build it.

Django
python manage.py runserver
OutputSuccess
Important Notes

The development server is for testing only. It is not secure or fast enough for real users.

If you change your code, the server reloads automatically so you see updates right away.

Use CONTROL-C in the terminal to stop the server when you are done.

Summary

The runserver command starts a simple web server on your computer.

It helps you see and test your Django site during development.

You can choose the port and make it accessible on your network if needed.