What is django-admin and manage.py?

Both -django-admin and manage.py are the command-line tools that Django offers for operating and interacting with Django projects.

The --django-admin tool

The command-line utility tool for administrative tasks is called django-admin. It performs administrative tasks related to Django, such as starting a Django project or creating a new Django app. It can also execute management commands offered by Django or third-party packages.

However, Django must be installed globally for django-admin to be accessible from anywhere on your system.

The manage.py tool

Similarly, manage.py is also a command-line utility for Django projects. When you use the startproject command, each Django project includes a Python script called manage.py file that is generated automatically. It is placed in the root directory of the current project. It serves the same function as django-admin and sets the DJANGO_SETTINGS_MODULE environment variable to point to the project’s settings.py file.

It is used for many different tasks, like:

  • Running the development server

  • Doing database migrations

  • Running tests

  • Running management project-specific commands for your Django project

Unlike django-admin, manage.py is designed to be executed from within the project directory.

Some –django-admin commands

Django provides several django-admin commands that can be used to manage Django projects and perform various administrative tasks. Besides, you can create your own custom management commands to perform specific tasks unique to your Django project.

Here are some commonly used django-admin and manage.py commands:

  • startproject: Creates a new Django project.

django-admin startproject project_name
  • version: Checks the Django version installed on your system.

django-admin version
  • makemessages: Generates a message file.

django-admin makemessages
  • runserver: Starts a lightweight Web server on your system for development. The default server runs on port 8000 on the IP address 127.0.0.1.

django-admin runserver
  • startapp: Creates a new Django app within a project.

python manage.py startapp app_name
  • runserver: Starts the development server for the Django project.

python manage.py runserver
  • makemigrations: Generates database migration files based on changes in models.

python manage.py makemigrations
  • migrate: Applies pending database migrations.

python manage.py migrate
  • createsuperuser: Creates a superuser for the Django admin interface.

python manage.py createsuperuser
  • collectstatic: Collects static files from all installed apps into a single location.

python manage.py collectstatic
  • test: Runs the tests for the Django project.

python manage.py test
  • shell: Opens a Python interactive shell with the Django project’s environment loaded.

python manage.py shell
  • check: Performs a system check for common issues and errors in the Django project.

python manage.py check

Note: You can run django-admin help or python manage.py help to see a list of all available commands and their descriptions on your Linux terminal.

These are just a few examples of commands of command-line tools django-admin and manage.py. However, manage.py is typically used more frequently during development, as it provides project-specific functionality and is easily accessible within the project directory.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved