~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to docs/ref/django-admin.txt

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2010-05-21 07:52:55 UTC
  • mfrom: (1.3.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20100521075255-ii78v1dyfmyu3uzx
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
Displaying debug output
79
79
-----------------------
80
80
 
81
 
.. django-admin-option:: --verbosity <amount>
82
 
 
83
 
Use ``--verbosity`` to specify the amount of notification and debug information
 
81
Use :djadminopt:`--verbosity` to specify the amount of notification and debug information
84
82
that ``django-admin.py`` should print to the console. For more details, see the
85
 
documentation for the :ref:`default options for django-admin.py <django-admin-verbosity>`.
 
83
documentation for the :djadminopt:`--verbosity` option.
86
84
 
87
85
Available subcommands
88
86
=====================
90
88
cleanup
91
89
-------
92
90
 
 
91
.. django-admin:: cleanup
 
92
 
93
93
.. versionadded:: 1.0
94
94
 
95
95
Can be run as a cronjob or directly to clean out old data from the database
98
98
compilemessages
99
99
---------------
100
100
 
 
101
.. django-admin:: compilemessages
 
102
 
101
103
.. versionchanged:: 1.0
102
104
   Before 1.0 this was the "bin/compile-messages.py" command.
103
105
 
104
106
Compiles .po files created with ``makemessages`` to .mo files for use with
105
107
the builtin gettext support. See :ref:`topics-i18n`.
106
108
 
107
 
--locale
108
 
~~~~~~~~
109
 
 
110
 
Use the ``--locale`` or ``-l`` option to specify the locale to process.
111
 
If not provided all locales are processed.
 
109
Use the :djadminopt:`--locale`` option to specify the locale to process.
 
110
If not provided, all locales are processed.
112
111
 
113
112
Example usage::
114
113
 
117
116
createcachetable
118
117
----------------
119
118
 
120
 
.. django-admin:: createcachetable <tablename>
 
119
.. django-admin:: createcachetable
121
120
 
122
121
Creates a cache table named ``tablename`` for use with the database cache
123
122
backend. See :ref:`topics-cache` for more information.
124
123
 
 
124
.. versionadded:: 1.2
 
125
 
 
126
The :djadminopt:`--database` option can be used to specify the database
 
127
onto which the cachetable will be installed.
 
128
 
125
129
createsuperuser
126
130
---------------
127
131
 
156
160
.. django-admin:: dbshell
157
161
 
158
162
Runs the command-line client for the database engine specified in your
159
 
``DATABASE_ENGINE`` setting, with the connection parameters specified in your
160
 
``DATABASE_USER``, ``DATABASE_PASSWORD``, etc., settings.
 
163
``ENGINE`` setting, with the connection parameters specified in your
 
164
``USER``, ``PASSWORD``, etc., settings.
161
165
 
162
166
    * For PostgreSQL, this runs the ``psql`` command-line client.
163
167
    * For MySQL, this runs the ``mysql`` command-line client.
168
172
the right place. There's no way to specify the location of the program
169
173
manually.
170
174
 
 
175
.. versionadded:: 1.2
 
176
 
 
177
The :djadminopt:`--database` option can be used to specify the database
 
178
onto which to open a shell.
 
179
 
 
180
 
171
181
diffsettings
172
182
------------
173
183
 
183
193
Note that Django's default settings live in ``django/conf/global_settings.py``,
184
194
if you're ever curious to see the full list of defaults.
185
195
 
186
 
dumpdata
187
 
--------
 
196
dumpdata <appname appname appname.Model ...>
 
197
--------------------------------------------
188
198
 
189
 
.. django-admin:: dumpdata <appname appname appname.Model ...>
 
199
.. django-admin:: dumpdata
190
200
 
191
201
Outputs to standard output all data in the database associated with the named
192
202
application(s).
200
210
the default manager and it filters some of the available records, not all of the
201
211
objects will be dumped.
202
212
 
203
 
.. django-admin-option:: --exclude
204
 
 
205
 
.. versionadded:: 1.0
206
 
 
207
 
Exclude a specific application from the applications whose contents is
208
 
output. For example, to specifically exclude the `auth` application from
209
 
the output, you would call::
210
 
 
211
 
    django-admin.py dumpdata --exclude=auth
212
 
 
213
 
If you want to exclude multiple applications, use multiple ``--exclude``
214
 
directives::
215
 
 
216
 
    django-admin.py dumpdata --exclude=auth --exclude=contenttypes
217
 
 
218
 
 
219
213
.. django-admin-option:: --format <fmt>
220
214
 
221
 
    By default, ``dumpdata`` will format its output in JSON, but you can use the
222
 
    ``--format`` option to specify another format. Currently supported formats
223
 
    are listed in :ref:`serialization-formats`.
 
215
By default, ``dumpdata`` will format its output in JSON, but you can use the
 
216
``--format`` option to specify another format. Currently supported formats
 
217
are listed in :ref:`serialization-formats`.
224
218
 
225
219
.. django-admin-option:: --indent <num>
226
220
 
227
 
    By default, ``dumpdata`` will output all data on a single line. This isn't
228
 
    easy for humans to read, so you can use the ``--indent`` option to
229
 
    pretty-print the output with a number of indentation spaces.
 
221
By default, ``dumpdata`` will output all data on a single line. This isn't
 
222
easy for humans to read, so you can use the ``--indent`` option to
 
223
pretty-print the output with a number of indentation spaces.
 
224
 
 
225
.. versionadded:: 1.0
 
226
 
 
227
The :djadminopt:`--exclude` option may be provided to prevent specific
 
228
applications from being dumped.
230
229
 
231
230
.. versionadded:: 1.1
232
231
 
236
235
rather than the entire application. You can also mix application names and
237
236
model names.
238
237
 
 
238
.. versionadded:: 1.2
 
239
 
 
240
The :djadminopt:`--database` option can be used to specify the database
 
241
onto which the data will be loaded.
 
242
 
 
243
.. django-admin-option:: --natural
 
244
 
 
245
.. versionadded:: 1.2
 
246
 
 
247
Use :ref:`natural keys <topics-serialization-natural-keys>` to represent
 
248
any foreign key and many-to-many relationship with a model that provides
 
249
a natural key definition. If you are dumping ``contrib.auth`` ``Permission``
 
250
objects or ``contrib.contenttypes`` ``ContentType`` objects, you should
 
251
probably be using this flag.
 
252
 
239
253
flush
240
254
-----
241
255
 
242
 
.. django-admin: flush
 
256
.. django-admin:: flush
243
257
 
244
258
Returns the database to the state it was in immediately after syncdb was
245
259
executed. This means that all data will be removed from the database, any
246
260
post-synchronization handlers will be re-executed, and the ``initial_data``
247
261
fixture will be re-installed.
248
262
 
249
 
.. django-admin-option:: --noinput
250
 
 
251
 
    Use the ``--noinput`` option to suppress all user prompting, such as "Are
252
 
    you sure?" confirmation messages. This is useful if ``django-admin.py`` is
253
 
    being executed as an unattended, automated script.
 
263
The :djadminopt:`--noinput` option may be provided to suppress all user
 
264
prompts.
 
265
 
 
266
.. versionadded:: 1.2
 
267
 
 
268
The :djadminopt:`--database` option may be used to specify the database
 
269
to flush.
 
270
 
254
271
 
255
272
inspectdb
256
273
---------
257
274
 
 
275
.. django-admin:: inspectdb
 
276
 
258
277
Introspects the database tables in the database pointed-to by the
259
 
``DATABASE_NAME`` setting and outputs a Django model module (a ``models.py``
 
278
``NAME`` setting and outputs a Django model module (a ``models.py``
260
279
file) to standard output.
261
280
 
262
281
Use this if you have a legacy database with which you'd like to use Django.
293
312
``inspectdb`` works with PostgreSQL, MySQL and SQLite. Foreign-key detection
294
313
only works in PostgreSQL and with certain types of MySQL tables.
295
314
 
 
315
.. versionadded:: 1.2
 
316
 
 
317
The :djadminopt:`--database` option may be used to specify the
 
318
database to introspect.
 
319
 
 
320
 
296
321
loaddata <fixture fixture ...>
297
322
------------------------------
298
323
 
 
324
.. django-admin:: loaddata
 
325
 
299
326
Searches for and loads the contents of the named fixture into the database.
300
327
 
 
328
.. versionadded:: 1.2
 
329
 
 
330
The :djadminopt:`--database` option can be used to specify the database
 
331
onto which the data will be loaded.
 
332
 
301
333
What's a "fixture"?
302
334
~~~~~~~~~~~~~~~~~~~
303
335
 
379
411
    references in your data files - MySQL doesn't provide a mechanism to
380
412
    defer checking of row constraints until a transaction is committed.
381
413
 
 
414
Database-specific fixtures
 
415
~~~~~~~~~~~~~~~~~~~~~~~~~~
 
416
 
 
417
If you are in a multi-database setup, you may have fixture data that
 
418
you want to load onto one database, but not onto another. In this
 
419
situation, you can add database identifier into . If your
 
420
:setting:`DATABASES` setting has a 'master' database defined, you can
 
421
define the fixture ``mydata.master.json`` or
 
422
``mydata.master.json.gz``. This fixture will only be loaded if you
 
423
have specified that you want to load data onto the ``master``
 
424
database.
 
425
 
382
426
makemessages
383
427
------------
384
428
 
 
429
.. django-admin:: makemessages
 
430
 
385
431
.. versionchanged:: 1.0
386
432
   Before 1.0 this was the ``bin/make-messages.py`` command.
387
433
 
392
438
with ``compilemessages`` for use with the builtin gettext support. See the
393
439
:ref:`i18n documentation <how-to-create-language-files>` for details.
394
440
 
395
 
--all
396
 
~~~~~
 
441
.. django-admin-option:: --all
397
442
 
398
443
Use the ``--all`` or ``-a`` option to update the message files for all
399
444
available languages.
402
447
 
403
448
    django-admin.py makemessages --all
404
449
 
405
 
--extension
406
 
~~~~~~~~~~~
 
450
.. django-admin-option:: --extension
407
451
 
408
452
Use the ``--extension`` or ``-e`` option to specify a list of file extensions
409
453
to examine (default: ".html").
416
460
 
417
461
    django-admin.py makemessages --locale=de --extension=html,txt --extension xml
418
462
 
419
 
--locale
420
 
~~~~~~~~
421
 
 
422
 
Use the ``--locale`` or ``-l`` option to specify the locale to process.
 
463
Use the :djadminopt:`--locale` option to specify the locale to process.
423
464
 
424
465
Example usage::
425
466
 
426
467
    django-admin.py makemessages --locale=br_PT
427
468
 
428
 
--domain
429
 
~~~~~~~~
 
469
.. django-admin-option:: --domain
430
470
 
431
471
Use the ``--domain`` or ``-d`` option to change the domain of the messages files.
432
472
Currently supported:
433
473
 
434
 
        * ``django`` for all ``*.py`` and ``*.html`` files (default)
435
 
        * ``djangojs`` for ``*.js`` files
436
 
 
437
 
.. _django-admin-reset:
 
474
    * ``django`` for all ``*.py`` and ``*.html`` files (default)
 
475
    * ``djangojs`` for ``*.js`` files
 
476
 
 
477
.. django-admin-option:: --symlinks
 
478
 
 
479
.. versionadded:: 1.2
 
480
 
 
481
Use the ``--symlinks`` or ``-s`` option to follow symlinks to directories when
 
482
looking for new translation strings.
 
483
 
 
484
Example usage::
 
485
 
 
486
    django-admin.py makemessages --locale=de --symlinks
 
487
 
 
488
.. django-admin-option:: --ignore
 
489
 
 
490
Use the ``--ignore`` or ``-i`` option to ignore files or directories matching
 
491
the given `glob-style pattern`_. Use multiple times to ignore more.
 
492
 
 
493
These patterns are used by default: ``'CVS'``, ``'.*'``, ``'*~'``
 
494
 
 
495
Example usage::
 
496
 
 
497
    django-admin.py makemessages --locale=en_US --ignore=apps/* --ignore=secret/*.html
 
498
 
 
499
.. _`glob-style pattern`: http://docs.python.org/library/glob.html
 
500
 
 
501
.. django-admin-option:: --no-default-ignore
 
502
 
 
503
Use the ``--no-default-ignore`` option to disable the default values of
 
504
:djadminopt:`--ignore`.
438
505
 
439
506
reset <appname appname ...>
440
507
---------------------------
441
508
 
 
509
.. django-admin:: reset
 
510
 
442
511
Executes the equivalent of ``sqlreset`` for the given app name(s).
443
512
 
444
 
--noinput
445
 
~~~~~~~~~
446
 
 
447
 
Use the ``--noinput`` option to suppress all user prompting, such as
448
 
"Are you sure?" confirmation messages. This is useful if ``django-admin.py``
449
 
is being executed as an unattended, automated script.
 
513
The :djadminopt:`--noinput` option may be provided to suppress all user
 
514
prompts.
 
515
 
 
516
.. versionadded:: 1.2
 
517
 
 
518
The :djadminopt:`--database` option can be used to specify the alias
 
519
of the database to reset.
450
520
 
451
521
runfcgi [options]
452
522
-----------------
453
523
 
 
524
.. django-admin:: runfcgi
 
525
 
454
526
Starts a set of FastCGI processes suitable for use with any Web server that
455
527
supports the FastCGI protocol. See the :ref:`FastCGI deployment documentation
456
528
<howto-deployment-fastcgi>` for details. Requires the Python FastCGI module from
458
530
 
459
531
.. _flup: http://www.saddi.com/software/flup/
460
532
 
461
 
runserver
462
 
---------
 
533
runserver [port or ipaddr:port]
 
534
-------------------------------
463
535
 
464
 
.. django-admin:: runserver [port or ipaddr:port]
 
536
.. django-admin:: runserver
465
537
 
466
538
Starts a lightweight development Web server on the local machine. By default,
467
539
the server runs on port 8000 on the IP address 127.0.0.1. You can pass in an
544
616
shell
545
617
-----
546
618
 
 
619
.. django-admin:: shell
 
620
 
547
621
Starts the Python interactive interpreter.
548
622
 
549
623
Django will use IPython_, if it's installed. If you have IPython installed and
557
631
sql <appname appname ...>
558
632
-------------------------
559
633
 
 
634
.. django-admin:: sql
 
635
 
560
636
Prints the CREATE TABLE SQL statements for the given app name(s).
561
637
 
 
638
.. versionadded:: 1.2
 
639
 
 
640
The :djadminopt:`--database` option can be used to specify the database for
 
641
which to print the SQL.
 
642
 
562
643
sqlall <appname appname ...>
563
644
----------------------------
564
645
 
 
646
.. django-admin:: sqlall
 
647
 
565
648
Prints the CREATE TABLE and initial-data SQL statements for the given app name(s).
566
649
 
567
650
Refer to the description of ``sqlcustom`` for an explanation of how to
568
651
specify initial data.
569
652
 
 
653
.. versionadded:: 1.2
 
654
 
 
655
The :djadminopt:`--database` option can be used to specify the database for
 
656
which to print the SQL.
 
657
 
570
658
sqlclear <appname appname ...>
571
659
------------------------------
572
660
 
 
661
.. django-admin:: sqlclear
 
662
 
573
663
Prints the DROP TABLE SQL statements for the given app name(s).
574
664
 
 
665
.. versionadded:: 1.2
 
666
 
 
667
The :djadminopt:`--database` option can be used to specify the database for
 
668
which to print the SQL.
 
669
 
575
670
sqlcustom <appname appname ...>
576
671
-------------------------------
577
672
 
 
673
.. django-admin:: sqlcustom
 
674
 
578
675
Prints the custom SQL statements for the given app name(s).
579
676
 
580
677
For each model in each specified app, this command looks for the file
591
688
 
592
689
Note that the order in which the SQL files are processed is undefined.
593
690
 
 
691
.. versionadded:: 1.2
 
692
 
 
693
The :djadminopt:`--database` option can be used to specify the database for
 
694
which to print the SQL.
 
695
 
594
696
sqlflush
595
697
--------
596
698
 
597
 
Prints the SQL statements that would be executed for the `flush`_ command.
 
699
.. django-admin:: sqlflush
 
700
 
 
701
Prints the SQL statements that would be executed for the :djadmin:`flush`
 
702
command.
 
703
 
 
704
.. versionadded:: 1.2
 
705
 
 
706
The :djadminopt:`--database` option can be used to specify the database for
 
707
which to print the SQL.
598
708
 
599
709
sqlindexes <appname appname ...>
600
710
--------------------------------
601
711
 
 
712
.. django-admin:: sqlindexes
 
713
 
602
714
Prints the CREATE INDEX SQL statements for the given app name(s).
603
715
 
 
716
.. versionadded:: 1.2
 
717
 
 
718
The :djadminopt:`--database` option can be used to specify the database for
 
719
which to print the SQL.
 
720
 
604
721
sqlreset <appname appname ...>
605
722
------------------------------
606
723
 
 
724
.. django-admin:: sqlreset
 
725
 
607
726
Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).
608
727
 
 
728
.. versionadded:: 1.2
 
729
 
 
730
The :djadminopt:`--database` option can be used to specify the database for
 
731
which to print the SQL.
 
732
 
609
733
sqlsequencereset <appname appname ...>
610
734
--------------------------------------
611
735
 
 
736
.. django-admin:: sqlsequencereset
 
737
 
612
738
Prints the SQL statements for resetting sequences for the given app name(s).
613
739
 
614
740
Sequences are indexes used by some database engines to track the next available
617
743
Use this command to generate SQL which will fix cases where a sequence is out
618
744
of sync with its automatically incremented field data.
619
745
 
 
746
.. versionadded:: 1.2
 
747
 
 
748
The :djadminopt:`--database` option can be used to specify the database for
 
749
which to print the SQL.
 
750
 
620
751
startapp <appname>
621
752
------------------
622
753
 
 
754
.. django-admin:: startapp
 
755
 
623
756
Creates a Django app directory structure for the given app name in the current
624
757
directory.
625
758
 
626
759
startproject <projectname>
627
760
--------------------------
628
761
 
 
762
.. django-admin:: startproject
 
763
 
629
764
Creates a Django project directory structure for the given project name in the
630
765
current directory.
631
766
 
635
770
situations, either omit the ``--settings`` option or unset
636
771
``DJANGO_SETTINGS_MODULE``.
637
772
 
638
 
.. _django-admin-syncdb:
639
 
 
640
773
syncdb
641
774
------
642
775
 
 
776
.. django-admin:: syncdb
 
777
 
643
778
Creates the database tables for all apps in ``INSTALLED_APPS`` whose tables
644
779
have not already been created.
645
780
 
671
806
 
672
807
--noinput
673
808
~~~~~~~~~
674
 
 
675
 
Use the ``--noinput`` option to suppress all user prompting, such as
676
 
"Are you sure?" confirmation messages. This is useful if ``django-admin.py``
677
 
is being executed as an unattended, automated script.
678
 
 
679
 
test
680
 
----
 
809
The :djadminopt:`--noinput` option may be provided to suppress all user
 
810
prompts.
 
811
 
 
812
.. versionadded:: 1.2
 
813
 
 
814
The :djadminopt:`--database` option can be used to specify the database to
 
815
synchronize.
 
816
 
 
817
test <app or test identifier>
 
818
-----------------------------
 
819
 
 
820
.. django-admin:: test
681
821
 
682
822
Runs tests for all installed models. See :ref:`topics-testing` for more
683
823
information.
684
824
 
685
 
--noinput
686
 
~~~~~~~~~
 
825
.. versionadded:: 1.2
 
826
.. django-admin-option:: --failfast
687
827
 
688
 
Use the ``--noinput`` option to suppress all user prompting, such as
689
 
"Are you sure?" confirmation messages. This is useful if ``django-admin.py``
690
 
is being executed as an unattended, automated script.
 
828
Use the :djadminopt:`--failfast` option to stop running tests and report the failure
 
829
immediately after a test fails.
691
830
 
692
831
testserver <fixture fixture ...>
693
832
--------------------------------
694
833
 
 
834
.. django-admin:: testserver
 
835
 
695
836
.. versionadded:: 1.0
696
837
 
697
838
Runs a Django development server (as in ``runserver``) using data from the
727
868
source code (as ``runserver`` does). It does, however, detect changes to
728
869
templates.
729
870
 
730
 
--addrport [port number or ipaddr:port]
731
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
871
.. django-admin-option:: --addrport [port number or ipaddr:port]
732
872
 
733
873
Use ``--addrport`` to specify a different port, or IP address and port, from
734
874
the default of 127.0.0.1:8000. This value follows exactly the same format and
752
892
validate
753
893
--------
754
894
 
 
895
.. django-admin:: validate
 
896
 
755
897
Validates all installed models (according to the ``INSTALLED_APPS`` setting)
756
898
and prints validation errors to standard output.
757
899
 
761
903
Although some subcommands may allow their own custom options, every subcommand
762
904
allows for the following options:
763
905
 
764
 
--pythonpath
765
 
------------
 
906
.. django-admin-option:: --pythonpath
766
907
 
767
908
Example usage::
768
909
 
777
918
 
778
919
.. _import search path: http://diveintopython.org/getting_to_know_python/everything_is_an_object.html
779
920
 
780
 
--settings
781
 
----------
 
921
.. django-admin-option:: --settings
782
922
 
783
923
Example usage::
784
924
 
792
932
Note that this option is unnecessary in ``manage.py``, because it uses
793
933
``settings.py`` from the current project by default.
794
934
 
795
 
--traceback
796
 
-----------
 
935
.. django-admin-option:: --traceback
797
936
 
798
937
Example usage::
799
938
 
803
942
error occurs. If you specify ``--traceback``, ``django-admin.py``  will
804
943
output a full stack trace whenever an exception is raised.
805
944
 
806
 
.. _django-admin-verbosity:
807
 
 
808
 
--verbosity
809
 
-----------
 
945
.. django-admin-option:: --verbosity
810
946
 
811
947
Example usage::
812
948
 
819
955
    * ``1`` means normal output (default).
820
956
    * ``2`` means verbose output.
821
957
 
 
958
Common options
 
959
==============
 
960
 
 
961
The following options are not available on every commands, but they are
 
962
common to a number of commands.
 
963
 
 
964
.. django-admin-option:: --database
 
965
 
 
966
.. versionadded:: 1.2
 
967
 
 
968
Used to specify the database on which a command will operate. If not
 
969
specified, this option will default to an alias of ``default``.
 
970
 
 
971
For example, to dump data from the database with the alias ``master``::
 
972
 
 
973
    django-admin.py dumpdata --database=master
 
974
 
 
975
.. django-admin-option:: --exclude
 
976
 
 
977
Exclude a specific application from the applications whose contents is
 
978
output. For example, to specifically exclude the `auth` application from
 
979
the output of dumpdata, you would call::
 
980
 
 
981
    django-admin.py dumpdata --exclude=auth
 
982
 
 
983
If you want to exclude multiple applications, use multiple ``--exclude``
 
984
directives::
 
985
 
 
986
    django-admin.py dumpdata --exclude=auth --exclude=contenttypes
 
987
 
 
988
.. django-admin-option:: --locale
 
989
 
 
990
Use the ``--locale`` or ``-l`` option to specify the locale to process.
 
991
If not provided all locales are processed.
 
992
 
 
993
.. django-admin-option:: --noinput
 
994
 
 
995
Use the ``--noinput`` option to suppress all user prompting, such as "Are
 
996
you sure?" confirmation messages. This is useful if ``django-admin.py`` is
 
997
being executed as an unattended, automated script.
 
998
 
822
999
Extra niceties
823
1000
==============
824
1001
 
 
1002
.. _syntax-coloring:
 
1003
 
825
1004
Syntax coloring
826
1005
---------------
827
1006
 
828
 
The ``django-admin.py`` / ``manage.py`` commands that output SQL to standard
829
 
output will use pretty color-coded output if your terminal supports
830
 
ANSI-colored output. It won't use the color codes if you're piping the
831
 
command's output to another program.
 
1007
The ``django-admin.py`` / ``manage.py`` commands will use pretty
 
1008
color-coded output if your terminal supports ANSI-colored output. It
 
1009
won't use the color codes if you're piping the command's output to
 
1010
another program.
 
1011
 
 
1012
The colors used for syntax highlighting can be customized. Django
 
1013
ships with three color palettes:
 
1014
 
 
1015
    * ``dark``, suited to terminals that show white text on a black
 
1016
      background. This is the default palette.
 
1017
 
 
1018
    * ``light``, suited to terminals that show black text on a white
 
1019
      background.
 
1020
 
 
1021
    * ``nocolor``, which disables syntax highlighting.
 
1022
 
 
1023
You select a palette by setting a ``DJANGO_COLORS`` environment
 
1024
variable to specify the palette you want to use. For example, to
 
1025
specify the ``light`` palette under a Unix or OS/X BASH shell, you
 
1026
would run the following at a command prompt::
 
1027
 
 
1028
    export DJANGO_COLORS="light"
 
1029
 
 
1030
You can also customize the colors that are used. Django specifies a
 
1031
number of roles in which color is used:
 
1032
 
 
1033
    * ``error`` - A major error.
 
1034
    * ``notice`` - A minor error.
 
1035
    * ``sql_field`` - The name of a model field in SQL.
 
1036
    * ``sql_coltype`` - The type of a model field in SQL.
 
1037
    * ``sql_keyword`` - A SQL keyword.
 
1038
    * ``sql_table`` - The name of a model in SQL.
 
1039
    * ``http_info`` - A 1XX HTTP Informational server response.
 
1040
    * ``http_success`` - A 2XX HTTP Success server response.
 
1041
    * ``http_not_modified`` - A 304 HTTP Not Modified server response.
 
1042
    * ``http_redirect`` - A 3XX HTTP Redirect server response other than 304.
 
1043
    * ``http_not_found`` - A 404 HTTP Not Found server response.
 
1044
    * ``http_bad_request`` - A 4XX HTTP Bad Request server response other than 404.
 
1045
    * ``http_server_error`` - A 5XX HTTP Server Error response.
 
1046
 
 
1047
Each of these roles can be assigned a specific foreground and
 
1048
background color, from the following list:
 
1049
 
 
1050
    * ``black``
 
1051
    * ``red``
 
1052
    * ``green``
 
1053
    * ``yellow``
 
1054
    * ``blue``
 
1055
    * ``magenta``
 
1056
    * ``cyan``
 
1057
    * ``white``
 
1058
 
 
1059
Each of these colors can then be modified by using the following
 
1060
display options:
 
1061
 
 
1062
    * ``bold``
 
1063
    * ``underscore``
 
1064
    * ``blink``
 
1065
    * ``reverse``
 
1066
    * ``conceal``
 
1067
 
 
1068
A color specification follows one of the the following patterns:
 
1069
 
 
1070
    * ``role=fg``
 
1071
    * ``role=fg/bg``
 
1072
    * ``role=fg,option,option``
 
1073
    * ``role=fg/bg,option,option``
 
1074
 
 
1075
where ``role`` is the name of a valid color role, ``fg`` is the
 
1076
foreground color, ``bg`` is the background color and each ``option``
 
1077
is one of the color modifying options. Multiple color specifications
 
1078
are then separated by semicolon. For example::
 
1079
 
 
1080
    export DJANGO_COLORS="error=yellow/blue,blink;notice=magenta"
 
1081
 
 
1082
would specify that errors be displayed using blinking yellow on blue,
 
1083
and notices displayed using magenta. All other color roles would be
 
1084
left uncolored.
 
1085
 
 
1086
Colors can also be specified by extending a base palette. If you put
 
1087
a palette name in a color specification, all the colors implied by that
 
1088
palette will be loaded. So::
 
1089
 
 
1090
    export DJANGO_COLORS="light;error=yellow/blue,blink;notice=magenta"
 
1091
 
 
1092
would specify the use of all the colors in the light color palette,
 
1093
*except* for the colors for errors and notices which would be
 
1094
overridden as specified.
832
1095
 
833
1096
Bash completion
834
1097
---------------
844
1107
      with ``sql``.
845
1108
 
846
1109
 
847
 
 
848
1110
See :ref:`howto-custom-management-commands` for how to add customized actions.