Skip to content

Instantly share code, notes, and snippets.

@TechRancher
Created July 25, 2020 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TechRancher/1b7f25a694449f1dcea61ee4992aa669 to your computer and use it in GitHub Desktop.
Save TechRancher/1b7f25a694449f1dcea61ee4992aa669 to your computer and use it in GitHub Desktop.
Django-admin Command List

Django-Admin Command List

This is a list of the different django-admin commands

# Allows changing a user's password. It prompts you to enter a new password twice for the given user.
django-admin changepassword <username>

# Checks the entire django project of potential problems
django-admin check

# Can be ran as a cron job or directly to clean out expired sessions.
django-admin clearsessions

# Helps to collect all the static files in the one mentioned director
django-admin collectstatic

# Compiles .po files to .mo files for use with builtin gettext support
django-admin compilemessages

# Creates the tables needed to use the SQL cache backend.
django-admin createcachetable

# Creates a superuser account (a user who has all permissions)
django-admin createsuperuser

# Run the command-line client for specified database, or the default database if none is provided.
django-admin dbshell

# Displays differences between the current settings.py and Django's default settings.
django-admin diffsettings

# Output the contents of the database as a fixture of the given format (using each model's default manager unless --all is specified).
django-admin dumpdata

# Removes **ALL DATA** from the database, including data add during migrations. Does not achieve a "fresh install" state.
django-admin flush

# Display usage information and a list of the commands provided by each application
django-admin help

#Introspects the database tables in the given database and outputs a Django model module.
django-admin inspectdb

# Installs the named fixture(s) in the database.
django-admin loaddata

# Runs over the entire source tree of the current directory and pulls out all strings marked for translation. It creates (or updates) a message file in the conf/local (in the django tree) or local (for projects and applications) directory. You must run this command with one of either the --locale, --exclude, or --all options.
django-admin makemessages

# Create new migrations to the database based on the changes detected in the models
django-admin makemigrations

# Synchronize the database state with your current state project models and migrations
django-admin migrate

# Deletes stale content types (from deleted models) in your database.y.
django-admin remove_stale_contenttypes

# Start the development webserver at 127.0.0.1 with the port 8000
django-admin runserver

# Sends a test email to the email addresses specified as arguments.
django-admin sendtestemail

# Runs a Python interactive interpreter. Tries to use IPython or bpython, if one of them is available. Any standard input is executed as code.
django-admin shell

# Shows all available migrations for the current project.
django-admin showmigrations

# Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.
django-admin sqlflush

# Prints the SQL statements for the named migrations.
django-admin sqlmigrate

# Prints the SQL statemets for resetting sequences for the given app name(s).
django-admin sqlsequencereset

# Squashes an existing set of migrations (from first until specified) into a single new one.
django-admin squashmigrations

# Create a new django application with the specified name.
django-admin startapp <Appname>

# Create a new project directory structure.
django-admin startproject <Project Name>

# Runs a development server with data from the given fixture(s).
django-admin testserver

# Display the current django version
django-admin version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment