0
0
Djangoframework~5 mins

Development server and runserver in Django - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of Django's runserver command?
The runserver command starts a lightweight development server that lets you see your Django app in action on your local machine. It helps you test and develop your app without needing a full web server setup.
Click to reveal answer
beginner
How do you start the Django development server on the default port?
You run the command python manage.py runserver in your project folder. This starts the server on http://127.0.0.1:8000/ by default.
Click to reveal answer
beginner
Can you change the port number when running Django's development server? How?
Yes, you can specify a different port by adding it after the command, like python manage.py runserver 8080. This starts the server on port 8080 instead of the default 8000.
Click to reveal answer
intermediate
Why should you not use Django's development server in a production environment?
The development server is simple and not designed for security or performance. It can crash easily and is not safe for real users. For production, use a proper web server like Gunicorn or Apache.
Click to reveal answer
beginner
What happens when you save changes to your Django code while the development server is running?
The development server automatically reloads your app to show the changes immediately. This makes development faster because you don't have to stop and start the server manually.
Click to reveal answer
What command starts the Django development server?
Apython manage.py runserver
Bdjango startserver
Cpython runserver.py
Dmanage.py startserver
By default, on which port does Django's development server run?
A8080
B3000
C80
D8000
Which of these is NOT a reason to avoid using Django's development server in production?
AIt lacks security features
BIt automatically reloads on code changes
CIt is not optimized for performance
DIt can crash easily under heavy load
How can you specify a custom port when running the Django development server?
Apython manage.py runserver -p 9000
Bpython manage.py runserver --port=9000
Cpython manage.py runserver 9000
Dpython manage.py runserver port 9000
What URL do you visit in your browser to see your Django app running on the default development server?
Ahttp://127.0.0.1:8000
Bhttp://localhost:3000
Chttp://localhost:80
Dhttp://0.0.0.0:8000
Explain how to start the Django development server and how to change its port.
Think about the command line steps and default settings.
You got /3 concepts.
    Why is Django's development server not suitable for production use?
    Consider what a production server needs that the development server lacks.
    You got /4 concepts.