0
0
Djangoframework~20 mins

Creating a Django project - Practice Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Django Project Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
1:30remaining
What is the correct command to create a new Django project named 'myapp'?
Choose the command that correctly creates a new Django project called myapp.
Adjango-admin newproject myapp
Bdjango-admin createproject myapp
Cdjango-admin startproject myapp
Ddjango-admin initproject myapp
Attempts:
2 left
💡 Hint
The official Django command to start a project uses the word 'startproject'.
component_behavior
intermediate
1:30remaining
What happens when you run 'python manage.py runserver' inside a Django project?
Select the correct description of what the command python manage.py runserver does inside a Django project directory.
ACompiles Django templates into static HTML files.
BStarts a local web server to serve the Django application for development.
CCreates a new Django app inside the project.
DDeploys the Django project to a live production server.
Attempts:
2 left
💡 Hint
Think about what you need to do to see your Django site in a browser during development.
🔧 Debug
advanced
2:00remaining
Why does this command fail? django-admin startproject myproject .
You run the command django-admin startproject myproject . inside an existing directory but get an error. What is the most likely cause?
AThe current directory is not empty, so Django refuses to create the project here.
BThe dot (.) at the end is invalid syntax for this command.
CYou must run the command outside any directory to create a project.
DThe project name cannot be 'myproject' because it conflicts with a Python module.
Attempts:
2 left
💡 Hint
Django expects an empty directory or a new directory for the project files.
state_output
advanced
2:00remaining
After creating a Django project, what files are generated inside the project directory?
You run django-admin startproject mysite. Which of the following lists the files and folders you will find inside the mysite directory?
AAn apps folder with all Django apps pre-created
BOnly a manage.py file and a templates folder
CA single mysite.py file with all settings and URLs
Dmanage.py file and a subdirectory named mysite containing __init__.py, settings.py, urls.py, and wsgi.py
Attempts:
2 left
💡 Hint
Think about the default structure Django creates for a new project.
🧠 Conceptual
expert
2:30remaining
What is the purpose of the 'manage.py' file in a Django project?
Choose the best explanation of what the manage.py file does in a Django project.
AIt is a command-line utility that lets you interact with the Django project for tasks like running the server and migrations.
BIt compiles static files like CSS and JavaScript for deployment.
CIt stores the database configuration and credentials.
DIt contains the main application logic and routes HTTP requests.
Attempts:
2 left
💡 Hint
Think about how you run commands like 'runserver' or 'migrate' in Django.