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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2011-02-17 13:34:07 UTC
  • mfrom: (1.1.13 upstream) (4.4.12 sid)
  • Revision ID: james.westby@ubuntu.com-20110217133407-rwr88elhhq6j7ba0
Tags: 1.2.5-1ubuntu1
* Merge from Debian for security fixes (LP: #719031). Remaining changes:
  - debian/control: don't Build-Depends on locales-all, which doesn't exist
    in natty
* Drop the following patches, now included upstream:
  - debian/patches/07_security_admin_infoleak.diff
  - debian/patches/08_security_pasword_reset_dos.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
.. code-block:: bash
39
39
 
40
 
    django-admin.py <subcommand> [options]
41
 
    manage.py <subcommand> [options]
 
40
    django-admin.py <command> [options]
 
41
    manage.py <command> [options]
42
42
 
43
 
``subcommand`` should be one of the subcommands listed in this document.
 
43
``command`` should be one of the commands listed in this document.
44
44
``options``, which is optional, should be zero or more of the options available
45
 
for the given subcommand.
 
45
for the given command.
46
46
 
47
47
Getting runtime help
48
48
--------------------
49
49
 
50
50
.. django-admin-option:: --help
51
51
 
52
 
Run ``django-admin.py help`` to display a list of all available subcommands.
53
 
Run ``django-admin.py help <subcommand>`` to display a description of the
54
 
given subcommand and a list of its available options.
 
52
Run ``django-admin.py help`` to display a list of all available commands.
 
53
Run ``django-admin.py help <command>`` to display a description of the
 
54
given command and a list of its available options.
55
55
 
56
56
App names
57
57
---------
58
58
 
59
 
Many subcommands take a list of "app names." An "app name" is the basename of
 
59
Many commands take a list of "app names." An "app name" is the basename of
60
60
the package containing your models. For example, if your ``INSTALLED_APPS``
61
61
contains the string ``'mysite.blog'``, the app name is ``blog``.
62
62
 
80
80
that ``django-admin.py`` should print to the console. For more details, see the
81
81
documentation for the :djadminopt:`--verbosity` option.
82
82
 
83
 
Available subcommands
84
 
=====================
 
83
Available commands
 
84
==================
85
85
 
86
86
cleanup
87
87
-------
88
88
 
89
89
.. django-admin:: cleanup
90
90
 
91
 
.. versionadded:: 1.0
92
 
 
93
91
Can be run as a cronjob or directly to clean out old data from the database
94
92
(only expired sessions at the moment).
95
93
 
98
96
 
99
97
.. django-admin:: compilemessages
100
98
 
101
 
.. versionchanged:: 1.0
102
 
   Before 1.0 this was the "bin/compile-messages.py" command.
103
 
 
104
99
Compiles .po files created with ``makemessages`` to .mo files for use with
105
100
the builtin gettext support. See :doc:`/topics/i18n/index`.
106
101
 
124
119
The :djadminopt:`--database` option can be used to specify the database
125
120
onto which the cachetable will be installed.
126
121
 
127
 
createsuperuser
128
 
---------------
129
 
 
130
 
.. django-admin:: createsuperuser
131
 
 
132
 
.. versionadded:: 1.0
133
 
 
134
 
Creates a superuser account (a user who has all permissions). This is
135
 
useful if you need to create an initial superuser account but did not
136
 
do so during ``syncdb``, or if you need to programmatically generate
137
 
superuser accounts for your site(s).
138
 
 
139
 
When run interactively, this command will prompt for a password for
140
 
the new superuser account. When run non-interactively, no password
141
 
will be set, and the superuser account will not be able to log in until
142
 
a password has been manually set for it.
143
 
 
144
 
.. django-admin-option:: --username
145
 
.. django-admin-option:: --email
146
 
 
147
 
The username and e-mail address for the new account can be supplied by
148
 
using the ``--username`` and ``--email`` arguments on the command
149
 
line. If either of those is not supplied, ``createsuperuser`` will prompt for
150
 
it when running interactively.
151
 
 
152
 
This command is only available if Django's :doc:`authentication system
153
 
</topics/auth>` (``django.contrib.auth``) is installed.
154
 
 
155
122
dbshell
156
123
-------
157
124
 
175
142
The :djadminopt:`--database` option can be used to specify the database
176
143
onto which to open a shell.
177
144
 
178
 
 
179
145
diffsettings
180
146
------------
181
147
 
220
186
easy for humans to read, so you can use the ``--indent`` option to
221
187
pretty-print the output with a number of indentation spaces.
222
188
 
223
 
.. versionadded:: 1.0
224
 
 
225
189
The :djadminopt:`--exclude` option may be provided to prevent specific
226
190
applications from being dumped.
227
191
 
315
279
The :djadminopt:`--database` option may be used to specify the
316
280
database to introspect.
317
281
 
318
 
 
319
282
loaddata <fixture fixture ...>
320
283
------------------------------
321
284
 
426
389
 
427
390
.. django-admin:: makemessages
428
391
 
429
 
.. versionchanged:: 1.0
430
 
   Before 1.0 this was the ``bin/make-messages.py`` command.
431
 
 
432
392
Runs over the entire source tree of the current directory and pulls out all
433
393
strings marked for translation. It creates (or updates) a message file in the
434
394
conf/locale (in the django tree) or locale (for project and application)
528
488
 
529
489
.. _flup: http://www.saddi.com/software/flup/
530
490
 
 
491
The options accepted by this command are passed to the FastCGI library and
 
492
don't use the ``'--'`` prefix as is usual for other Django management commands.
 
493
 
 
494
.. django-admin-option:: protocol
 
495
 
 
496
``protocol=PROTOCOL``
 
497
 
 
498
Protocol to use. *PROTOCOL* can be ``fcgi``, ``scgi``, ``ajp``, etc.
 
499
(default is ``fcgi``)
 
500
 
 
501
.. django-admin-option:: host
 
502
 
 
503
``host=HOSTNAME``
 
504
 
 
505
Hostname to listen on.
 
506
 
 
507
.. django-admin-option:: port
 
508
 
 
509
``port=PORTNUM``
 
510
 
 
511
Port to listen on.
 
512
 
 
513
.. django-admin-option:: socket
 
514
 
 
515
``socket=FILE``
 
516
 
 
517
UNIX socket to listen on.
 
518
 
 
519
.. django-admin-option:: method
 
520
 
 
521
``method=IMPL``
 
522
 
 
523
Possible values: ``prefork`` or ``threaded`` (default ``prefork``)
 
524
 
 
525
.. django-admin-option:: maxrequests
 
526
 
 
527
``maxrequests=NUMBER``
 
528
 
 
529
Number of requests a child handles before it is killed and a new child is
 
530
forked (0 means no limit).
 
531
 
 
532
.. django-admin-option:: maxspare
 
533
 
 
534
``maxspare=NUMBER``
 
535
 
 
536
Max number of spare processes / threads.
 
537
 
 
538
.. django-admin-option:: minspare
 
539
 
 
540
``minspare=NUMBER``
 
541
 
 
542
Min number of spare processes / threads.
 
543
 
 
544
.. django-admin-option:: maxchildren
 
545
 
 
546
``maxchildren=NUMBER``
 
547
 
 
548
Hard limit number of processes / threads.
 
549
 
 
550
.. django-admin-option:: daemonize
 
551
 
 
552
``daemonize=BOOL``
 
553
 
 
554
Whether to detach from terminal.
 
555
 
 
556
.. django-admin-option:: pidfile
 
557
 
 
558
``pidfile=FILE``
 
559
 
 
560
Write the spawned process-id to file *FILE*.
 
561
 
 
562
.. django-admin-option:: workdir
 
563
 
 
564
``workdir=DIRECTORY``
 
565
 
 
566
Change to directory *DIRECTORY* when daemonizing.
 
567
 
 
568
.. django-admin-option:: debug
 
569
 
 
570
``debug=BOOL``
 
571
 
 
572
Set to true to enable flup tracebacks.
 
573
 
 
574
.. django-admin-option:: outlog
 
575
 
 
576
``outlog=FILE``
 
577
 
 
578
Write stdout to the *FILE* file.
 
579
 
 
580
.. django-admin-option:: errlog
 
581
 
 
582
``errlog=FILE``
 
583
 
 
584
Write stderr to the *FILE* file.
 
585
 
 
586
.. django-admin-option:: umask
 
587
 
 
588
``umask=UMASK``
 
589
 
 
590
Umask to use when daemonizing. The value is interpeted as an octal number
 
591
(default value is ``022``).
 
592
 
 
593
Example usage::
 
594
 
 
595
    django-admin.py runfcgi socket=/tmp/fcgi.sock method=prefork daemonize=true \
 
596
        pidfile=/var/run/django-fcgi.pid
 
597
 
 
598
Run a FastCGI server as a daemon and write the spawned PID in a file.
 
599
 
531
600
runserver [port or ipaddr:port]
532
601
-------------------------------
533
602
 
831
900
 
832
901
.. django-admin:: testserver
833
902
 
834
 
.. versionadded:: 1.0
835
 
 
836
903
Runs a Django development server (as in ``runserver``) using data from the
837
904
given fixture(s).
838
905
 
870
937
 
871
938
Use ``--addrport`` to specify a different port, or IP address and port, from
872
939
the default of 127.0.0.1:8000. This value follows exactly the same format and
873
 
serves exactly the same function as the argument to the ``runserver`` subcommand.
 
940
serves exactly the same function as the argument to the ``runserver`` command.
874
941
 
875
942
Examples:
876
943
 
895
962
Validates all installed models (according to the ``INSTALLED_APPS`` setting)
896
963
and prints validation errors to standard output.
897
964
 
 
965
Commands provided by applications
 
966
=================================
 
967
 
 
968
Some commands are only available when the ``django.contrib`` application that
 
969
:doc:`implements </howto/custom-management-commands>` them has been
 
970
:setting:`enabled <INSTALLED_APPS>`. This section describes them grouped by
 
971
their application.
 
972
 
 
973
``django.contrib.auth``
 
974
-----------------------
 
975
 
 
976
changepassword
 
977
~~~~~~~~~~~~~~
 
978
 
 
979
.. django-admin:: changepassword
 
980
 
 
981
.. versionadded:: 1.2
 
982
 
 
983
This command is only available if Django's :doc:`authentication system
 
984
</topics/auth>` (``django.contrib.auth``) is installed.
 
985
 
 
986
Allows changing a user's password. It prompts you to enter twice the password of
 
987
the user given as parameter. If they both match, the new password will be
 
988
changed immediately. If you do not supply a user, the command will attempt to
 
989
change the password whose username matches the current user.
 
990
 
 
991
Example usage::
 
992
 
 
993
    django-admin.py changepassword ringo
 
994
 
 
995
createsuperuser
 
996
~~~~~~~~~~~~~~~
 
997
 
 
998
.. django-admin:: createsuperuser
 
999
 
 
1000
This command is only available if Django's :doc:`authentication system
 
1001
</topics/auth>` (``django.contrib.auth``) is installed.
 
1002
 
 
1003
Creates a superuser account (a user who has all permissions). This is
 
1004
useful if you need to create an initial superuser account but did not
 
1005
do so during ``syncdb``, or if you need to programmatically generate
 
1006
superuser accounts for your site(s).
 
1007
 
 
1008
When run interactively, this command will prompt for a password for
 
1009
the new superuser account. When run non-interactively, no password
 
1010
will be set, and the superuser account will not be able to log in until
 
1011
a password has been manually set for it.
 
1012
 
 
1013
.. django-admin-option:: --username
 
1014
.. django-admin-option:: --email
 
1015
 
 
1016
The username and e-mail address for the new account can be supplied by
 
1017
using the ``--username`` and ``--email`` arguments on the command
 
1018
line. If either of those is not supplied, ``createsuperuser`` will prompt for
 
1019
it when running interactively.
 
1020
 
 
1021
``django.contrib.gis``
 
1022
----------------------
 
1023
 
 
1024
ogrinspect
 
1025
~~~~~~~~~~
 
1026
 
 
1027
This command is only available if :doc:`GeoDjango </ref/contrib/gis/index>`
 
1028
(``django.contrib.gis``) is installed.
 
1029
 
 
1030
Please refer to its :djadmin:`description <ogrinspect>` in the GeoDjango
 
1031
documentation.
 
1032
 
 
1033
``django.contrib.sitemaps``
 
1034
---------------------------
 
1035
 
 
1036
ping_google
 
1037
~~~~~~~~~~~
 
1038
 
 
1039
This command is only available if the :doc:`Sitemaps framework
 
1040
</ref/contrib/sitemaps>` (``django.contrib.sitemaps``) is installed.
 
1041
 
 
1042
Please refer to its :djadmin:`description <ping_google>` in the Sitemaps
 
1043
documentation.
 
1044
 
898
1045
Default options
899
1046
===============
900
1047
 
901
 
Although some subcommands may allow their own custom options, every subcommand
 
1048
Although some commands may allow their own custom options, every command
902
1049
allows for the following options:
903
1050
 
904
1051
.. django-admin-option:: --pythonpath
1106
1253
 
1107
1254
 
1108
1255
See :doc:`/howto/custom-management-commands` for how to add customized actions.
 
1256
 
 
1257
 
 
1258
==========================================
 
1259
Running management commands from your code
 
1260
==========================================
 
1261
 
 
1262
.. function:: django.core.management.call_command(name, *args, **options)
 
1263
 
 
1264
To call a management command from code use ``call_command``.
 
1265
 
 
1266
``name``
 
1267
  the name of the command to call.
 
1268
 
 
1269
``*args``
 
1270
  a list of arguments accepted by the command.
 
1271
 
 
1272
``**options``
 
1273
  named options accepted on the command-line.
 
1274
 
 
1275
Examples::
 
1276
 
 
1277
      from django.core import management
 
1278
      management.call_command('flush', verbosity=0, interactive=False)
 
1279
      management.call_command('loaddata', 'test_data', verbosity=0)