- Timestamp:
- 06/17/07 17:18:54 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/per-object-permissions/docs/django-admin.txt
r3940 r5488 18 18 Django via its ``setup.py`` utility. If it's not on your path, you can find it in 19 19 ``site-packages/django/bin`` within your Python installation. Consider 20 symlinking to it from some place on your path, such as ``/usr/local/bin``. 20 symlinking it from some place on your path, such as ``/usr/local/bin``. 21 22 For Windows users, who do not have symlinking functionality available, you 23 can copy ``django-admin.py`` to a location on your existing path or edit the 24 ``PATH`` settings (under ``Settings - Control Panel - System - Advanced - Environment...``) 25 to point to its installed location. 21 26 22 27 Generally, when working on a single Django project, it's easier to use … … 25 30 Django settings files. 26 31 32 The command-line examples throughout this document use ``django-admin.py`` to 33 be consistent, but any example can use ``manage.py`` just as well. 34 27 35 Usage 28 36 ===== … … 54 62 your admin's index page. See `Tutorial 2`_ for more information. 55 63 56 .. _Tutorial 2: http://www.djangoproject.com/documentation/tutorial2/64 .. _Tutorial 2: ../tutorial02/ 57 65 58 66 createcachetable [tablename] … … 62 70 backend. See the `cache documentation`_ for more information. 63 71 64 .. _cache documentation: http://www.djangoproject.com/documentation/cache/72 .. _cache documentation: ../cache/ 65 73 66 74 dbshell … … 92 100 Note that Django's default settings live in ``django/conf/global_settings.py``, 93 101 if you're ever curious to see the full list of defaults. 102 103 dumpdata [appname appname ...] 104 ------------------------------ 105 106 Output to standard output all data in the database associated with the named 107 application(s). 108 109 By default, the database will be dumped in JSON format. If you want the output 110 to be in another format, use the ``--format`` option (e.g., ``format=xml``). 111 You may specify any Django serialization backend (including any user specified 112 serialization backends named in the ``SERIALIZATION_MODULES`` setting). The 113 ``--indent`` option can be used to pretty-print the output. 114 115 If no application name is provided, all installed applications will be dumped. 116 117 The output of ``dumpdata`` can be used as input for ``loaddata``. 118 119 flush 120 ----- 121 122 Return the database to the state it was in immediately after syncdb was 123 executed. This means that all data will be removed from the database, any 124 post-synchronization handlers will be re-executed, and the ``initial_data`` 125 fixture will be re-installed. 94 126 95 127 inspectdb … … 134 166 only works in PostgreSQL and with certain types of MySQL tables. 135 167 136 install [appname appname ...] 137 ----------------------------- 138 139 Executes the equivalent of ``sqlall`` for the given appnames. 168 loaddata [fixture fixture ...] 169 ------------------------------ 170 171 Searches for and loads the contents of the named fixture into the database. 172 173 A *Fixture* is a collection of files that contain the serialized contents of 174 the database. Each fixture has a unique name; however, the files that 175 comprise the fixture can be distributed over multiple directories, in 176 multiple applications. 177 178 Django will search in three locations for fixtures: 179 180 1. In the ``fixtures`` directory of every installed application 181 2. In any directory named in the ``FIXTURE_DIRS`` setting 182 3. In the literal path named by the fixture 183 184 Django will load any and all fixtures it finds in these locations that match 185 the provided fixture names. 186 187 If the named fixture has a file extension, only fixtures of that type 188 will be loaded. For example:: 189 190 django-admin.py loaddata mydata.json 191 192 would only load JSON fixtures called ``mydata``. The fixture extension 193 must correspond to the registered name of a serializer (e.g., ``json`` or 194 ``xml``). 195 196 If you omit the extension, Django will search all available fixture types 197 for a matching fixture. For example:: 198 199 django-admin.py loaddata mydata 200 201 would look for any fixture of any fixture type called ``mydata``. If a fixture 202 directory contained ``mydata.json``, that fixture would be loaded 203 as a JSON fixture. However, if two fixtures with the same name but different 204 fixture type are discovered (for example, if ``mydata.json`` and 205 ``mydata.xml`` were found in the same fixture directory), fixture 206 installation will be aborted, and any data installed in the call to 207 ``loaddata`` will be removed from the database. 208 209 The fixtures that are named can include directory components. These 210 directories will be included in the search path. For example:: 211 212 django-admin.py loaddata foo/bar/mydata.json 213 214 would search ``<appname>/fixtures/foo/bar/mydata.json`` for each installed 215 application, ``<dirname>/foo/bar/mydata.json`` for each directory in 216 ``FIXTURE_DIRS``, and the literal path ``foo/bar/mydata.json``. 217 218 Note that the order in which fixture files are processed is undefined. However, 219 all fixture data is installed as a single transaction, so data in 220 one fixture can reference data in another fixture. If the database backend 221 supports row-level constraints, these constraints will be checked at the 222 end of the transaction. 223 224 The ``dumpdata`` command can be used to generate input for ``loaddata``. 225 226 .. admonition:: MySQL and Fixtures 227 228 Unfortunately, MySQL isn't capable of completely supporting all the 229 features of Django fixtures. If you use MyISAM tables, MySQL doesn't 230 support transactions or constraints, so you won't get a rollback if 231 multiple transaction files are found, or validation of fixture data. 232 If you use InnoDB tables, you won't be able to have any forward 233 references in your data files - MySQL doesn't provide a mechanism to 234 defer checking of row constraints until a transaction is committed. 235 236 reset [appname appname ...] 237 --------------------------- 238 Executes the equivalent of ``sqlreset`` for the given appnames. 239 240 runfcgi [options] 241 ----------------- 242 Starts a set of FastCGI processes suitable for use with any web server 243 which supports the FastCGI protocol. See the `FastCGI deployment 244 documentation`_ for details. Requires the Python FastCGI module from 245 `flup`_. 246 247 .. _FastCGI deployment documentation: ../fastcgi/ 248 .. _flup: http://www.saddi.com/software/flup/ 140 249 141 250 runserver [optional port number, or ipaddr:port] … … 187 296 188 297 By default, the development server doesn't serve any static files for your site 189 (such as CSS files, images, things under ``MEDIA_ ROOT_URL`` and so forth). If298 (such as CSS files, images, things under ``MEDIA_URL`` and so forth). If 190 299 you want to configure Django to serve static media, read the `serving static files`_ 191 300 documentation. 192 301 193 .. _serving static files: http://www.djangoproject.com/documentation/static_files/302 .. _serving static files: ../static_files/ 194 303 195 304 Turning off auto-reload … … 224 333 Prints the CREATE TABLE and initial-data SQL statements for the given appnames. 225 334 226 Refer to the description of ``sql initialdata`` for an explanation of how to335 Refer to the description of ``sqlcustom`` for an explanation of how to 227 336 specify initial data. 228 337 … … 232 341 Prints the DROP TABLE SQL statements for the given appnames. 233 342 234 sqlindexes [appname appname ...] 235 ---------------------------------------- 236 237 Prints the CREATE INDEX SQL statements for the given appnames. 238 239 sqlinitialdata [appname appname ...] 240 -------------------------------------------- 241 242 Prints the initial INSERT SQL statements for the given appnames. 343 sqlcustom [appname appname ...] 344 ------------------------------- 345 346 Prints the custom SQL statements for the given appnames. 243 347 244 348 For each model in each specified app, this command looks for the file 245 349 ``<appname>/sql/<modelname>.sql``, where ``<appname>`` is the given appname and 246 350 ``<modelname>`` is the model's name in lowercase. For example, if you have an 247 app ``news`` that includes a ``Story`` model, ``sql initialdata`` will attempt351 app ``news`` that includes a ``Story`` model, ``sqlcustom`` will attempt 248 352 to read a file ``news/sql/story.sql`` and append it to the output of this 249 353 command. … … 251 355 Each of the SQL files, if given, is expected to contain valid SQL. The SQL 252 356 files are piped directly into the database after all of the models' 253 table-creation statements have been executed. Use this SQL hook to populate 254 tables with any necessary initial records, SQL functions or test data. 357 table-creation statements have been executed. Use this SQL hook to make any 358 table modifications, or insert any SQL functions into the database. 359 360 Note that the order in which the SQL files are processed is undefined. 361 362 sqlindexes [appname appname ...] 363 ---------------------------------------- 364 365 Prints the CREATE INDEX SQL statements for the given appnames. 255 366 256 367 sqlreset [appname appname ...] … … 262 373 ---------------------------------------------- 263 374 264 Prints the SQL statements for resetting PostgreSQLsequences for the given375 Prints the SQL statements for resetting sequences for the given 265 376 appnames. 266 377 … … 293 404 give you the option of creating a superuser immediately. 294 405 406 ``syncdb`` will also search for and install any fixture named ``initial_data`` 407 with an appropriate extension (e.g. ``json`` or ``xml``). See the 408 documentation for ``loaddata`` for details on the specification of fixture 409 data files. 410 295 411 test 296 412 ---- 297 298 **New in Django development version**299 413 300 414 Discover and run tests for all installed models. See `Testing Django applications`_ for more information. … … 342 456 .. _import search path: http://diveintopython.org/getting_to_know_python/everything_is_an_object.html 343 457 458 --format 459 -------- 460 461 Example usage:: 462 463 django-admin.py dumpdata --format=xml 464 465 Specifies the output format that will be used. The name provided must be the name 466 of a registered serializer. 467 344 468 --help 345 469 ------ … … 348 472 options. 349 473 474 --indent 475 -------- 476 477 Example usage:: 478 479 django-admin.py dumpdata --indent=4 480 481 Specifies the number of spaces that will be used for indentation when 482 pretty-printing output. By default, output will *not* be pretty-printed. 483 Pretty-printing will only be enabled if the indent option is provided. 484 350 485 --noinput 351 486 --------- 352 353 **New in Django development version**354 487 355 488 Inform django-admin that the user should NOT be prompted for any input. Useful … … 375 508 ----------- 376 509 377 **New in Django development version**378 379 510 Example usage:: 380 511 381 512 django-admin.py syncdb --verbosity=2 382 513 383 Verbosity determines the amount of notification and debug information that 514 Verbosity determines the amount of notification and debug information that 384 515 will be printed to the console. '0' is no output, '1' is normal output, 385 516 and `2` is verbose output. … … 388 519 ------------ 389 520 390 **New in Django development version**391 392 521 Example usage:: 393 django-admin.py manage.py --adminmedia=/tmp/new-admin-style/ 522 523 django-admin.py --adminmedia=/tmp/new-admin-style/ 394 524 395 525 Tells Django where to find the various CSS and JavaScript files for the admin
