TOP>programming>Python>Django

Django command list with manage.py shell

  • Can be run as a cronjob or directly to clean out old data from the database (only expired sessions at the moment).
$ python manage.py cleanup
  • Compiles .po files to .mo files for use with builtin gettext support.
$ python manage.py compilemessages
  • Creates the table needed to use the SQL cache backend.
$ python manage.py createcachetable
  • Used to create a superuser.
$ python manage.py createsuperuser
  • Runs the command-line client for the current DATABASE_ENGINE.
$ python manage.py dbshell
  • Displays differences between the current settings.py and Django's default settings. Settings that don't appear in the defaults are followed by "###".
$ python manage.py diffsettings
  • Output the contents of the database as a fixture of the given format.
$ python manage.py dumpdata
  • Executes ``sqlflush`` on the current database.
$ python manage.py flush
  • Introspects the database tables in the given database and outputs a Django model module.
$ python manage.py inspectdb
  • Installs the named fixture(s) in the database.
$ python manage.py 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/locale (in the django tree) or locale (for project and application) directory.
$ python manage.py makemessages
  • Executes ``sqlreset`` for the given app(s) in the current database.
$ python manage.py reset
$ python manage.py runfcgi
  • tarts a lightweight Web server for development.
$ python manage.py runserver
  • Runs a Python interactive interpreter. Tries to use IPython, if it's available.
$ python manage.py shell
  • Prints the CREATE TABLE SQL statements for the given app name(s).
$ python manage.py sql
  • Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).
$ python manage.py sqlall

$ python manage.py

  • Prints the DROP TABLE SQL statements for the given app name(s).
$ python manage.py sqlclear
  • Prints the custom table modifying SQL statements for the given app name(s).
$ python manage.py sqlcustom
  • 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.
$ python manage.py sqlflush
  • Prints the CREATE INDEX SQL statements for the given model module name(s).
$ python manage.py sqlindexes
  • RENAMED: see 'sqlcustom'
$ python manage.py sqlinitialdata
  • Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).
$ python manage.py sqlreset
  • Prints the SQL statements for resetting sequences for the given app name(s).
$ python manage.py sqlsequencereset
  • Creates a Django app directory structure for the given app name in this project's directory.
$ python manage.py startapp
  • Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created.
$ python manage.py syncdb
  • Runs the test suite for the specified applications, or the entire site if no apps are specified.
$ python manage.py test
  • Runs a development server with data from the given fixture(s).
$ python manage.py testserver
  • Validates all installed models.
$ python manage.py validate
 add this entry to hatena bookmark add this entry to livedoor clip add this entry to yahoo bookmark add this entry to del.icio.us add this entry to google bookmark
[ Create | Edit | Delete | Freeze ]    [ Recent | History | Help ]