Forrest logo
back to the django-admin tool

django-admin:tldr:026df

django-admin: Create a new app for the current project.
$ django-admin startapp ${app_name}
try on your machine

The "django-admin startapp" command is used to create a new Django app in a Django project.

Here, the "${app_name}" placeholder represents the name you choose for your app. When running the command, you need to replace "${app_name}" with the actual name you want to give to your app. For example, if you want to create an app named "myapp", you would run:

django-admin startapp myapp

This command will create a new directory named "myapp" with the necessary files and folders for a Django app. The structure of the new app directory will be as follows:

  • myapp/
    • init.py
    • admin.py
    • apps.py
    • migrations/
    • init.py
    • models.py
    • tests.py
    • views.py

These files and folders are used for different purposes in a Django app. For instance, "models.py" is where you define your app's database models, "views.py" contains the views (functions or class-based views) that handle the HTTP requests and responses, and "admin.py" is where you can register your app's models to be managed through the Django admin site. There are also files for handling app-specific migrations, tests, and more.

Overall, the "django-admin startapp" command helps you bootstrap the creation of a new app in your Django project by generating the necessary files and folders to get started.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the django-admin tool