LinuxCommandLibrary

django-admin

Django command-line utility for administrative tasks

TLDR

Start a new project

$ django-admin startproject [project_name]
copy
Start a new app
$ django-admin startapp [app_name]
copy
Run development server
$ django-admin runserver
copy
Create database migrations
$ django-admin makemigrations
copy
Apply database migrations
$ django-admin migrate
copy
Create superuser
$ django-admin createsuperuser
copy
Open Django shell
$ django-admin shell
copy

SYNOPSIS

django-admin command [options]

DESCRIPTION

django-admin is Django's command-line utility for administrative tasks. It provides commands for project setup, database management, testing, and development server operation.
The tool requires a Django settings module to function. When inside a project directory, it automatically discovers the settings; otherwise, the DJANGOSETTINGSMODULE environment variable or --settings flag specifies the configuration.
django-admin is typically aliased or replaced by manage.py within projects, which automatically configures the settings module. Both provide identical functionality.

PARAMETERS

COMMAND

Django management command to execute.
startproject NAME
Create new Django project.
startapp NAME
Create new Django app.
runserver [PORT]
Run development server.
makemigrations [APP]
Create migration files.
migrate [APP]
Apply migrations.
createsuperuser
Create admin user.
shell
Open interactive Python shell with Django context.
--settings MODULE
Settings module to use.
--help
Display help information.

CONFIGURATION

settings.py

Django project settings module controlling database, installed apps, middleware, and all configuration.
manage.py
Project-specific wrapper around django-admin that sets the settings module automatically.

CAVEATS

Requires Django installed. Some commands require configured settings and database. Development server not suitable for production. Migration commands require database access.

HISTORY

django-admin is part of Django, created by Adrian Holovaty and Simon Willison at the Lawrence Journal-World newspaper. Django was released as open source in 2005 and has become one of the most popular Python web frameworks.

SEE ALSO

python(1), pip(1), manage.py(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community