~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (6.2.12 experimental)
  • Revision ID: package-import@ubuntu.com-20130509151047-g79qsrewg1yl43h5
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
Can be run as a cronjob or directly to clean out old data from the database
97
97
(only expired sessions at the moment).
98
98
 
 
99
.. versionchanged:: 1.5
 
100
    :djadmin:`cleanup` is deprecated. Use :djadmin:`clearsessions` instead.
 
101
 
99
102
compilemessages
100
103
---------------
101
104
 
109
112
 
110
113
Example usage::
111
114
 
112
 
    django-admin.py compilemessages --locale=br_PT
 
115
    django-admin.py compilemessages --locale=pt_BR
113
116
 
114
117
createcachetable
115
118
----------------
119
122
Creates a cache table named ``tablename`` for use with the database cache
120
123
backend. See :doc:`/topics/cache` for more information.
121
124
 
122
 
.. versionadded:: 1.2
123
 
 
124
125
The :djadminopt:`--database` option can be used to specify the database
125
126
onto which the cachetable will be installed.
126
127
 
142
143
the right place. There's no way to specify the location of the program
143
144
manually.
144
145
 
145
 
.. versionadded:: 1.2
146
 
 
147
146
The :djadminopt:`--database` option can be used to specify the database
148
147
onto which to open a shell.
149
148
 
180
179
the default manager and it filters some of the available records, not all of the
181
180
objects will be dumped.
182
181
 
183
 
.. versionadded:: 1.3
184
 
 
185
182
The :djadminopt:`--all` option may be provided to specify that
186
183
``dumpdata`` should use Django's base manager, dumping records which
187
184
might otherwise be filtered or modified by a custom manager.
199
196
pretty-print the output with a number of indentation spaces.
200
197
 
201
198
The :djadminopt:`--exclude` option may be provided to prevent specific
202
 
applications from being dumped.
203
 
 
204
 
.. versionadded:: 1.3
205
 
 
206
 
The :djadminopt:`--exclude` option may also be provided to prevent specific
207
 
models (specified as in the form of ``appname.ModelName``) from being dumped.
208
 
 
209
 
In addition to specifying application names, you can provide a list of
210
 
individual models, in the form of ``appname.Model``. If you specify a model
211
 
name to ``dumpdata``, the dumped output will be restricted to that model,
212
 
rather than the entire application. You can also mix application names and
213
 
model names.
214
 
 
215
 
.. versionadded:: 1.2
 
199
applications or models (specified as in the form of ``appname.ModelName``) from
 
200
being dumped. If you specify a model name to ``dumpdata``, the dumped output
 
201
will be restricted to that model, rather than the entire application. You can
 
202
also mix application names and model names.
216
203
 
217
204
The :djadminopt:`--database` option can be used to specify the database
218
205
from which data will be dumped.
219
206
 
220
207
.. django-admin-option:: --natural
221
208
 
222
 
.. versionadded:: 1.2
223
 
 
224
209
Use :ref:`natural keys <topics-serialization-natural-keys>` to represent
225
210
any foreign key and many-to-many relationship with a model that provides
226
211
a natural key definition. If you are dumping ``contrib.auth`` ``Permission``
240
225
The :djadminopt:`--noinput` option may be provided to suppress all user
241
226
prompts.
242
227
 
243
 
.. versionadded:: 1.2
244
 
 
245
228
The :djadminopt:`--database` option may be used to specify the database
246
229
to flush.
247
230
 
 
231
--no-initial-data
 
232
~~~~~~~~~~~~~~~~~
 
233
 
 
234
.. versionadded:: 1.5
 
235
 
 
236
Use ``--no-initial-data`` to avoid loading the initial_data fixture.
 
237
 
 
238
 
248
239
inspectdb
249
240
---------
250
241
 
288
279
``inspectdb`` works with PostgreSQL, MySQL and SQLite. Foreign-key detection
289
280
only works in PostgreSQL and with certain types of MySQL tables.
290
281
 
291
 
.. versionadded:: 1.2
292
 
 
293
282
The :djadminopt:`--database` option may be used to specify the
294
283
database to introspect.
295
284
 
300
289
 
301
290
Searches for and loads the contents of the named fixture into the database.
302
291
 
303
 
.. versionadded:: 1.2
304
 
 
305
292
The :djadminopt:`--database` option can be used to specify the database
306
293
onto which the data will be loaded.
307
294
 
 
295
.. django-admin-option:: --ignorenonexistent
 
296
 
 
297
.. versionadded:: 1.5
 
298
 
 
299
The :djadminopt:`--ignorenonexistent` option can be used to ignore fields that
 
300
may have been removed from models since the fixture was originally generated.
 
301
 
308
302
What's a "fixture"?
309
303
~~~~~~~~~~~~~~~~~~~
310
304
 
432
426
 
433
427
Example usage::
434
428
 
435
 
    django-admin.py makemessages --locale=br_PT
 
429
    django-admin.py makemessages --locale=pt_BR
436
430
 
437
431
.. django-admin-option:: --domain
438
432
 
444
438
 
445
439
.. django-admin-option:: --symlinks
446
440
 
447
 
.. versionadded:: 1.2
448
 
 
449
441
Use the ``--symlinks`` or ``-s`` option to follow symlinks to directories when
450
442
looking for new translation strings.
451
443
 
471
463
 
472
464
.. django-admin-option:: --no-wrap
473
465
 
474
 
.. versionadded:: 1.3
475
 
 
476
466
Use the ``--no-wrap`` option to disable breaking long message lines into
477
467
several lines in language files.
478
468
 
484
474
comment lines in language files. Note that using this option makes it harder
485
475
for technically skilled translators to understand each message's context.
486
476
 
487
 
reset <appname appname ...>
488
 
---------------------------
489
 
 
490
 
.. deprecated:: 1.3
491
 
    This command has been deprecated. The ``flush`` can be used to delete
492
 
    everything. You can also use ALTER TABLE or DROP TABLE statements manually.
493
 
 
494
 
.. django-admin:: reset
495
 
 
496
 
Executes the equivalent of ``sqlreset`` for the given app name(s).
497
 
 
498
 
The :djadminopt:`--noinput` option may be provided to suppress all user
499
 
prompts.
500
 
 
501
 
.. versionadded:: 1.2
502
 
 
503
 
The :djadminopt:`--database` option can be used to specify the alias
504
 
of the database to reset.
505
 
 
506
477
runfcgi [options]
507
478
-----------------
508
479
 
667
638
machines on the network, use its own IP address (e.g. ``192.168.2.1``) or
668
639
``0.0.0.0`` or ``::`` (with IPv6 enabled).
669
640
 
670
 
.. versionchanged:: 1.3
671
 
 
672
641
You can provide an IPv6 address surrounded by brackets
673
642
(e.g. ``[200a::1]:8000``). This will automatically enable IPv6 support.
674
643
 
675
644
A hostname containing ASCII-only characters can also be used.
676
645
 
677
 
.. django-admin-option:: --adminmedia
678
 
 
679
 
Use the ``--adminmedia`` option to tell Django where to find the various CSS
680
 
and JavaScript files for the Django admin interface. Normally, the development
681
 
server serves these files out of the Django source tree magically, but you'd
682
 
want to use this if you made any changes to those files for your own site.
683
 
 
684
 
Example usage::
685
 
 
686
 
    django-admin.py runserver --adminmedia=/tmp/new-admin-style/
687
 
 
688
 
.. versionchanged:: 1.3
689
 
 
690
646
If the :doc:`staticfiles</ref/contrib/staticfiles>` contrib app is enabled
691
647
(default in new projects) the :djadmin:`runserver` command will be overriden
692
 
with an own :djadmin:`runserver<staticfiles-runserver>` command which doesn't
693
 
have the :djadminopt:`--adminmedia` option due to deprecation.
 
648
with its own :ref:`runserver<staticfiles-runserver>` command.
694
649
 
695
650
.. django-admin-option:: --noreload
696
651
 
713
668
 
714
669
.. django-admin-option:: --ipv6, -6
715
670
 
716
 
.. versionadded:: 1.3
717
 
 
718
671
Use the ``--ipv6`` (or shorter ``-6``) option to tell Django to use IPv6 for
719
672
the development server. This changes the default IP address from
720
673
``127.0.0.1`` to ``::1``.
782
735
 
783
736
    django-admin.py shell --plain
784
737
 
 
738
.. versionchanged:: 1.5
 
739
 
 
740
If you would like to specify either IPython or bpython as your interpreter if
 
741
you have both installed you can specify an alternative interpreter interface
 
742
with the ``-i`` or ``--interface`` options like so:
 
743
 
 
744
IPython::
 
745
 
 
746
    django-admin.py shell -i ipython
 
747
    django-admin.py shell --interface ipython
 
748
 
 
749
 
 
750
bpython::
 
751
 
 
752
    django-admin.py shell -i bpython
 
753
    django-admin.py shell --interface bpython
 
754
 
 
755
 
785
756
.. _IPython: http://ipython.scipy.org/
786
757
.. _bpython: http://bpython-interpreter.org/
787
758
 
792
763
 
793
764
Prints the CREATE TABLE SQL statements for the given app name(s).
794
765
 
795
 
.. versionadded:: 1.2
796
 
 
797
766
The :djadminopt:`--database` option can be used to specify the database for
798
767
which to print the SQL.
799
768
 
807
776
Refer to the description of ``sqlcustom`` for an explanation of how to
808
777
specify initial data.
809
778
 
810
 
.. versionadded:: 1.2
811
 
 
812
779
The :djadminopt:`--database` option can be used to specify the database for
813
780
which to print the SQL.
814
781
 
819
786
 
820
787
Prints the DROP TABLE SQL statements for the given app name(s).
821
788
 
822
 
.. versionadded:: 1.2
823
 
 
824
789
The :djadminopt:`--database` option can be used to specify the database for
825
790
which to print the SQL.
826
791
 
845
810
 
846
811
Note that the order in which the SQL files are processed is undefined.
847
812
 
848
 
.. versionadded:: 1.2
849
 
 
850
813
The :djadminopt:`--database` option can be used to specify the database for
851
814
which to print the SQL.
852
815
 
858
821
Prints the SQL statements that would be executed for the :djadmin:`flush`
859
822
command.
860
823
 
861
 
.. versionadded:: 1.2
862
 
 
863
824
The :djadminopt:`--database` option can be used to specify the database for
864
825
which to print the SQL.
865
826
 
870
831
 
871
832
Prints the CREATE INDEX SQL statements for the given app name(s).
872
833
 
873
 
.. versionadded:: 1.2
874
 
 
875
 
The :djadminopt:`--database` option can be used to specify the database for
876
 
which to print the SQL.
877
 
 
878
 
sqlreset <appname appname ...>
879
 
------------------------------
880
 
 
881
 
.. deprecated:: 1.3
882
 
    This command has been deprecated. The ``sqlflush`` can be used to delete
883
 
    everything. You can also use ALTER TABLE or DROP TABLE statements manually.
884
 
 
885
 
.. django-admin:: sqlreset
886
 
 
887
 
Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).
888
 
 
889
 
.. versionadded:: 1.2
890
 
 
891
834
The :djadminopt:`--database` option can be used to specify the database for
892
835
which to print the SQL.
893
836
 
904
847
Use this command to generate SQL which will fix cases where a sequence is out
905
848
of sync with its automatically incremented field data.
906
849
 
907
 
.. versionadded:: 1.2
908
 
 
909
850
The :djadminopt:`--database` option can be used to specify the database for
910
851
which to print the SQL.
911
852
 
980
921
    To work around this problem, you can use the :ttag:`templatetag`
981
922
    templatetag to "escape" the various parts of the template syntax.
982
923
 
983
 
.. _source: https://code.djangoproject.com/browser/django/trunk/django/conf/app_template/
 
924
.. _source: https://github.com/django/django/tree/master/django/conf/app_template/
984
925
 
985
926
startproject <projectname> [destination]
986
927
----------------------------------------
1043
984
Please also see the :ref:`rendering warning <render_warning>` as mentioned
1044
985
for :djadmin:`startapp`.
1045
986
 
1046
 
.. _`template source`: https://code.djangoproject.com/browser/django/trunk/django/conf/project_template/
 
987
.. _`template source`: https://github.com/django/django/tree/master/django/conf/project_template/
1047
988
 
1048
989
syncdb
1049
990
------
1082
1023
The :djadminopt:`--noinput` option may be provided to suppress all user
1083
1024
prompts.
1084
1025
 
1085
 
.. versionadded:: 1.2
1086
 
 
1087
1026
The :djadminopt:`--database` option can be used to specify the database to
1088
1027
synchronize.
1089
1028
 
 
1029
--no-initial-data
 
1030
~~~~~~~~~~~~~~~~~
 
1031
 
 
1032
.. versionadded:: 1.5
 
1033
 
 
1034
Use ``--no-initial-data`` to avoid loading the initial_data fixture.
 
1035
 
1090
1036
test <app or test identifier>
1091
1037
-----------------------------
1092
1038
 
1093
1039
.. django-admin:: test
1094
1040
 
1095
 
Runs tests for all installed models. See :doc:`/topics/testing` for more
 
1041
Runs tests for all installed models. See :doc:`/topics/testing/index` for more
1096
1042
information.
1097
1043
 
1098
 
.. versionadded:: 1.2
1099
1044
.. django-admin-option:: --failfast
1100
1045
 
1101
1046
The ``--failfast`` option can be used to stop running tests and report the
1129
1074
 
1130
1075
...would perform the following steps:
1131
1076
 
1132
 
1. Create a test database, as described in :doc:`/topics/testing`.
 
1077
1. Create a test database, as described in :ref:`the-test-database`.
1133
1078
2. Populate the test database with fixture data from the given fixtures.
1134
1079
   (For more on fixtures, see the documentation for ``loaddata`` above.)
1135
1080
3. Runs the Django development server (as in ``runserver``), pointed at
1137
1082
 
1138
1083
This is useful in a number of ways:
1139
1084
 
1140
 
* When you're writing :doc:`unit tests </topics/testing>` of how your views
 
1085
* When you're writing :doc:`unit tests </topics/testing/overview>` of how your views
1141
1086
  act with certain fixture data, you can use ``testserver`` to interact with
1142
1087
  the views in a Web browser, manually.
1143
1088
 
1174
1119
 
1175
1120
    django-admin.py testserver --addrport 1.2.3.4:7000 test
1176
1121
 
1177
 
.. versionadded:: 1.3
1178
 
 
1179
1122
The :djadminopt:`--noinput` option may be provided to suppress all user
1180
1123
prompts.
1181
1124
 
1203
1146
 
1204
1147
.. django-admin:: changepassword
1205
1148
 
1206
 
.. versionadded:: 1.2
1207
 
 
1208
1149
This command is only available if Django's :doc:`authentication system
1209
 
</topics/auth>` (``django.contrib.auth``) is installed.
 
1150
</topics/auth/index>` (``django.contrib.auth``) is installed.
1210
1151
 
1211
1152
Allows changing a user's password. It prompts you to enter twice the password of
1212
1153
the user given as parameter. If they both match, the new password will be
1228
1169
.. django-admin:: createsuperuser
1229
1170
 
1230
1171
This command is only available if Django's :doc:`authentication system
1231
 
</topics/auth>` (``django.contrib.auth``) is installed.
 
1172
</topics/auth/index>` (``django.contrib.auth``) is installed.
1232
1173
 
1233
1174
Creates a superuser account (a user who has all permissions). This is
1234
1175
useful if you need to create an initial superuser account but did not
1265
1206
Please refer to its :djadmin:`description <ogrinspect>` in the GeoDjango
1266
1207
documentation.
1267
1208
 
 
1209
``django.contrib.sessions``
 
1210
---------------------------
 
1211
 
 
1212
clearsessions
 
1213
~~~~~~~~~~~~~~~
 
1214
 
 
1215
.. django-admin:: clearsessions
 
1216
 
 
1217
Can be run as a cron job or directly to clean out expired sessions.
 
1218
 
1268
1219
``django.contrib.sitemaps``
1269
1220
---------------------------
1270
1221
 
1365
1316
 
1366
1317
.. django-admin-option:: --database
1367
1318
 
1368
 
.. versionadded:: 1.2
1369
 
 
1370
1319
Used to specify the database on which a command will operate. If not
1371
1320
specified, this option will default to an alias of ``default``.
1372
1321
 
1377
1326
.. django-admin-option:: --exclude
1378
1327
 
1379
1328
Exclude a specific application from the applications whose contents is
1380
 
output. For example, to specifically exclude the `auth` application from
 
1329
output. For example, to specifically exclude the ``auth`` application from
1381
1330
the output of dumpdata, you would call::
1382
1331
 
1383
1332
    django-admin.py dumpdata --exclude=auth
1536
1485
      from django.core import management
1537
1486
      management.call_command('flush', verbosity=0, interactive=False)
1538
1487
      management.call_command('loaddata', 'test_data', verbosity=0)
 
1488
 
 
1489
Output redirection
 
1490
==================
 
1491
 
 
1492
Note that you can redirect standard output and error streams as all commands
 
1493
support the ``stdout`` and ``stderr`` options. For example, you could write::
 
1494
 
 
1495
    with open('/tmp/command_output') as f:
 
1496
        management.call_command('dumpdata', stdout=f)