https://dev.to/ericchapman/my-beloved-django-cheat-sheet-2056

Amount of flashcards: 48

What is Django?

Django is a high-level Python web framework that enables the rapid development of secure and maintainable websites.

What is the latest version of Django?

The latest version of Django is 3.2.

What is the command to create a new Django project?

The command to create a new Django project is 'django-admin startproject projectname'.

What is the command to create a new Django app?

The command to create a new Django app is 'python manage.py startapp appname'.

What is the purpose of the 'settings.py' file in a Django project?

The 'settings.py' file contains all the settings for a Django project, such as database configuration, installed apps, and middleware.

What is the purpose of the 'urls.py' file in a Django app?

The 'urls.py' file contains the URL patterns for a Django app, which map URLs to views.

What is a view in Django?

A view is a Python function that takes a web request and returns a web response.

What is a model in Django?

A model is a Python class that represents a database table, and is used to interact with the database.

What is a migration in Django?

A migration is a Python file that contains instructions for changing the database schema, and is used to keep the database schema in sync with the models.

What is the command to create a new migration?

The command to create a new migration is 'python manage.py makemigrations'.

What is the command to apply migrations to the database?

The command to apply migrations to the database is 'python manage.py migrate'.

What is the purpose of the 'admin.py' file in a Django app?

The 'admin.py' file is used to register models with the Django admin site, which provides a web-based interface for managing the database.

Prev

1 out of 4

Next
© 2023 - Present Flashio. All rights reserved.