django-admin.1 80 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .
  4. .nr rst2man-indent-level 0
  5. .
  6. .de1 rstReportMargin
  7. \\$1 \\n[an-margin]
  8. level \\n[rst2man-indent-level]
  9. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  10. -
  11. \\n[rst2man-indent0]
  12. \\n[rst2man-indent1]
  13. \\n[rst2man-indent2]
  14. ..
  15. .de1 INDENT
  16. .\" .rstReportMargin pre:
  17. . RS \\$1
  18. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  19. . nr rst2man-indent-level +1
  20. .\" .rstReportMargin post:
  21. ..
  22. .de UNINDENT
  23. . RE
  24. .\" indent \\n[an-margin]
  25. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  26. .nr rst2man-indent-level -1
  27. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  28. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  29. ..
  30. .TH "DJANGO-ADMIN" "1" "February 19, 2025" "5.2" "Django"
  31. .SH NAME
  32. django-admin \- Utility script for the Django web framework
  33. .sp
  34. \fBdjango\-admin\fP is Django\(aqs command\-line utility for administrative tasks.
  35. This document outlines all it can do.
  36. .sp
  37. In addition, \fBmanage.py\fP is automatically created in each Django project. It
  38. does the same thing as \fBdjango\-admin\fP but also sets the
  39. \fI\%DJANGO_SETTINGS_MODULE\fP environment variable so that it points to your
  40. project\(aqs \fBsettings.py\fP file.
  41. .sp
  42. The \fBdjango\-admin\fP script should be on your system path if you installed
  43. Django via \fBpip\fP\&. If it\(aqs not in your path, ensure you have your virtual
  44. environment activated.
  45. .sp
  46. Generally, when working on a single Django project, it\(aqs easier to use
  47. \fBmanage.py\fP than \fBdjango\-admin\fP\&. If you need to switch between multiple
  48. Django settings files, use \fBdjango\-admin\fP with
  49. \fI\%DJANGO_SETTINGS_MODULE\fP or the \fI\%\-\-settings\fP command line
  50. option.
  51. .sp
  52. The command\-line examples throughout this document use \fBdjango\-admin\fP to
  53. be consistent, but any example can use \fBmanage.py\fP or \fBpython \-m django\fP
  54. just as well.
  55. .SH USAGE
  56. .INDENT 0.0
  57. .INDENT 3.5
  58. .sp
  59. .EX
  60. $ django\-admin <command> [options]
  61. $ manage.py <command> [options]
  62. $ python \-m django <command> [options]
  63. .EE
  64. .UNINDENT
  65. .UNINDENT
  66. .sp
  67. \fBcommand\fP should be one of the commands listed in this document.
  68. \fBoptions\fP, which is optional, should be zero or more of the options available
  69. for the given command.
  70. .SS Getting runtime help
  71. .INDENT 0.0
  72. .TP
  73. .B django\-admin help
  74. .UNINDENT
  75. .sp
  76. Run \fBdjango\-admin help\fP to display usage information and a list of the
  77. commands provided by each application.
  78. .sp
  79. Run \fBdjango\-admin help \-\-commands\fP to display a list of all available
  80. commands.
  81. .sp
  82. Run \fBdjango\-admin help <command>\fP to display a description of the given
  83. command and a list of its available options.
  84. .SS App names
  85. .sp
  86. Many commands take a list of \(dqapp names.\(dq An \(dqapp name\(dq is the basename of
  87. the package containing your models. For example, if your \fI\%INSTALLED_APPS\fP
  88. contains the string \fB\(aqmysite.blog\(aq\fP, the app name is \fBblog\fP\&.
  89. .SS Determining the version
  90. .INDENT 0.0
  91. .TP
  92. .B django\-admin version
  93. .UNINDENT
  94. .sp
  95. Run \fBdjango\-admin version\fP to display the current Django version.
  96. .sp
  97. The output follows the schema described in \X'tty: link https://peps.python.org/pep-0440/'\fI\%PEP 440\fP\X'tty: link':
  98. .INDENT 0.0
  99. .INDENT 3.5
  100. .sp
  101. .EX
  102. 1.4.dev17026
  103. 1.4a1
  104. 1.4
  105. .EE
  106. .UNINDENT
  107. .UNINDENT
  108. .SS Displaying debug output
  109. .sp
  110. Use \fI\%\-\-verbosity\fP, where it is supported, to specify the amount of
  111. notification and debug information that \fBdjango\-admin\fP prints to the console.
  112. .SH AVAILABLE COMMANDS
  113. .SS \fBcheck\fP
  114. .INDENT 0.0
  115. .TP
  116. .B django\-admin check [app_label [app_label ...]]
  117. .UNINDENT
  118. .sp
  119. Uses the \fI\%system check framework\fP to inspect the entire
  120. Django project for common problems.
  121. .sp
  122. By default, all apps will be checked. You can check a subset of apps by
  123. providing a list of app labels as arguments:
  124. .INDENT 0.0
  125. .INDENT 3.5
  126. .sp
  127. .EX
  128. django\-admin check auth admin myapp
  129. .EE
  130. .UNINDENT
  131. .UNINDENT
  132. .INDENT 0.0
  133. .TP
  134. .B \-\-tag TAGS, \-t TAGS
  135. .UNINDENT
  136. .sp
  137. The system check framework performs many different types of checks that are
  138. \fI\%categorized with tags\fP\&. You can use these
  139. tags to restrict the checks performed to just those in a particular category.
  140. For example, to perform only models and compatibility checks, run:
  141. .INDENT 0.0
  142. .INDENT 3.5
  143. .sp
  144. .EX
  145. django\-admin check \-\-tag models \-\-tag compatibility
  146. .EE
  147. .UNINDENT
  148. .UNINDENT
  149. .INDENT 0.0
  150. .TP
  151. .B \-\-database DATABASE
  152. .UNINDENT
  153. .sp
  154. Specifies the database to run checks requiring database access:
  155. .INDENT 0.0
  156. .INDENT 3.5
  157. .sp
  158. .EX
  159. django\-admin check \-\-database default \-\-database other
  160. .EE
  161. .UNINDENT
  162. .UNINDENT
  163. .sp
  164. By default, these checks will not be run.
  165. .INDENT 0.0
  166. .TP
  167. .B \-\-list\-tags
  168. .UNINDENT
  169. .sp
  170. Lists all available tags.
  171. .INDENT 0.0
  172. .TP
  173. .B \-\-deploy
  174. .UNINDENT
  175. .sp
  176. Activates some additional checks that are only relevant in a deployment setting.
  177. .sp
  178. You can use this option in your local development environment, but since your
  179. local development settings module may not have many of your production settings,
  180. you will probably want to point the \fBcheck\fP command at a different settings
  181. module, either by setting the \fI\%DJANGO_SETTINGS_MODULE\fP environment
  182. variable, or by passing the \fB\-\-settings\fP option:
  183. .INDENT 0.0
  184. .INDENT 3.5
  185. .sp
  186. .EX
  187. django\-admin check \-\-deploy \-\-settings=production_settings
  188. .EE
  189. .UNINDENT
  190. .UNINDENT
  191. .sp
  192. Or you could run it directly on a production or staging deployment to verify
  193. that the correct settings are in use (omitting \fB\-\-settings\fP). You could even
  194. make it part of your integration test suite.
  195. .INDENT 0.0
  196. .TP
  197. .B \-\-fail\-level {CRITICAL,ERROR,WARNING,INFO,DEBUG}
  198. .UNINDENT
  199. .sp
  200. Specifies the message level that will cause the command to exit with a non\-zero
  201. status. Default is \fBERROR\fP\&.
  202. .SS \fBcompilemessages\fP
  203. .INDENT 0.0
  204. .TP
  205. .B django\-admin compilemessages
  206. .UNINDENT
  207. .sp
  208. Compiles \fB\&.po\fP files created by \fI\%makemessages\fP to \fB\&.mo\fP files for
  209. use with the built\-in gettext support. See \fI\%Internationalization and localization\fP\&.
  210. .INDENT 0.0
  211. .TP
  212. .B \-\-locale LOCALE, \-l LOCALE
  213. .UNINDENT
  214. .sp
  215. Specifies the locale(s) to process. If not provided, all locales are processed.
  216. .INDENT 0.0
  217. .TP
  218. .B \-\-exclude EXCLUDE, \-x EXCLUDE
  219. .UNINDENT
  220. .sp
  221. Specifies the locale(s) to exclude from processing. If not provided, no locales
  222. are excluded.
  223. .INDENT 0.0
  224. .TP
  225. .B \-\-use\-fuzzy, \-f
  226. .UNINDENT
  227. .sp
  228. Includes \X'tty: link https://www.gnu.org/software/gettext/manual/html_node/Fuzzy-Entries.html'\fI\%fuzzy translations\fP\X'tty: link' into compiled files.
  229. .sp
  230. Example usage:
  231. .INDENT 0.0
  232. .INDENT 3.5
  233. .sp
  234. .EX
  235. django\-admin compilemessages \-\-locale=pt_BR
  236. django\-admin compilemessages \-\-locale=pt_BR \-\-locale=fr \-f
  237. django\-admin compilemessages \-l pt_BR
  238. django\-admin compilemessages \-l pt_BR \-l fr \-\-use\-fuzzy
  239. django\-admin compilemessages \-\-exclude=pt_BR
  240. django\-admin compilemessages \-\-exclude=pt_BR \-\-exclude=fr
  241. django\-admin compilemessages \-x pt_BR
  242. django\-admin compilemessages \-x pt_BR \-x fr
  243. .EE
  244. .UNINDENT
  245. .UNINDENT
  246. .INDENT 0.0
  247. .TP
  248. .B \-\-ignore PATTERN, \-i PATTERN
  249. .UNINDENT
  250. .sp
  251. Ignores directories matching the given \X'tty: link https://docs.python.org/3/library/glob.html#module-glob'\fI\%glob\fP\X'tty: link'\-style pattern. Use
  252. multiple times to ignore more.
  253. .sp
  254. Example usage:
  255. .INDENT 0.0
  256. .INDENT 3.5
  257. .sp
  258. .EX
  259. django\-admin compilemessages \-\-ignore=cache \-\-ignore=outdated/*/locale
  260. .EE
  261. .UNINDENT
  262. .UNINDENT
  263. .SS \fBcreatecachetable\fP
  264. .INDENT 0.0
  265. .TP
  266. .B django\-admin createcachetable
  267. .UNINDENT
  268. .sp
  269. Creates the cache tables for use with the database cache backend using the
  270. information from your settings file. See \fI\%Django\(aqs cache framework\fP for more
  271. information.
  272. .INDENT 0.0
  273. .TP
  274. .B \-\-database DATABASE
  275. .UNINDENT
  276. .sp
  277. Specifies the database in which the cache table(s) will be created. Defaults to
  278. \fBdefault\fP\&.
  279. .INDENT 0.0
  280. .TP
  281. .B \-\-dry\-run
  282. .UNINDENT
  283. .sp
  284. Prints the SQL that would be run without actually running it, so you can
  285. customize it or use the migrations framework.
  286. .SS \fBdbshell\fP
  287. .INDENT 0.0
  288. .TP
  289. .B django\-admin dbshell
  290. .UNINDENT
  291. .sp
  292. Runs the command\-line client for the database engine specified in your
  293. \fI\%ENGINE\fP setting, with the connection parameters
  294. specified in your \fI\%USER\fP, \fI\%PASSWORD\fP, etc., settings.
  295. .INDENT 0.0
  296. .IP \(bu 2
  297. For PostgreSQL, this runs the \fBpsql\fP command\-line client.
  298. .IP \(bu 2
  299. For MySQL, this runs the \fBmysql\fP command\-line client.
  300. .IP \(bu 2
  301. For SQLite, this runs the \fBsqlite3\fP command\-line client.
  302. .IP \(bu 2
  303. For Oracle, this runs the \fBsqlplus\fP command\-line client.
  304. .UNINDENT
  305. .sp
  306. This command assumes the programs are on your \fBPATH\fP so that a call to
  307. the program name (\fBpsql\fP, \fBmysql\fP, \fBsqlite3\fP, \fBsqlplus\fP) will find the
  308. program in the right place. There\(aqs no way to specify the location of the
  309. program manually.
  310. .INDENT 0.0
  311. .TP
  312. .B \-\-database DATABASE
  313. .UNINDENT
  314. .sp
  315. Specifies the database onto which to open a shell. Defaults to \fBdefault\fP\&.
  316. .INDENT 0.0
  317. .TP
  318. .B \-\- ARGUMENTS
  319. .UNINDENT
  320. .sp
  321. Any arguments following a \fB\-\-\fP divider will be passed on to the underlying
  322. command\-line client. For example, with PostgreSQL you can use the \fBpsql\fP
  323. command\(aqs \fB\-c\fP flag to execute a raw SQL query directly:
  324. .INDENT 0.0
  325. .INDENT 3.5
  326. .sp
  327. .EX
  328. $ django\-admin dbshell \-\- \-c \(aqselect current_user\(aq
  329. current_user
  330. \-\-\-\-\-\-\-\-\-\-\-\-\-\-
  331. postgres
  332. (1 row)
  333. .EE
  334. .UNINDENT
  335. .UNINDENT
  336. .sp
  337. On MySQL/MariaDB, you can do this with the \fBmysql\fP command\(aqs \fB\-e\fP flag:
  338. .INDENT 0.0
  339. .INDENT 3.5
  340. .sp
  341. .EX
  342. $ django\-admin dbshell \-\- \-e \(dqselect user()\(dq
  343. +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
  344. | user() |
  345. +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
  346. | djangonaut@localhost |
  347. +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
  348. .EE
  349. .UNINDENT
  350. .UNINDENT
  351. .sp
  352. \fBNOTE:\fP
  353. .INDENT 0.0
  354. .INDENT 3.5
  355. Be aware that not all options set in the \fI\%OPTIONS\fP part of your
  356. database configuration in \fI\%DATABASES\fP are passed to the
  357. command\-line client, e.g. \fB\(aqisolation_level\(aq\fP\&.
  358. .UNINDENT
  359. .UNINDENT
  360. .SS \fBdiffsettings\fP
  361. .INDENT 0.0
  362. .TP
  363. .B django\-admin diffsettings
  364. .UNINDENT
  365. .sp
  366. Displays differences between the current settings file and Django\(aqs default
  367. settings (or another settings file specified by \fI\%\-\-default\fP).
  368. .sp
  369. Settings that don\(aqt appear in the defaults are followed by \fB\(dq###\(dq\fP\&. For
  370. example, the default settings don\(aqt define \fI\%ROOT_URLCONF\fP, so
  371. \fI\%ROOT_URLCONF\fP is followed by \fB\(dq###\(dq\fP in the output of
  372. \fBdiffsettings\fP\&.
  373. .INDENT 0.0
  374. .TP
  375. .B \-\-all
  376. .UNINDENT
  377. .sp
  378. Displays all settings, even if they have Django\(aqs default value. Such settings
  379. are prefixed by \fB\(dq###\(dq\fP\&.
  380. .INDENT 0.0
  381. .TP
  382. .B \-\-default MODULE
  383. .UNINDENT
  384. .sp
  385. The settings module to compare the current settings against. Leave empty to
  386. compare against Django\(aqs default settings.
  387. .INDENT 0.0
  388. .TP
  389. .B \-\-output {hash,unified}
  390. .UNINDENT
  391. .sp
  392. Specifies the output format. Available values are \fBhash\fP and \fBunified\fP\&.
  393. \fBhash\fP is the default mode that displays the output that\(aqs described above.
  394. \fBunified\fP displays the output similar to \fBdiff \-u\fP\&. Default settings are
  395. prefixed with a minus sign, followed by the changed setting prefixed with a
  396. plus sign.
  397. .SS \fBdumpdata\fP
  398. .INDENT 0.0
  399. .TP
  400. .B django\-admin dumpdata [app_label[.ModelName] [app_label[.ModelName] ...]]
  401. .UNINDENT
  402. .sp
  403. Outputs to standard output all data in the database associated with the named
  404. application(s).
  405. .sp
  406. If no application name is provided, all installed applications will be dumped.
  407. .sp
  408. The output of \fBdumpdata\fP can be used as input for \fI\%loaddata\fP\&.
  409. .sp
  410. When result of \fBdumpdata\fP is saved as a file, it can serve as a
  411. \fI\%fixture\fP for
  412. \fI\%tests\fP or as an
  413. \fI\%initial data\fP\&.
  414. .sp
  415. Note that \fBdumpdata\fP uses the default manager on the model for selecting the
  416. records to dump. If you\(aqre using a \fI\%custom manager\fP as
  417. the default manager and it filters some of the available records, not all of the
  418. objects will be dumped.
  419. .INDENT 0.0
  420. .TP
  421. .B \-\-all, \-a
  422. .UNINDENT
  423. .sp
  424. Uses Django\(aqs base manager, dumping records which might otherwise be filtered
  425. or modified by a custom manager.
  426. .INDENT 0.0
  427. .TP
  428. .B \-\-format FORMAT
  429. .UNINDENT
  430. .sp
  431. Specifies the serialization format of the output. Defaults to JSON. Supported
  432. formats are listed in \fI\%Serialization formats\fP\&.
  433. .INDENT 0.0
  434. .TP
  435. .B \-\-indent INDENT
  436. .UNINDENT
  437. .sp
  438. Specifies the number of indentation spaces to use in the output. Defaults to
  439. \fBNone\fP which displays all data on single line.
  440. .INDENT 0.0
  441. .TP
  442. .B \-\-exclude EXCLUDE, \-e EXCLUDE
  443. .UNINDENT
  444. .sp
  445. Prevents specific applications or models (specified in the form of
  446. \fBapp_label.ModelName\fP) from being dumped. If you specify a model name, then
  447. only that model will be excluded, rather than the entire application. You can
  448. also mix application names and model names.
  449. .sp
  450. If you want to exclude multiple applications, pass \fB\-\-exclude\fP more than
  451. once:
  452. .INDENT 0.0
  453. .INDENT 3.5
  454. .sp
  455. .EX
  456. django\-admin dumpdata \-\-exclude=auth \-\-exclude=contenttypes
  457. .EE
  458. .UNINDENT
  459. .UNINDENT
  460. .INDENT 0.0
  461. .TP
  462. .B \-\-database DATABASE
  463. .UNINDENT
  464. .sp
  465. Specifies the database from which data will be dumped. Defaults to \fBdefault\fP\&.
  466. .INDENT 0.0
  467. .TP
  468. .B \-\-natural\-foreign
  469. .UNINDENT
  470. .sp
  471. Uses the \fBnatural_key()\fP model method to serialize any foreign key and
  472. many\-to\-many relationship to objects of the type that defines the method. If
  473. you\(aqre dumping \fBcontrib.auth\fP \fBPermission\fP objects or
  474. \fBcontrib.contenttypes\fP \fBContentType\fP objects, you should probably use this
  475. flag. See the \fI\%natural keys\fP
  476. documentation for more details on this and the next option.
  477. .INDENT 0.0
  478. .TP
  479. .B \-\-natural\-primary
  480. .UNINDENT
  481. .sp
  482. Omits the primary key in the serialized data of this object since it can be
  483. calculated during deserialization.
  484. .INDENT 0.0
  485. .TP
  486. .B \-\-pks PRIMARY_KEYS
  487. .UNINDENT
  488. .sp
  489. Outputs only the objects specified by a comma separated list of primary keys.
  490. This is only available when dumping one model. By default, all the records of
  491. the model are output.
  492. .INDENT 0.0
  493. .TP
  494. .B \-\-output OUTPUT, \-o OUTPUT
  495. .UNINDENT
  496. .sp
  497. Specifies a file to write the serialized data to. By default, the data goes to
  498. standard output.
  499. .sp
  500. When this option is set and \fB\-\-verbosity\fP is greater than 0 (the default), a
  501. progress bar is shown in the terminal.
  502. .SS Fixtures compression
  503. .sp
  504. The output file can be compressed with one of the \fBbz2\fP, \fBgz\fP, \fBlzma\fP, or
  505. \fBxz\fP formats by ending the filename with the corresponding extension.
  506. For example, to output the data as a compressed JSON file:
  507. .INDENT 0.0
  508. .INDENT 3.5
  509. .sp
  510. .EX
  511. django\-admin dumpdata \-o mydata.json.gz
  512. .EE
  513. .UNINDENT
  514. .UNINDENT
  515. .SS \fBflush\fP
  516. .INDENT 0.0
  517. .TP
  518. .B django\-admin flush
  519. .UNINDENT
  520. .sp
  521. Removes all data from the database and re\-executes any post\-synchronization
  522. handlers. The table of which migrations have been applied is not cleared.
  523. .sp
  524. If you would rather start from an empty database and rerun all migrations, you
  525. should drop and recreate the database and then run \fI\%migrate\fP instead.
  526. .INDENT 0.0
  527. .TP
  528. .B \-\-noinput, \-\-no\-input
  529. .UNINDENT
  530. .sp
  531. Suppresses all user prompts.
  532. .INDENT 0.0
  533. .TP
  534. .B \-\-database DATABASE
  535. .UNINDENT
  536. .sp
  537. Specifies the database to flush. Defaults to \fBdefault\fP\&.
  538. .SS \fBinspectdb\fP
  539. .INDENT 0.0
  540. .TP
  541. .B django\-admin inspectdb [table [table ...]]
  542. .UNINDENT
  543. .sp
  544. Introspects the database tables in the database pointed\-to by the
  545. \fI\%NAME\fP setting and outputs a Django model module (a \fBmodels.py\fP
  546. file) to standard output.
  547. .sp
  548. You may choose what tables or views to inspect by passing their names as
  549. arguments. If no arguments are provided, models are created for views only if
  550. the \fI\%\-\-include\-views\fP option is used. Models for partition tables are
  551. created on PostgreSQL if the \fI\%\-\-include\-partitions\fP option is used.
  552. .sp
  553. Use this if you have a legacy database with which you\(aqd like to use Django.
  554. The script will inspect the database and create a model for each table within
  555. it.
  556. .sp
  557. As you might expect, the created models will have an attribute for every field
  558. in the table. Note that \fBinspectdb\fP has a few special cases in its field\-name
  559. output:
  560. .INDENT 0.0
  561. .IP \(bu 2
  562. If \fBinspectdb\fP cannot map a column\(aqs type to a model field type, it\(aqll
  563. use \fBTextField\fP and will insert the Python comment
  564. \fB\(aqThis field type is a guess.\(aq\fP next to the field in the generated
  565. model. The recognized fields may depend on apps listed in
  566. \fI\%INSTALLED_APPS\fP\&. For example, \fI\%django.contrib.postgres\fP adds
  567. recognition for several PostgreSQL\-specific field types.
  568. .IP \(bu 2
  569. If the database column name is a Python reserved word (such as
  570. \fB\(aqpass\(aq\fP, \fB\(aqclass\(aq\fP or \fB\(aqfor\(aq\fP), \fBinspectdb\fP will append
  571. \fB\(aq_field\(aq\fP to the attribute name. For example, if a table has a column
  572. \fB\(aqfor\(aq\fP, the generated model will have a field \fB\(aqfor_field\(aq\fP, with
  573. the \fBdb_column\fP attribute set to \fB\(aqfor\(aq\fP\&. \fBinspectdb\fP will insert
  574. the Python comment
  575. \fB\(aqField renamed because it was a Python reserved word.\(aq\fP next to the
  576. field.
  577. .UNINDENT
  578. .sp
  579. This feature is meant as a shortcut, not as definitive model generation. After
  580. you run it, you\(aqll want to look over the generated models yourself to make
  581. customizations. In particular, you\(aqll need to rearrange models\(aq order, so that
  582. models that refer to other models are ordered properly.
  583. .sp
  584. Django doesn\(aqt create database defaults when a
  585. \fI\%default\fP is specified on a model field.
  586. Similarly, database defaults aren\(aqt translated to model field defaults or
  587. detected in any fashion by \fBinspectdb\fP\&.
  588. .sp
  589. By default, \fBinspectdb\fP creates unmanaged models. That is, \fBmanaged = False\fP
  590. in the model\(aqs \fBMeta\fP class tells Django not to manage each table\(aqs creation,
  591. modification, and deletion. If you do want to allow Django to manage the
  592. table\(aqs lifecycle, you\(aqll need to change the
  593. \fI\%managed\fP option to \fBTrue\fP (or remove
  594. it because \fBTrue\fP is its default value).
  595. .SS Database\-specific notes
  596. .SS Oracle
  597. .INDENT 0.0
  598. .IP \(bu 2
  599. Models are created for materialized views if \fI\%\-\-include\-views\fP is
  600. used.
  601. .UNINDENT
  602. .SS PostgreSQL
  603. .INDENT 0.0
  604. .IP \(bu 2
  605. Models are created for foreign tables.
  606. .IP \(bu 2
  607. Models are created for materialized views if
  608. \fI\%\-\-include\-views\fP is used.
  609. .IP \(bu 2
  610. Models are created for partition tables if
  611. \fI\%\-\-include\-partitions\fP is used.
  612. .UNINDENT
  613. .INDENT 0.0
  614. .TP
  615. .B \-\-database DATABASE
  616. .UNINDENT
  617. .sp
  618. Specifies the database to introspect. Defaults to \fBdefault\fP\&.
  619. .INDENT 0.0
  620. .TP
  621. .B \-\-include\-partitions
  622. .UNINDENT
  623. .sp
  624. If this option is provided, models are also created for partitions.
  625. .sp
  626. Only support for PostgreSQL is implemented.
  627. .INDENT 0.0
  628. .TP
  629. .B \-\-include\-views
  630. .UNINDENT
  631. .sp
  632. If this option is provided, models are also created for database views.
  633. .SS \fBloaddata\fP
  634. .INDENT 0.0
  635. .TP
  636. .B django\-admin loaddata fixture [fixture ...]
  637. .UNINDENT
  638. .sp
  639. Searches for and loads the contents of the named
  640. \fI\%fixture\fP into the database.
  641. .INDENT 0.0
  642. .TP
  643. .B \-\-database DATABASE
  644. .UNINDENT
  645. .sp
  646. Specifies the database into which the data will be loaded. Defaults to
  647. \fBdefault\fP\&.
  648. .INDENT 0.0
  649. .TP
  650. .B \-\-ignorenonexistent, \-i
  651. .UNINDENT
  652. .sp
  653. Ignores fields and models that may have been removed since the fixture was
  654. originally generated.
  655. .INDENT 0.0
  656. .TP
  657. .B \-\-app APP_LABEL
  658. .UNINDENT
  659. .sp
  660. Specifies a single app to look for fixtures in rather than looking in all apps.
  661. .INDENT 0.0
  662. .TP
  663. .B \-\-format FORMAT
  664. .UNINDENT
  665. .sp
  666. Specifies the \fI\%serialization format\fP (e.g.,
  667. \fBjson\fP or \fBxml\fP) for fixtures \fI\%read from stdin\fP\&.
  668. .INDENT 0.0
  669. .TP
  670. .B \-\-exclude EXCLUDE, \-e EXCLUDE
  671. .UNINDENT
  672. .sp
  673. Excludes loading the fixtures from the given applications and/or models (in the
  674. form of \fBapp_label\fP or \fBapp_label.ModelName\fP). Use the option multiple
  675. times to exclude more than one app or model.
  676. .SS Loading fixtures from \fBstdin\fP
  677. .sp
  678. You can use a dash as the fixture name to load input from \fBsys.stdin\fP\&. For
  679. example:
  680. .INDENT 0.0
  681. .INDENT 3.5
  682. .sp
  683. .EX
  684. django\-admin loaddata \-\-format=json \-
  685. .EE
  686. .UNINDENT
  687. .UNINDENT
  688. .sp
  689. When reading from \fBstdin\fP, the \fI\%\-\-format\fP option
  690. is required to specify the \fI\%serialization format\fP
  691. of the input (e.g., \fBjson\fP or \fBxml\fP).
  692. .sp
  693. Loading from \fBstdin\fP is useful with standard input and output redirections.
  694. For example:
  695. .INDENT 0.0
  696. .INDENT 3.5
  697. .sp
  698. .EX
  699. django\-admin dumpdata \-\-format=json \-\-database=test app_label.ModelName | django\-admin loaddata \-\-format=json \-\-database=prod \-
  700. .EE
  701. .UNINDENT
  702. .UNINDENT
  703. .sp
  704. The \fI\%dumpdata\fP command can be used to generate input for \fBloaddata\fP\&.
  705. .sp
  706. \fBSEE ALSO:\fP
  707. .INDENT 0.0
  708. .INDENT 3.5
  709. For more detail about fixtures see the \fI\%Fixtures\fP topic.
  710. .UNINDENT
  711. .UNINDENT
  712. .SS \fBmakemessages\fP
  713. .INDENT 0.0
  714. .TP
  715. .B django\-admin makemessages
  716. .UNINDENT
  717. .sp
  718. Runs over the entire source tree of the current directory and pulls out all
  719. strings marked for translation. It creates (or updates) a message file in the
  720. conf/locale (in the Django tree) or locale (for project and application)
  721. directory. After making changes to the messages files you need to compile them
  722. with \fI\%compilemessages\fP for use with the builtin gettext support. See
  723. the \fI\%i18n documentation\fP for details.
  724. .sp
  725. This command doesn\(aqt require configured settings. However, when settings aren\(aqt
  726. configured, the command can\(aqt ignore the \fI\%MEDIA_ROOT\fP and
  727. \fI\%STATIC_ROOT\fP directories or include \fI\%LOCALE_PATHS\fP\&.
  728. .INDENT 0.0
  729. .TP
  730. .B \-\-all, \-a
  731. .UNINDENT
  732. .sp
  733. Updates the message files for all available languages.
  734. .INDENT 0.0
  735. .TP
  736. .B \-\-extension EXTENSIONS, \-e EXTENSIONS
  737. .UNINDENT
  738. .sp
  739. Specifies a list of file extensions to examine (default: \fBhtml\fP, \fBtxt\fP,
  740. \fBpy\fP or \fBjs\fP if \fI\%\-\-domain\fP is \fBdjangojs\fP).
  741. .sp
  742. Example usage:
  743. .INDENT 0.0
  744. .INDENT 3.5
  745. .sp
  746. .EX
  747. django\-admin makemessages \-\-locale=de \-\-extension xhtml
  748. .EE
  749. .UNINDENT
  750. .UNINDENT
  751. .sp
  752. Separate multiple extensions with commas or use \fB\-e\fP or \fB\-\-extension\fP
  753. multiple times:
  754. .INDENT 0.0
  755. .INDENT 3.5
  756. .sp
  757. .EX
  758. django\-admin makemessages \-\-locale=de \-\-extension=html,txt \-\-extension xml
  759. .EE
  760. .UNINDENT
  761. .UNINDENT
  762. .INDENT 0.0
  763. .TP
  764. .B \-\-locale LOCALE, \-l LOCALE
  765. .UNINDENT
  766. .sp
  767. Specifies the locale(s) to process.
  768. .INDENT 0.0
  769. .TP
  770. .B \-\-exclude EXCLUDE, \-x EXCLUDE
  771. .UNINDENT
  772. .sp
  773. Specifies the locale(s) to exclude from processing. If not provided, no locales
  774. are excluded.
  775. .sp
  776. Example usage:
  777. .INDENT 0.0
  778. .INDENT 3.5
  779. .sp
  780. .EX
  781. django\-admin makemessages \-\-locale=pt_BR
  782. django\-admin makemessages \-\-locale=pt_BR \-\-locale=fr
  783. django\-admin makemessages \-l pt_BR
  784. django\-admin makemessages \-l pt_BR \-l fr
  785. django\-admin makemessages \-\-exclude=pt_BR
  786. django\-admin makemessages \-\-exclude=pt_BR \-\-exclude=fr
  787. django\-admin makemessages \-x pt_BR
  788. django\-admin makemessages \-x pt_BR \-x fr
  789. .EE
  790. .UNINDENT
  791. .UNINDENT
  792. .INDENT 0.0
  793. .TP
  794. .B \-\-domain DOMAIN, \-d DOMAIN
  795. .UNINDENT
  796. .sp
  797. Specifies the domain of the messages files. Supported options are:
  798. .INDENT 0.0
  799. .IP \(bu 2
  800. \fBdjango\fP for all \fB*.py\fP, \fB*.html\fP and \fB*.txt\fP files (default)
  801. .IP \(bu 2
  802. \fBdjangojs\fP for \fB*.js\fP files
  803. .UNINDENT
  804. .INDENT 0.0
  805. .TP
  806. .B \-\-symlinks, \-s
  807. .UNINDENT
  808. .sp
  809. Follows symlinks to directories when looking for new translation strings.
  810. .sp
  811. Example usage:
  812. .INDENT 0.0
  813. .INDENT 3.5
  814. .sp
  815. .EX
  816. django\-admin makemessages \-\-locale=de \-\-symlinks
  817. .EE
  818. .UNINDENT
  819. .UNINDENT
  820. .INDENT 0.0
  821. .TP
  822. .B \-\-ignore PATTERN, \-i PATTERN
  823. .UNINDENT
  824. .sp
  825. Ignores files or directories matching the given \X'tty: link https://docs.python.org/3/library/glob.html#module-glob'\fI\%glob\fP\X'tty: link'\-style pattern. Use
  826. multiple times to ignore more.
  827. .sp
  828. These patterns are used by default: \fB\(aqCVS\(aq\fP, \fB\(aq.*\(aq\fP, \fB\(aq*~\(aq\fP, \fB\(aq*.pyc\(aq\fP\&.
  829. .sp
  830. Example usage:
  831. .INDENT 0.0
  832. .INDENT 3.5
  833. .sp
  834. .EX
  835. django\-admin makemessages \-\-locale=en_US \-\-ignore=apps/* \-\-ignore=secret/*.html
  836. .EE
  837. .UNINDENT
  838. .UNINDENT
  839. .INDENT 0.0
  840. .TP
  841. .B \-\-no\-default\-ignore
  842. .UNINDENT
  843. .sp
  844. Disables the default values of \fB\-\-ignore\fP\&.
  845. .INDENT 0.0
  846. .TP
  847. .B \-\-no\-wrap
  848. .UNINDENT
  849. .sp
  850. Disables breaking long message lines into several lines in language files.
  851. .INDENT 0.0
  852. .TP
  853. .B \-\-no\-location
  854. .UNINDENT
  855. .sp
  856. Suppresses writing \(aq\fB#: filename:line\fP’ comment lines in language files.
  857. Using this option makes it harder for technically skilled translators to
  858. understand each message\(aqs context.
  859. .INDENT 0.0
  860. .TP
  861. .B \-\-add\-location [{full,file,never}]
  862. .UNINDENT
  863. .sp
  864. Controls \fB#: filename:line\fP comment lines in language files. If the option
  865. is:
  866. .INDENT 0.0
  867. .IP \(bu 2
  868. \fBfull\fP (the default if not given): the lines include both file name and
  869. line number.
  870. .IP \(bu 2
  871. \fBfile\fP: the line number is omitted.
  872. .IP \(bu 2
  873. \fBnever\fP: the lines are suppressed (same as \fI\%\-\-no\-location\fP).
  874. .UNINDENT
  875. .sp
  876. Requires \fBgettext\fP 0.19 or newer.
  877. .INDENT 0.0
  878. .TP
  879. .B \-\-no\-obsolete
  880. .UNINDENT
  881. .sp
  882. Removes obsolete message strings from the \fB\&.po\fP files.
  883. .INDENT 0.0
  884. .TP
  885. .B \-\-keep\-pot
  886. .UNINDENT
  887. .sp
  888. Prevents deleting the temporary \fB\&.pot\fP files generated before creating the
  889. \fB\&.po\fP file. This is useful for debugging errors which may prevent the final
  890. language files from being created.
  891. .sp
  892. \fBSEE ALSO:\fP
  893. .INDENT 0.0
  894. .INDENT 3.5
  895. See \fI\%Customizing the makemessages command\fP for instructions on how to customize
  896. the keywords that \fI\%makemessages\fP passes to \fBxgettext\fP\&.
  897. .UNINDENT
  898. .UNINDENT
  899. .SS \fBmakemigrations\fP
  900. .INDENT 0.0
  901. .TP
  902. .B django\-admin makemigrations [app_label [app_label ...]]
  903. .UNINDENT
  904. .sp
  905. Creates new migrations based on the changes detected to your models.
  906. Migrations, their relationship with apps and more are covered in depth in
  907. \fI\%the migrations documentation\fP\&.
  908. .sp
  909. Providing one or more app names as arguments will limit the migrations created
  910. to the app(s) specified and any dependencies needed (the table at the other end
  911. of a \fBForeignKey\fP, for example).
  912. .sp
  913. To add migrations to an app that doesn\(aqt have a \fBmigrations\fP directory, run
  914. \fBmakemigrations\fP with the app\(aqs \fBapp_label\fP\&.
  915. .INDENT 0.0
  916. .TP
  917. .B \-\-noinput, \-\-no\-input
  918. .UNINDENT
  919. .sp
  920. Suppresses all user prompts. If a suppressed prompt cannot be resolved
  921. automatically, the command will exit with error code 3.
  922. .INDENT 0.0
  923. .TP
  924. .B \-\-empty
  925. .UNINDENT
  926. .sp
  927. Outputs an empty migration for the specified apps, for manual editing. This is
  928. for advanced users and should not be used unless you are familiar with the
  929. migration format, migration operations, and the dependencies between your
  930. migrations.
  931. .INDENT 0.0
  932. .TP
  933. .B \-\-dry\-run
  934. .UNINDENT
  935. .sp
  936. Shows what migrations would be made without actually writing any migrations
  937. files to disk. Using this option along with \fB\-\-verbosity 3\fP will also show
  938. the complete migrations files that would be written.
  939. .INDENT 0.0
  940. .TP
  941. .B \-\-merge
  942. .UNINDENT
  943. .sp
  944. Enables fixing of migration conflicts.
  945. .INDENT 0.0
  946. .TP
  947. .B \-\-name NAME, \-n NAME
  948. .UNINDENT
  949. .sp
  950. Allows naming the generated migration(s) instead of using a generated name. The
  951. name must be a valid Python \X'tty: link https://docs.python.org/3/reference/lexical_analysis.html#identifiers'\fI\%identifier\fP\X'tty: link'\&.
  952. .INDENT 0.0
  953. .TP
  954. .B \-\-no\-header
  955. .UNINDENT
  956. .sp
  957. Generate migration files without Django version and timestamp header.
  958. .INDENT 0.0
  959. .TP
  960. .B \-\-check
  961. .UNINDENT
  962. .sp
  963. Makes \fBmakemigrations\fP exit with a non\-zero status when model changes without
  964. migrations are detected. Implies \fB\-\-dry\-run\fP\&.
  965. .INDENT 0.0
  966. .TP
  967. .B \-\-scriptable
  968. .UNINDENT
  969. .sp
  970. Diverts log output and input prompts to \fBstderr\fP, writing only paths of
  971. generated migration files to \fBstdout\fP\&.
  972. .INDENT 0.0
  973. .TP
  974. .B \-\-update
  975. .UNINDENT
  976. .sp
  977. Merges model changes into the latest migration and optimize the resulting
  978. operations.
  979. .sp
  980. The updated migration will have a generated name. In order to preserve the
  981. previous name, set it using \fB\-\-name\fP\&.
  982. .SS \fBmigrate\fP
  983. .INDENT 0.0
  984. .TP
  985. .B django\-admin migrate [app_label] [migration_name]
  986. .UNINDENT
  987. .sp
  988. Synchronizes the database state with the current set of models and migrations.
  989. Migrations, their relationship with apps and more are covered in depth in
  990. \fI\%the migrations documentation\fP\&.
  991. .sp
  992. The behavior of this command changes depending on the arguments provided:
  993. .INDENT 0.0
  994. .IP \(bu 2
  995. No arguments: All apps have all of their migrations run.
  996. .IP \(bu 2
  997. \fB<app_label>\fP: The specified app has its migrations run, up to the most
  998. recent migration. This may involve running other apps\(aq migrations too, due
  999. to dependencies.
  1000. .IP \(bu 2
  1001. \fB<app_label> <migrationname>\fP: Brings the database schema to a state where
  1002. the named migration is applied, but no later migrations in the same app are
  1003. applied. This may involve unapplying migrations if you have previously
  1004. migrated past the named migration. You can use a prefix of the migration
  1005. name, e.g. \fB0001\fP, as long as it\(aqs unique for the given app name. Use the
  1006. name \fBzero\fP to migrate all the way back i.e. to revert all applied
  1007. migrations for an app.
  1008. .UNINDENT
  1009. .sp
  1010. \fBWARNING:\fP
  1011. .INDENT 0.0
  1012. .INDENT 3.5
  1013. When unapplying migrations, all dependent migrations will also be
  1014. unapplied, regardless of \fB<app_label>\fP\&. You can use \fB\-\-plan\fP to check
  1015. which migrations will be unapplied.
  1016. .UNINDENT
  1017. .UNINDENT
  1018. .INDENT 0.0
  1019. .TP
  1020. .B \-\-database DATABASE
  1021. .UNINDENT
  1022. .sp
  1023. Specifies the database to migrate. Defaults to \fBdefault\fP\&.
  1024. .INDENT 0.0
  1025. .TP
  1026. .B \-\-fake
  1027. .UNINDENT
  1028. .sp
  1029. Marks the migrations up to the target one (following the rules above) as
  1030. applied, but without actually running the SQL to change your database schema.
  1031. .sp
  1032. This is intended for advanced users to manipulate the
  1033. current migration state directly if they\(aqre manually applying changes;
  1034. be warned that using \fB\-\-fake\fP runs the risk of putting the migration state
  1035. table into a state where manual recovery will be needed to make migrations
  1036. run correctly.
  1037. .INDENT 0.0
  1038. .TP
  1039. .B \-\-fake\-initial
  1040. .UNINDENT
  1041. .sp
  1042. Allows Django to skip an app\(aqs initial migration if all database tables with
  1043. the names of all models created by all
  1044. \fI\%CreateModel\fP operations in that
  1045. migration already exist. This option is intended for use when first running
  1046. migrations against a database that preexisted the use of migrations. This
  1047. option does not, however, check for matching database schema beyond matching
  1048. table names and so is only safe to use if you are confident that your existing
  1049. schema matches what is recorded in your initial migration.
  1050. .INDENT 0.0
  1051. .TP
  1052. .B \-\-plan
  1053. .UNINDENT
  1054. .sp
  1055. Shows the migration operations that will be performed for the given \fBmigrate\fP
  1056. command.
  1057. .INDENT 0.0
  1058. .TP
  1059. .B \-\-run\-syncdb
  1060. .UNINDENT
  1061. .sp
  1062. Allows creating tables for apps without migrations. While this isn\(aqt
  1063. recommended, the migrations framework is sometimes too slow on large projects
  1064. with hundreds of models.
  1065. .INDENT 0.0
  1066. .TP
  1067. .B \-\-noinput, \-\-no\-input
  1068. .UNINDENT
  1069. .sp
  1070. Suppresses all user prompts. An example prompt is asking about removing stale
  1071. content types.
  1072. .INDENT 0.0
  1073. .TP
  1074. .B \-\-check
  1075. .UNINDENT
  1076. .sp
  1077. Makes \fBmigrate\fP exit with a non\-zero status when unapplied migrations are
  1078. detected.
  1079. .INDENT 0.0
  1080. .TP
  1081. .B \-\-prune
  1082. .UNINDENT
  1083. .sp
  1084. Deletes nonexistent migrations from the \fBdjango_migrations\fP table. This is
  1085. useful when migration files replaced by a squashed migration have been removed.
  1086. See \fI\%Squashing migrations\fP for more details.
  1087. .SS \fBoptimizemigration\fP
  1088. .INDENT 0.0
  1089. .TP
  1090. .B django\-admin optimizemigration app_label migration_name
  1091. .UNINDENT
  1092. .sp
  1093. Optimizes the operations for the named migration and overrides the existing
  1094. file. If the migration contains functions that must be manually copied, the
  1095. command creates a new migration file suffixed with \fB_optimized\fP that is meant
  1096. to replace the named migration.
  1097. .INDENT 0.0
  1098. .TP
  1099. .B \-\-check
  1100. .UNINDENT
  1101. .sp
  1102. Makes \fBoptimizemigration\fP exit with a non\-zero status when a migration can be
  1103. optimized.
  1104. .SS \fBrunserver\fP
  1105. .INDENT 0.0
  1106. .TP
  1107. .B django\-admin runserver [addrport]
  1108. .UNINDENT
  1109. .sp
  1110. Starts a lightweight development web server on the local machine. By default,
  1111. the server runs on port 8000 on the IP address \fB127.0.0.1\fP\&. You can pass in an
  1112. IP address and port number explicitly.
  1113. .sp
  1114. If you run this script as a user with normal privileges (recommended), you
  1115. might not have access to start a port on a low port number. Low port numbers
  1116. are reserved for the superuser (root).
  1117. .sp
  1118. This server uses the WSGI application object specified by the
  1119. \fI\%WSGI_APPLICATION\fP setting.
  1120. .sp
  1121. \fBWARNING:\fP
  1122. .INDENT 0.0
  1123. .INDENT 3.5
  1124. DO NOT USE THIS SERVER IN A PRODUCTION SETTING.
  1125. .sp
  1126. This lightweight development server has not gone through security audits or
  1127. performance tests, hence is unsuitable for production. Making this server
  1128. able to handle a production environment is outside the scope of Django.
  1129. .UNINDENT
  1130. .UNINDENT
  1131. .sp
  1132. The development server automatically reloads Python code for each request, as
  1133. needed. You don\(aqt need to restart the server for code changes to take effect.
  1134. However, some actions like adding files don\(aqt trigger a restart, so you\(aqll
  1135. have to restart the server in these cases.
  1136. .sp
  1137. If you\(aqre using Linux or MacOS and install both \X'tty: link https://pypi.org/project/pywatchman/'\fI\%pywatchman\fP\X'tty: link' and the
  1138. \X'tty: link https://facebook.github.io/watchman/'\fI\%Watchman\fP\X'tty: link' service, kernel signals will be used to autoreload the server
  1139. (rather than polling file modification timestamps each second). This offers
  1140. better performance on large projects, reduced response time after code changes,
  1141. more robust change detection, and a reduction in power usage. Django supports
  1142. \fBpywatchman\fP 1.2.0 and higher.
  1143. .INDENT 0.0
  1144. .INDENT 3.5
  1145. .IP "Large directories with many files may cause performance issues"
  1146. .sp
  1147. When using Watchman with a project that includes large non\-Python
  1148. directories like \fBnode_modules\fP, it\(aqs advisable to ignore this directory
  1149. for optimal performance. See the \X'tty: link https://facebook.github.io/watchman/docs/config#ignore_dirs'\fI\%watchman documentation\fP\X'tty: link' for information
  1150. on how to do this.
  1151. .UNINDENT
  1152. .UNINDENT
  1153. .INDENT 0.0
  1154. .INDENT 3.5
  1155. .IP "Watchman timeout"
  1156. .INDENT 0.0
  1157. .TP
  1158. .B DJANGO_WATCHMAN_TIMEOUT
  1159. .UNINDENT
  1160. .sp
  1161. The default timeout of \fBWatchman\fP client is 5 seconds. You can change it
  1162. by setting the \fI\%DJANGO_WATCHMAN_TIMEOUT\fP environment variable.
  1163. .UNINDENT
  1164. .UNINDENT
  1165. .sp
  1166. When you start the server, and each time you change Python code while the
  1167. server is running, the system check framework will check your entire Django
  1168. project for some common errors (see the \fI\%check\fP command). If any
  1169. errors are found, they will be printed to standard output. You can use the
  1170. \fB\-\-skip\-checks\fP option to skip running system checks.
  1171. .sp
  1172. You can run as many concurrent servers as you want, as long as they\(aqre on
  1173. separate ports by executing \fBdjango\-admin runserver\fP more than once.
  1174. .sp
  1175. Note that the default IP address, \fB127.0.0.1\fP, is not accessible from other
  1176. machines on your network. To make your development server viewable to other
  1177. machines on the network, use its own IP address (e.g. \fB192.168.2.1\fP), \fB0\fP
  1178. (shortcut for \fB0.0.0.0\fP), \fB0.0.0.0\fP, or \fB::\fP (with IPv6 enabled).
  1179. .sp
  1180. You can provide an IPv6 address surrounded by brackets
  1181. (e.g. \fB[200a::1]:8000\fP). This will automatically enable IPv6 support.
  1182. .sp
  1183. A hostname containing ASCII\-only characters can also be used.
  1184. .sp
  1185. If the \fI\%staticfiles\fP contrib app is enabled
  1186. (default in new projects) the \fI\%runserver\fP command will be overridden
  1187. with its own \fI\%runserver\fP command.
  1188. .sp
  1189. Logging of each request and response of the server is sent to the
  1190. \fI\%django.server\fP logger.
  1191. .INDENT 0.0
  1192. .TP
  1193. .B \-\-noreload
  1194. .UNINDENT
  1195. .sp
  1196. Disables the auto\-reloader. This means any Python code changes you make while
  1197. the server is running will \fInot\fP take effect if the particular Python modules
  1198. have already been loaded into memory.
  1199. .INDENT 0.0
  1200. .TP
  1201. .B \-\-nothreading
  1202. .UNINDENT
  1203. .sp
  1204. Disables use of threading in the development server. The server is
  1205. multithreaded by default.
  1206. .INDENT 0.0
  1207. .TP
  1208. .B \-\-ipv6, \-6
  1209. .UNINDENT
  1210. .sp
  1211. Uses IPv6 for the development server. This changes the default IP address from
  1212. \fB127.0.0.1\fP to \fB::1\fP\&.
  1213. .INDENT 0.0
  1214. .TP
  1215. .B HIDE_PRODUCTION_WARNING
  1216. .UNINDENT
  1217. .sp
  1218. .sp
  1219. By default, a warning is printed to the console that \fBrunserver\fP is not
  1220. suitable for production:
  1221. .INDENT 0.0
  1222. .INDENT 3.5
  1223. .sp
  1224. .EX
  1225. WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.
  1226. For more information on production servers see: https://docs.djangoproject.com/en/|version|/howto/deployment/
  1227. .EE
  1228. .UNINDENT
  1229. .UNINDENT
  1230. .sp
  1231. Set this environment variable to \fB\(dqtrue\(dq\fP to hide this warning.
  1232. .SS Examples of using different ports and addresses
  1233. .sp
  1234. Port 8000 on IP address \fB127.0.0.1\fP:
  1235. .INDENT 0.0
  1236. .INDENT 3.5
  1237. .sp
  1238. .EX
  1239. django\-admin runserver
  1240. .EE
  1241. .UNINDENT
  1242. .UNINDENT
  1243. .sp
  1244. Port 8000 on IP address \fB1.2.3.4\fP:
  1245. .INDENT 0.0
  1246. .INDENT 3.5
  1247. .sp
  1248. .EX
  1249. django\-admin runserver 1.2.3.4:8000
  1250. .EE
  1251. .UNINDENT
  1252. .UNINDENT
  1253. .sp
  1254. Port 7000 on IP address \fB127.0.0.1\fP:
  1255. .INDENT 0.0
  1256. .INDENT 3.5
  1257. .sp
  1258. .EX
  1259. django\-admin runserver 7000
  1260. .EE
  1261. .UNINDENT
  1262. .UNINDENT
  1263. .sp
  1264. Port 7000 on IP address \fB1.2.3.4\fP:
  1265. .INDENT 0.0
  1266. .INDENT 3.5
  1267. .sp
  1268. .EX
  1269. django\-admin runserver 1.2.3.4:7000
  1270. .EE
  1271. .UNINDENT
  1272. .UNINDENT
  1273. .sp
  1274. Port 8000 on IPv6 address \fB::1\fP:
  1275. .INDENT 0.0
  1276. .INDENT 3.5
  1277. .sp
  1278. .EX
  1279. django\-admin runserver \-6
  1280. .EE
  1281. .UNINDENT
  1282. .UNINDENT
  1283. .sp
  1284. Port 7000 on IPv6 address \fB::1\fP:
  1285. .INDENT 0.0
  1286. .INDENT 3.5
  1287. .sp
  1288. .EX
  1289. django\-admin runserver \-6 7000
  1290. .EE
  1291. .UNINDENT
  1292. .UNINDENT
  1293. .sp
  1294. Port 7000 on IPv6 address \fB2001:0db8:1234:5678::9\fP:
  1295. .INDENT 0.0
  1296. .INDENT 3.5
  1297. .sp
  1298. .EX
  1299. django\-admin runserver [2001:0db8:1234:5678::9]:7000
  1300. .EE
  1301. .UNINDENT
  1302. .UNINDENT
  1303. .sp
  1304. Port 8000 on IPv4 address of host \fBlocalhost\fP:
  1305. .INDENT 0.0
  1306. .INDENT 3.5
  1307. .sp
  1308. .EX
  1309. django\-admin runserver localhost:8000
  1310. .EE
  1311. .UNINDENT
  1312. .UNINDENT
  1313. .sp
  1314. Port 8000 on IPv6 address of host \fBlocalhost\fP:
  1315. .INDENT 0.0
  1316. .INDENT 3.5
  1317. .sp
  1318. .EX
  1319. django\-admin runserver \-6 localhost:8000
  1320. .EE
  1321. .UNINDENT
  1322. .UNINDENT
  1323. .SS Serving static files with the development server
  1324. .sp
  1325. By default, the development server doesn\(aqt serve any static files for your site
  1326. (such as CSS files, images, things under \fI\%MEDIA_URL\fP and so forth). If
  1327. you want to configure Django to serve static media, read
  1328. \fI\%How to manage static files (e.g. images, JavaScript, CSS)\fP\&.
  1329. .SS Serving with ASGI in development
  1330. .sp
  1331. Django\(aqs \fBrunserver\fP command provides a WSGI server. In order to run under
  1332. ASGI you will need to use an \fI\%ASGI server\fP\&.
  1333. The Django Daphne project provides \fI\%Integration with runserver\fP that you can use.
  1334. .SS \fBsendtestemail\fP
  1335. .INDENT 0.0
  1336. .TP
  1337. .B django\-admin sendtestemail [email [email ...]]
  1338. .UNINDENT
  1339. .sp
  1340. Sends a test email (to confirm email sending through Django is working) to the
  1341. recipient(s) specified. For example:
  1342. .INDENT 0.0
  1343. .INDENT 3.5
  1344. .sp
  1345. .EX
  1346. django\-admin sendtestemail foo@example.com bar@example.com
  1347. .EE
  1348. .UNINDENT
  1349. .UNINDENT
  1350. .sp
  1351. There are a couple of options, and you may use any combination of them
  1352. together:
  1353. .INDENT 0.0
  1354. .TP
  1355. .B \-\-managers
  1356. .UNINDENT
  1357. .sp
  1358. Mails the email addresses specified in \fI\%MANAGERS\fP using
  1359. \fI\%mail_managers()\fP\&.
  1360. .INDENT 0.0
  1361. .TP
  1362. .B \-\-admins
  1363. .UNINDENT
  1364. .sp
  1365. Mails the email addresses specified in \fI\%ADMINS\fP using
  1366. \fI\%mail_admins()\fP\&.
  1367. .SS \fBshell\fP
  1368. .INDENT 0.0
  1369. .TP
  1370. .B django\-admin shell
  1371. .UNINDENT
  1372. .sp
  1373. Starts the Python interactive interpreter.
  1374. .sp
  1375. All models from installed apps are automatically imported into the shell
  1376. environment. Models from apps listed earlier in \fI\%INSTALLED_APPS\fP take
  1377. precedence. For a \fB\-\-verbosity\fP of 2 or higher, the automatically imported
  1378. objects will be listed. To disable automatic importing entirely, use the
  1379. \fB\-\-no\-imports\fP flag.
  1380. .sp
  1381. See the guide on \fI\%customizing this behaviour\fP to add or remove automatic imports.
  1382. .sp
  1383. Automatic models import was added.
  1384. .INDENT 0.0
  1385. .TP
  1386. .B \-\-interface {ipython,bpython,python}, \-i {ipython,bpython,python}
  1387. .UNINDENT
  1388. .sp
  1389. Specifies the shell to use. By default, Django will use \X'tty: link https://ipython.org/'\fI\%IPython\fP\X'tty: link' or \X'tty: link https://bpython-interpreter.org/'\fI\%bpython\fP\X'tty: link' if
  1390. either is installed. If both are installed, specify which one you want like so:
  1391. .sp
  1392. IPython:
  1393. .INDENT 0.0
  1394. .INDENT 3.5
  1395. .sp
  1396. .EX
  1397. django\-admin shell \-i ipython
  1398. .EE
  1399. .UNINDENT
  1400. .UNINDENT
  1401. .sp
  1402. bpython:
  1403. .INDENT 0.0
  1404. .INDENT 3.5
  1405. .sp
  1406. .EX
  1407. django\-admin shell \-i bpython
  1408. .EE
  1409. .UNINDENT
  1410. .UNINDENT
  1411. .sp
  1412. If you have a \(dqrich\(dq shell installed but want to force use of the \(dqplain\(dq
  1413. Python interpreter, use \fBpython\fP as the interface name, like so:
  1414. .INDENT 0.0
  1415. .INDENT 3.5
  1416. .sp
  1417. .EX
  1418. django\-admin shell \-i python
  1419. .EE
  1420. .UNINDENT
  1421. .UNINDENT
  1422. .INDENT 0.0
  1423. .TP
  1424. .B \-\-no\-startup
  1425. .UNINDENT
  1426. .sp
  1427. Disables reading the startup script for the \(dqplain\(dq Python interpreter. By
  1428. default, the script pointed to by the \X'tty: link https://docs.python.org/3/using/cmdline.html#envvar-PYTHONSTARTUP'\fI\%PYTHONSTARTUP\fP\X'tty: link' environment
  1429. variable or the \fB~/.pythonrc.py\fP script is read.
  1430. .INDENT 0.0
  1431. .TP
  1432. .B \-\-no\-imports
  1433. .UNINDENT
  1434. .sp
  1435. .sp
  1436. Disables the automatic import of models from \fI\%INSTALLED_APPS\fP\&.
  1437. .INDENT 0.0
  1438. .TP
  1439. .B \-\-command COMMAND, \-c COMMAND
  1440. .UNINDENT
  1441. .sp
  1442. Lets you pass a command as a string to execute it as Django, like so:
  1443. .INDENT 0.0
  1444. .INDENT 3.5
  1445. .sp
  1446. .EX
  1447. django\-admin shell \-\-command=\(dqimport django; print(django.__version__)\(dq
  1448. .EE
  1449. .UNINDENT
  1450. .UNINDENT
  1451. .sp
  1452. You can also pass code in on standard input to execute it. For example:
  1453. .INDENT 0.0
  1454. .INDENT 3.5
  1455. .sp
  1456. .EX
  1457. $ django\-admin shell <<EOF
  1458. > import django
  1459. > print(django.__version__)
  1460. > EOF
  1461. .EE
  1462. .UNINDENT
  1463. .UNINDENT
  1464. .sp
  1465. On Windows, the REPL is output due to implementation limits of
  1466. \X'tty: link https://docs.python.org/3/library/select.html#select.select'\fI\%select.select()\fP\X'tty: link' on that platform.
  1467. .SS \fBshowmigrations\fP
  1468. .INDENT 0.0
  1469. .TP
  1470. .B django\-admin showmigrations [app_label [app_label ...]]
  1471. .UNINDENT
  1472. .sp
  1473. Shows all migrations in a project. You can choose from one of two formats:
  1474. .INDENT 0.0
  1475. .TP
  1476. .B \-\-list, \-l
  1477. .UNINDENT
  1478. .sp
  1479. Lists all of the apps Django knows about, the migrations available for each
  1480. app, and whether or not each migration is applied (marked by an \fB[X]\fP next to
  1481. the migration name). For a \fB\-\-verbosity\fP of 2 and above, the applied
  1482. datetimes are also shown.
  1483. .sp
  1484. Apps without migrations are also listed, but have \fB(no migrations)\fP printed
  1485. under them.
  1486. .sp
  1487. This is the default output format.
  1488. .INDENT 0.0
  1489. .TP
  1490. .B \-\-plan, \-p
  1491. .UNINDENT
  1492. .sp
  1493. Shows the migration plan Django will follow to apply migrations. Like
  1494. \fB\-\-list\fP, applied migrations are marked by an \fB[X]\fP\&. For a \fB\-\-verbosity\fP
  1495. of 2 and above, all dependencies of a migration will also be shown.
  1496. .sp
  1497. \fBapp_label\fPs arguments limit the output, however, dependencies of provided
  1498. apps may also be included.
  1499. .INDENT 0.0
  1500. .TP
  1501. .B \-\-database DATABASE
  1502. .UNINDENT
  1503. .sp
  1504. Specifies the database to examine. Defaults to \fBdefault\fP\&.
  1505. .SS \fBsqlflush\fP
  1506. .INDENT 0.0
  1507. .TP
  1508. .B django\-admin sqlflush
  1509. .UNINDENT
  1510. .sp
  1511. Prints the SQL statements that would be executed for the \fI\%flush\fP
  1512. command.
  1513. .INDENT 0.0
  1514. .TP
  1515. .B \-\-database DATABASE
  1516. .UNINDENT
  1517. .sp
  1518. Specifies the database for which to print the SQL. Defaults to \fBdefault\fP\&.
  1519. .SS \fBsqlmigrate\fP
  1520. .INDENT 0.0
  1521. .TP
  1522. .B django\-admin sqlmigrate app_label migration_name
  1523. .UNINDENT
  1524. .sp
  1525. Prints the SQL for the named migration. This requires an active database
  1526. connection, which it will use to resolve constraint names; this means you must
  1527. generate the SQL against a copy of the database you wish to later apply it on.
  1528. .sp
  1529. Note that \fBsqlmigrate\fP doesn\(aqt colorize its output.
  1530. .INDENT 0.0
  1531. .TP
  1532. .B \-\-backwards
  1533. .UNINDENT
  1534. .sp
  1535. Generates the SQL for unapplying the migration. By default, the SQL created is
  1536. for running the migration in the forwards direction.
  1537. .INDENT 0.0
  1538. .TP
  1539. .B \-\-database DATABASE
  1540. .UNINDENT
  1541. .sp
  1542. Specifies the database for which to generate the SQL. Defaults to \fBdefault\fP\&.
  1543. .SS \fBsqlsequencereset\fP
  1544. .INDENT 0.0
  1545. .TP
  1546. .B django\-admin sqlsequencereset app_label [app_label ...]
  1547. .UNINDENT
  1548. .sp
  1549. Prints the SQL statements for resetting sequences for the given app name(s).
  1550. .sp
  1551. Sequences are indexes used by some database engines to track the next available
  1552. number for automatically incremented fields.
  1553. .sp
  1554. Use this command to generate SQL which will fix cases where a sequence is out
  1555. of sync with its automatically incremented field data.
  1556. .INDENT 0.0
  1557. .TP
  1558. .B \-\-database DATABASE
  1559. .UNINDENT
  1560. .sp
  1561. Specifies the database for which to print the SQL. Defaults to \fBdefault\fP\&.
  1562. .SS \fBsquashmigrations\fP
  1563. .INDENT 0.0
  1564. .TP
  1565. .B django\-admin squashmigrations app_label [start_migration_name] migration_name
  1566. .UNINDENT
  1567. .sp
  1568. Squashes the migrations for \fBapp_label\fP up to and including \fBmigration_name\fP
  1569. down into fewer migrations, if possible. The resulting squashed migrations
  1570. can live alongside the unsquashed ones safely. For more information,
  1571. please read \fI\%Squashing migrations\fP\&.
  1572. .sp
  1573. When \fBstart_migration_name\fP is given, Django will only include migrations
  1574. starting from and including this migration. This helps to mitigate the
  1575. squashing limitation of \fI\%RunPython\fP and
  1576. \fI\%django.db.migrations.operations.RunSQL\fP migration operations.
  1577. .INDENT 0.0
  1578. .TP
  1579. .B \-\-no\-optimize
  1580. .UNINDENT
  1581. .sp
  1582. Disables the optimizer when generating a squashed migration. By default, Django
  1583. will try to optimize the operations in your migrations to reduce the size of
  1584. the resulting file. Use this option if this process is failing or creating
  1585. incorrect migrations, though please also file a Django bug report about the
  1586. behavior, as optimization is meant to be safe.
  1587. .INDENT 0.0
  1588. .TP
  1589. .B \-\-noinput, \-\-no\-input
  1590. .UNINDENT
  1591. .sp
  1592. Suppresses all user prompts.
  1593. .INDENT 0.0
  1594. .TP
  1595. .B \-\-squashed\-name SQUASHED_NAME
  1596. .UNINDENT
  1597. .sp
  1598. Sets the name of the squashed migration. When omitted, the name is based on the
  1599. first and last migration, with \fB_squashed_\fP in between.
  1600. .INDENT 0.0
  1601. .TP
  1602. .B \-\-no\-header
  1603. .UNINDENT
  1604. .sp
  1605. Generate squashed migration file without Django version and timestamp header.
  1606. .SS \fBstartapp\fP
  1607. .INDENT 0.0
  1608. .TP
  1609. .B django\-admin startapp name [directory]
  1610. .UNINDENT
  1611. .sp
  1612. Creates a Django app directory structure for the given app name in the current
  1613. directory or the given destination.
  1614. .sp
  1615. By default, \X'tty: link https://github.com/django/django/blob/main/django/conf/app_template'\fI\%the new directory\fP\X'tty: link' contains a
  1616. \fBmodels.py\fP file and other app template files. If only the app name is given,
  1617. the app directory will be created in the current working directory.
  1618. .sp
  1619. If the optional destination is provided, Django will use that existing
  1620. directory rather than creating a new one. You can use \(aq.\(aq to denote the current
  1621. working directory.
  1622. .sp
  1623. For example:
  1624. .INDENT 0.0
  1625. .INDENT 3.5
  1626. .sp
  1627. .EX
  1628. django\-admin startapp myapp /Users/jezdez/Code/myapp
  1629. .EE
  1630. .UNINDENT
  1631. .UNINDENT
  1632. .INDENT 0.0
  1633. .TP
  1634. .B \-\-template TEMPLATE
  1635. .UNINDENT
  1636. .sp
  1637. Provides the path to a directory with a custom app template file, or a path to
  1638. an uncompressed archive (\fB\&.tar\fP) or a compressed archive (\fB\&.tar.gz\fP,
  1639. \fB\&.tar.bz2\fP, \fB\&.tar.xz\fP, \fB\&.tar.lzma\fP, \fB\&.tgz\fP, \fB\&.tbz2\fP, \fB\&.txz\fP,
  1640. \fB\&.tlz\fP, \fB\&.zip\fP) containing the app template files.
  1641. .sp
  1642. For example, this would look for an app template in the given directory when
  1643. creating the \fBmyapp\fP app:
  1644. .INDENT 0.0
  1645. .INDENT 3.5
  1646. .sp
  1647. .EX
  1648. django\-admin startapp \-\-template=/Users/jezdez/Code/my_app_template myapp
  1649. .EE
  1650. .UNINDENT
  1651. .UNINDENT
  1652. .sp
  1653. Django will also accept URLs (\fBhttp\fP, \fBhttps\fP, \fBftp\fP) to compressed
  1654. archives with the app template files, downloading and extracting them on the
  1655. fly.
  1656. .sp
  1657. For example, taking advantage of GitHub\(aqs feature to expose repositories as
  1658. zip files, you can use a URL like:
  1659. .INDENT 0.0
  1660. .INDENT 3.5
  1661. .sp
  1662. .EX
  1663. django\-admin startapp \-\-template=https://github.com/githubuser/django\-app\-template/archive/main.zip myapp
  1664. .EE
  1665. .UNINDENT
  1666. .UNINDENT
  1667. .INDENT 0.0
  1668. .TP
  1669. .B \-\-extension EXTENSIONS, \-e EXTENSIONS
  1670. .UNINDENT
  1671. .sp
  1672. Specifies which file extensions in the app template should be rendered with the
  1673. template engine. Defaults to \fBpy\fP\&.
  1674. .INDENT 0.0
  1675. .TP
  1676. .B \-\-name FILES, \-n FILES
  1677. .UNINDENT
  1678. .sp
  1679. Specifies which files in the app template (in addition to those matching
  1680. \fB\-\-extension\fP) should be rendered with the template engine. Defaults to an
  1681. empty list.
  1682. .INDENT 0.0
  1683. .TP
  1684. .B \-\-exclude DIRECTORIES, \-x DIRECTORIES
  1685. .UNINDENT
  1686. .sp
  1687. Specifies which directories in the app template should be excluded, in addition
  1688. to \fB\&.git\fP and \fB__pycache__\fP\&. If this option is not provided, directories
  1689. named \fB__pycache__\fP or starting with \fB\&.\fP will be excluded.
  1690. .sp
  1691. The \fI\%template context\fP used for all matching
  1692. files is:
  1693. .INDENT 0.0
  1694. .IP \(bu 2
  1695. Any option passed to the \fBstartapp\fP command (among the command\(aqs supported
  1696. options)
  1697. .IP \(bu 2
  1698. \fBapp_name\fP \-\- the app name as passed to the command
  1699. .IP \(bu 2
  1700. \fBapp_directory\fP \-\- the full path of the newly created app
  1701. .IP \(bu 2
  1702. \fBcamel_case_app_name\fP \-\- the app name in camel case format
  1703. .IP \(bu 2
  1704. \fBdocs_version\fP \-\- the version of the documentation: \fB\(aqdev\(aq\fP or \fB\(aq1.x\(aq\fP
  1705. .IP \(bu 2
  1706. \fBdjango_version\fP \-\- the version of Django, e.g. \fB\(aq2.0.3\(aq\fP
  1707. .UNINDENT
  1708. .sp
  1709. \fBWARNING:\fP
  1710. .INDENT 0.0
  1711. .INDENT 3.5
  1712. When the app template files are rendered with the Django template
  1713. engine (by default all \fB*.py\fP files), Django will also replace all
  1714. stray template variables contained. For example, if one of the Python files
  1715. contains a docstring explaining a particular feature related
  1716. to template rendering, it might result in an incorrect example.
  1717. .sp
  1718. To work around this problem, you can use the \fI\%templatetag\fP
  1719. template tag to \(dqescape\(dq the various parts of the template syntax.
  1720. .sp
  1721. In addition, to allow Python template files that contain Django template
  1722. language syntax while also preventing packaging systems from trying to
  1723. byte\-compile invalid \fB*.py\fP files, template files ending with \fB\&.py\-tpl\fP
  1724. will be renamed to \fB\&.py\fP\&.
  1725. .UNINDENT
  1726. .UNINDENT
  1727. .sp
  1728. \fBWARNING:\fP
  1729. .INDENT 0.0
  1730. .INDENT 3.5
  1731. The contents of custom app (or project) templates should always be
  1732. audited before use: Such templates define code that will become
  1733. part of your project, and this means that such code will be trusted
  1734. as much as any app you install, or code you write yourself.
  1735. Further, even rendering the templates is, effectively, executing
  1736. code that was provided as input to the management command. The
  1737. Django template language may provide wide access into the system,
  1738. so make sure any custom template you use is worthy of your trust.
  1739. .UNINDENT
  1740. .UNINDENT
  1741. .SS \fBstartproject\fP
  1742. .INDENT 0.0
  1743. .TP
  1744. .B django\-admin startproject name [directory]
  1745. .UNINDENT
  1746. .sp
  1747. Creates a Django project directory structure for the given project name in
  1748. the current directory or the given destination.
  1749. .sp
  1750. By default, \X'tty: link https://github.com/django/django/blob/main/django/conf/project_template'\fI\%the new directory\fP\X'tty: link' contains
  1751. \fBmanage.py\fP and a project package (containing a \fBsettings.py\fP and other
  1752. files).
  1753. .sp
  1754. If only the project name is given, both the project directory and project
  1755. package will be named \fB<projectname>\fP and the project directory
  1756. will be created in the current working directory.
  1757. .sp
  1758. If the optional destination is provided, Django will use that existing
  1759. directory as the project directory, and create \fBmanage.py\fP and the project
  1760. package within it. Use \(aq.\(aq to denote the current working directory.
  1761. .sp
  1762. For example:
  1763. .INDENT 0.0
  1764. .INDENT 3.5
  1765. .sp
  1766. .EX
  1767. django\-admin startproject myproject /Users/jezdez/Code/myproject_repo
  1768. .EE
  1769. .UNINDENT
  1770. .UNINDENT
  1771. .INDENT 0.0
  1772. .TP
  1773. .B \-\-template TEMPLATE
  1774. .UNINDENT
  1775. .sp
  1776. Specifies a directory, file path, or URL of a custom project template. See the
  1777. \fI\%startapp \-\-template\fP documentation for examples and usage.
  1778. .INDENT 0.0
  1779. .TP
  1780. .B \-\-extension EXTENSIONS, \-e EXTENSIONS
  1781. .UNINDENT
  1782. .sp
  1783. Specifies which file extensions in the project template should be rendered with
  1784. the template engine. Defaults to \fBpy\fP\&.
  1785. .INDENT 0.0
  1786. .TP
  1787. .B \-\-name FILES, \-n FILES
  1788. .UNINDENT
  1789. .sp
  1790. Specifies which files in the project template (in addition to those matching
  1791. \fB\-\-extension\fP) should be rendered with the template engine. Defaults to an
  1792. empty list.
  1793. .INDENT 0.0
  1794. .TP
  1795. .B \-\-exclude DIRECTORIES, \-x DIRECTORIES
  1796. .UNINDENT
  1797. .sp
  1798. Specifies which directories in the project template should be excluded, in
  1799. addition to \fB\&.git\fP and \fB__pycache__\fP\&. If this option is not provided,
  1800. directories named \fB__pycache__\fP or starting with \fB\&.\fP will be excluded.
  1801. .sp
  1802. The \fI\%template context\fP used is:
  1803. .INDENT 0.0
  1804. .IP \(bu 2
  1805. Any option passed to the \fBstartproject\fP command (among the command\(aqs
  1806. supported options)
  1807. .IP \(bu 2
  1808. \fBproject_name\fP \-\- the project name as passed to the command
  1809. .IP \(bu 2
  1810. \fBproject_directory\fP \-\- the full path of the newly created project
  1811. .IP \(bu 2
  1812. \fBsecret_key\fP \-\- a random key for the \fI\%SECRET_KEY\fP setting
  1813. .IP \(bu 2
  1814. \fBdocs_version\fP \-\- the version of the documentation: \fB\(aqdev\(aq\fP or \fB\(aq1.x\(aq\fP
  1815. .IP \(bu 2
  1816. \fBdjango_version\fP \-\- the version of Django, e.g. \fB\(aq2.0.3\(aq\fP
  1817. .UNINDENT
  1818. .sp
  1819. Please also see the \fI\%rendering warning\fP and
  1820. \fI\%trusted code warning\fP as mentioned for
  1821. \fI\%startapp\fP\&.
  1822. .SS \fBtest\fP
  1823. .INDENT 0.0
  1824. .TP
  1825. .B django\-admin test [test_label [test_label ...]]
  1826. .UNINDENT
  1827. .sp
  1828. Runs tests for all installed apps. See \fI\%Testing in Django\fP for more
  1829. information.
  1830. .INDENT 0.0
  1831. .TP
  1832. .B \-\-failfast
  1833. .UNINDENT
  1834. .sp
  1835. Stops running tests and reports the failure immediately after a test fails.
  1836. .INDENT 0.0
  1837. .TP
  1838. .B \-\-testrunner TESTRUNNER
  1839. .UNINDENT
  1840. .sp
  1841. Controls the test runner class that is used to execute tests. This value
  1842. overrides the value provided by the \fI\%TEST_RUNNER\fP setting.
  1843. .INDENT 0.0
  1844. .TP
  1845. .B \-\-noinput, \-\-no\-input
  1846. .UNINDENT
  1847. .sp
  1848. Suppresses all user prompts. A typical prompt is a warning about deleting an
  1849. existing test database.
  1850. .SS Test runner options
  1851. .sp
  1852. The \fBtest\fP command receives options on behalf of the specified
  1853. \fI\%\-\-testrunner\fP\&. These are the options of the default test runner:
  1854. \fI\%DiscoverRunner\fP\&.
  1855. .INDENT 0.0
  1856. .TP
  1857. .B \-\-keepdb
  1858. .UNINDENT
  1859. .sp
  1860. Preserves the test database between test runs. This has the advantage of
  1861. skipping both the create and destroy actions which can greatly decrease the
  1862. time to run tests, especially those in a large test suite. If the test database
  1863. does not exist, it will be created on the first run and then preserved for each
  1864. subsequent run. Unless the \fI\%MIGRATE\fP test setting is
  1865. \fBFalse\fP, any unapplied migrations will also be applied to the test database
  1866. before running the test suite.
  1867. .INDENT 0.0
  1868. .TP
  1869. .B \-\-shuffle [SEED]
  1870. .UNINDENT
  1871. .sp
  1872. Randomizes the order of tests before running them. This can help detect tests
  1873. that aren\(aqt properly isolated. The test order generated by this option is a
  1874. deterministic function of the integer seed given. When no seed is passed, a
  1875. seed is chosen randomly and printed to the console. To repeat a particular test
  1876. order, pass a seed. The test orders generated by this option preserve Django\(aqs
  1877. \fI\%guarantees on test order\fP\&. They also keep tests grouped
  1878. by test case class.
  1879. .sp
  1880. The shuffled orderings also have a special consistency property useful when
  1881. narrowing down isolation issues. Namely, for a given seed and when running a
  1882. subset of tests, the new order will be the original shuffling restricted to the
  1883. smaller set. Similarly, when adding tests while keeping the seed the same, the
  1884. order of the original tests will be the same in the new order.
  1885. .INDENT 0.0
  1886. .TP
  1887. .B \-\-reverse, \-r
  1888. .UNINDENT
  1889. .sp
  1890. Sorts test cases in the opposite execution order. This may help in debugging
  1891. the side effects of tests that aren\(aqt properly isolated. \fI\%Grouping by test
  1892. class\fP is preserved when using this option. This can be used
  1893. in conjunction with \fB\-\-shuffle\fP to reverse the order for a particular seed.
  1894. .INDENT 0.0
  1895. .TP
  1896. .B \-\-debug\-mode
  1897. .UNINDENT
  1898. .sp
  1899. Sets the \fI\%DEBUG\fP setting to \fBTrue\fP prior to running tests. This may
  1900. help troubleshoot test failures.
  1901. .INDENT 0.0
  1902. .TP
  1903. .B \-\-debug\-sql, \-d
  1904. .UNINDENT
  1905. .sp
  1906. Enables \fI\%SQL logging\fP for failing tests. If
  1907. \fB\-\-verbosity\fP is \fB2\fP, then queries in passing tests are also output.
  1908. .INDENT 0.0
  1909. .TP
  1910. .B \-\-parallel [N]
  1911. .UNINDENT
  1912. .INDENT 0.0
  1913. .TP
  1914. .B DJANGO_TEST_PROCESSES
  1915. .UNINDENT
  1916. .sp
  1917. Runs tests in separate parallel processes. Since modern processors have
  1918. multiple cores, this allows running tests significantly faster.
  1919. .sp
  1920. Using \fB\-\-parallel\fP without a value, or with the value \fBauto\fP, runs one test
  1921. process per core according to \X'tty: link https://docs.python.org/3/library/multiprocessing.html#multiprocessing.cpu_count'\fI\%multiprocessing.cpu_count()\fP\X'tty: link'\&. You can
  1922. override this by passing the desired number of processes, e.g.
  1923. \fB\-\-parallel 4\fP, or by setting the \fI\%DJANGO_TEST_PROCESSES\fP environment
  1924. variable.
  1925. .sp
  1926. Django distributes test cases — \X'tty: link https://docs.python.org/3/library/unittest.html#unittest.TestCase'\fI\%unittest.TestCase\fP\X'tty: link' subclasses — to
  1927. subprocesses. If there are fewer test case classes than configured processes,
  1928. Django will reduce the number of processes accordingly.
  1929. .sp
  1930. Each process gets its own database. You must ensure that different test case
  1931. classes don\(aqt access the same resources. For instance, test case classes that
  1932. touch the filesystem should create a temporary directory for their own use.
  1933. .sp
  1934. \fBNOTE:\fP
  1935. .INDENT 0.0
  1936. .INDENT 3.5
  1937. If you have test classes that cannot be run in parallel, you can use
  1938. \fBSerializeMixin\fP to run them sequentially. See \fI\%Enforce running test
  1939. classes sequentially\fP\&.
  1940. .UNINDENT
  1941. .UNINDENT
  1942. .sp
  1943. This option requires the third\-party \fBtblib\fP package to display tracebacks
  1944. correctly:
  1945. .INDENT 0.0
  1946. .INDENT 3.5
  1947. .sp
  1948. .EX
  1949. $ python \-m pip install tblib
  1950. .EE
  1951. .UNINDENT
  1952. .UNINDENT
  1953. .sp
  1954. This feature isn\(aqt available on Windows. It doesn\(aqt work with the Oracle
  1955. database backend either.
  1956. .sp
  1957. If you want to use \X'tty: link https://docs.python.org/3/library/pdb.html#module-pdb'\fI\%pdb\fP\X'tty: link' while debugging tests, you must disable parallel
  1958. execution (\fB\-\-parallel=1\fP). You\(aqll see something like \fBbdb.BdbQuit\fP if you
  1959. don\(aqt.
  1960. .sp
  1961. \fBWARNING:\fP
  1962. .INDENT 0.0
  1963. .INDENT 3.5
  1964. When test parallelization is enabled and a test fails, Django may be
  1965. unable to display the exception traceback. This can make debugging
  1966. difficult. If you encounter this problem, run the affected test without
  1967. parallelization to see the traceback of the failure.
  1968. .sp
  1969. This is a known limitation. It arises from the need to serialize objects
  1970. in order to exchange them between processes. See
  1971. \X'tty: link https://docs.python.org/3/library/pickle.html#pickle-picklable'\fI\%What can be pickled and unpickled?\fP\X'tty: link' for details.
  1972. .UNINDENT
  1973. .UNINDENT
  1974. .INDENT 0.0
  1975. .TP
  1976. .B \-\-tag TAGS
  1977. .UNINDENT
  1978. .sp
  1979. Runs only tests \fI\%marked with the specified tags\fP\&.
  1980. May be specified multiple times and combined with \fI\%test \-\-exclude\-tag\fP\&.
  1981. .sp
  1982. Tests that fail to load are always considered matching.
  1983. .INDENT 0.0
  1984. .TP
  1985. .B \-\-exclude\-tag EXCLUDE_TAGS
  1986. .UNINDENT
  1987. .sp
  1988. Excludes tests \fI\%marked with the specified tags\fP\&.
  1989. May be specified multiple times and combined with \fI\%test \-\-tag\fP\&.
  1990. .INDENT 0.0
  1991. .TP
  1992. .B \-k TEST_NAME_PATTERNS
  1993. .UNINDENT
  1994. .sp
  1995. Runs test methods and classes matching test name patterns, in the same way as
  1996. \X'tty: link https://docs.python.org/3/library/unittest.html#cmdoption-unittest-k'\fI\%unittest\(aqs \-k option\fP\X'tty: link'\&. Can be specified multiple times.
  1997. .INDENT 0.0
  1998. .TP
  1999. .B \-\-pdb
  2000. .UNINDENT
  2001. .sp
  2002. Spawns a \fBpdb\fP debugger at each test error or failure. If you have it
  2003. installed, \fBipdb\fP is used instead.
  2004. .INDENT 0.0
  2005. .TP
  2006. .B \-\-buffer, \-b
  2007. .UNINDENT
  2008. .sp
  2009. Discards output (\fBstdout\fP and \fBstderr\fP) for passing tests, in the same way
  2010. as \X'tty: link https://docs.python.org/3/library/unittest.html#cmdoption-unittest-b'\fI\%unittest\(aqs \-\-buffer option\fP\X'tty: link'\&.
  2011. .INDENT 0.0
  2012. .TP
  2013. .B \-\-no\-faulthandler
  2014. .UNINDENT
  2015. .sp
  2016. Django automatically calls \X'tty: link https://docs.python.org/3/library/faulthandler.html#faulthandler.enable'\fI\%faulthandler.enable()\fP\X'tty: link' when starting the
  2017. tests, which allows it to print a traceback if the interpreter crashes. Pass
  2018. \fB\-\-no\-faulthandler\fP to disable this behavior.
  2019. .INDENT 0.0
  2020. .TP
  2021. .B \-\-timing
  2022. .UNINDENT
  2023. .sp
  2024. Outputs timings, including database setup and total run time.
  2025. .INDENT 0.0
  2026. .TP
  2027. .B \-\-durations N
  2028. .UNINDENT
  2029. .sp
  2030. Shows the N slowest test cases (N=0 for all).
  2031. .INDENT 0.0
  2032. .INDENT 3.5
  2033. .IP "Python 3.12 and later"
  2034. .sp
  2035. This feature is only available for Python 3.12 and later.
  2036. .UNINDENT
  2037. .UNINDENT
  2038. .SS \fBtestserver\fP
  2039. .INDENT 0.0
  2040. .TP
  2041. .B django\-admin testserver [fixture [fixture ...]]
  2042. .UNINDENT
  2043. .sp
  2044. Runs a Django development server (as in \fI\%runserver\fP) using data from
  2045. the given fixture(s).
  2046. .sp
  2047. For example, this command:
  2048. .INDENT 0.0
  2049. .INDENT 3.5
  2050. .sp
  2051. .EX
  2052. django\-admin testserver mydata.json
  2053. .EE
  2054. .UNINDENT
  2055. .UNINDENT
  2056. .sp
  2057. \&...would perform the following steps:
  2058. .INDENT 0.0
  2059. .IP 1. 3
  2060. Create a test database, as described in \fI\%The test database\fP\&.
  2061. .IP 2. 3
  2062. Populate the test database with fixture data from the given fixtures.
  2063. (For more on fixtures, see the documentation for \fI\%loaddata\fP above.)
  2064. .IP 3. 3
  2065. Runs the Django development server (as in \fI\%runserver\fP), pointed at
  2066. this newly created test database instead of your production database.
  2067. .UNINDENT
  2068. .sp
  2069. This is useful in a number of ways:
  2070. .INDENT 0.0
  2071. .IP \(bu 2
  2072. When you\(aqre writing \fI\%unit tests\fP of how your views
  2073. act with certain fixture data, you can use \fBtestserver\fP to interact with
  2074. the views in a web browser, manually.
  2075. .IP \(bu 2
  2076. Let\(aqs say you\(aqre developing your Django application and have a \(dqpristine\(dq
  2077. copy of a database that you\(aqd like to interact with. You can dump your
  2078. database to a \fI\%fixture\fP (using the
  2079. \fI\%dumpdata\fP command, explained above), then use \fBtestserver\fP to run
  2080. your web application with that data. With this arrangement, you have the
  2081. flexibility of messing up your data in any way, knowing that whatever data
  2082. changes you\(aqre making are only being made to a test database.
  2083. .UNINDENT
  2084. .sp
  2085. Note that this server does \fInot\fP automatically detect changes to your Python
  2086. source code (as \fI\%runserver\fP does). It does, however, detect changes to
  2087. templates.
  2088. .INDENT 0.0
  2089. .TP
  2090. .B \-\-addrport ADDRPORT
  2091. .UNINDENT
  2092. .sp
  2093. Specifies a different port, or IP address and port, from the default of
  2094. \fB127.0.0.1:8000\fP\&. This value follows exactly the same format and serves
  2095. exactly the same function as the argument to the \fI\%runserver\fP command.
  2096. .sp
  2097. Examples:
  2098. .sp
  2099. To run the test server on port 7000 with \fBfixture1\fP and \fBfixture2\fP:
  2100. .INDENT 0.0
  2101. .INDENT 3.5
  2102. .sp
  2103. .EX
  2104. django\-admin testserver \-\-addrport 7000 fixture1 fixture2
  2105. django\-admin testserver fixture1 fixture2 \-\-addrport 7000
  2106. .EE
  2107. .UNINDENT
  2108. .UNINDENT
  2109. .sp
  2110. (The above statements are equivalent. We include both of them to demonstrate
  2111. that it doesn\(aqt matter whether the options come before or after the fixture
  2112. arguments.)
  2113. .sp
  2114. To run on 1.2.3.4:7000 with a \fBtest\fP fixture:
  2115. .INDENT 0.0
  2116. .INDENT 3.5
  2117. .sp
  2118. .EX
  2119. django\-admin testserver \-\-addrport 1.2.3.4:7000 test
  2120. .EE
  2121. .UNINDENT
  2122. .UNINDENT
  2123. .INDENT 0.0
  2124. .TP
  2125. .B \-\-noinput, \-\-no\-input
  2126. .UNINDENT
  2127. .sp
  2128. Suppresses all user prompts. A typical prompt is a warning about deleting an
  2129. existing test database.
  2130. .SH COMMANDS PROVIDED BY APPLICATIONS
  2131. .sp
  2132. Some commands are only available when the \fBdjango.contrib\fP application that
  2133. \fI\%implements\fP them has been
  2134. \fI\%enabled\fP\&. This section describes them grouped by
  2135. their application.
  2136. .SS \fBdjango.contrib.auth\fP
  2137. .SS \fBchangepassword\fP
  2138. .INDENT 0.0
  2139. .TP
  2140. .B django\-admin changepassword [<username>]
  2141. .UNINDENT
  2142. .sp
  2143. This command is only available if Django\(aqs \fI\%authentication system\fP (\fBdjango.contrib.auth\fP) is installed.
  2144. .sp
  2145. Allows changing a user\(aqs password. It prompts you to enter a new password twice
  2146. for the given user. If the entries are identical, this immediately becomes the
  2147. new password. If you do not supply a user, the command will attempt to change
  2148. the password whose username matches the current user.
  2149. .INDENT 0.0
  2150. .TP
  2151. .B \-\-database DATABASE
  2152. .UNINDENT
  2153. .sp
  2154. Specifies the database to query for the user. Defaults to \fBdefault\fP\&.
  2155. .sp
  2156. Example usage:
  2157. .INDENT 0.0
  2158. .INDENT 3.5
  2159. .sp
  2160. .EX
  2161. django\-admin changepassword ringo
  2162. .EE
  2163. .UNINDENT
  2164. .UNINDENT
  2165. .SS \fBcreatesuperuser\fP
  2166. .INDENT 0.0
  2167. .TP
  2168. .B django\-admin createsuperuser
  2169. .UNINDENT
  2170. .INDENT 0.0
  2171. .TP
  2172. .B DJANGO_SUPERUSER_PASSWORD
  2173. .UNINDENT
  2174. .sp
  2175. This command is only available if Django\(aqs \fI\%authentication system\fP (\fBdjango.contrib.auth\fP) is installed.
  2176. .sp
  2177. Creates a superuser account (a user who has all permissions). This is
  2178. useful if you need to create an initial superuser account or if you need to
  2179. programmatically generate superuser accounts for your site(s).
  2180. .sp
  2181. When run interactively, this command will prompt for a password for
  2182. the new superuser account. When run non\-interactively, you can provide
  2183. a password by setting the \fI\%DJANGO_SUPERUSER_PASSWORD\fP environment
  2184. variable. Otherwise, no password will be set, and the superuser account will
  2185. not be able to log in until a password has been manually set for it.
  2186. .sp
  2187. In non\-interactive mode, the
  2188. \fI\%USERNAME_FIELD\fP and required
  2189. fields (listed in
  2190. \fI\%REQUIRED_FIELDS\fP) fall back to
  2191. \fBDJANGO_SUPERUSER_<uppercase_field_name>\fP environment variables, unless they
  2192. are overridden by a command line argument. For example, to provide an \fBemail\fP
  2193. field, you can use \fBDJANGO_SUPERUSER_EMAIL\fP environment variable.
  2194. .INDENT 0.0
  2195. .TP
  2196. .B \-\-noinput, \-\-no\-input
  2197. .UNINDENT
  2198. .sp
  2199. Suppresses all user prompts. If a suppressed prompt cannot be resolved
  2200. automatically, the command will exit with error code 1.
  2201. .INDENT 0.0
  2202. .TP
  2203. .B \-\-username USERNAME
  2204. .UNINDENT
  2205. .INDENT 0.0
  2206. .TP
  2207. .B \-\-email EMAIL
  2208. .UNINDENT
  2209. .sp
  2210. The username and email address for the new account can be supplied by
  2211. using the \fB\-\-username\fP and \fB\-\-email\fP arguments on the command
  2212. line. If either of those is not supplied, \fBcreatesuperuser\fP will prompt for
  2213. it when running interactively.
  2214. .INDENT 0.0
  2215. .TP
  2216. .B \-\-database DATABASE
  2217. .UNINDENT
  2218. .sp
  2219. Specifies the database into which the superuser object will be saved.
  2220. .sp
  2221. You can subclass the management command and override \fBget_input_data()\fP if you
  2222. want to customize data input and validation. Consult the source code for
  2223. details on the existing implementation and the method\(aqs parameters. For example,
  2224. it could be useful if you have a \fBForeignKey\fP in
  2225. \fI\%REQUIRED_FIELDS\fP and want to
  2226. allow creating an instance instead of entering the primary key of an existing
  2227. instance.
  2228. .SS \fBdjango.contrib.contenttypes\fP
  2229. .SS \fBremove_stale_contenttypes\fP
  2230. .INDENT 0.0
  2231. .TP
  2232. .B django\-admin remove_stale_contenttypes
  2233. .UNINDENT
  2234. .sp
  2235. This command is only available if Django\(aqs \fI\%contenttypes app\fP (\fI\%django.contrib.contenttypes\fP) is installed.
  2236. .sp
  2237. Deletes stale content types (from deleted models) in your database. Any objects
  2238. that depend on the deleted content types will also be deleted. A list of
  2239. deleted objects will be displayed before you confirm it\(aqs okay to proceed with
  2240. the deletion.
  2241. .INDENT 0.0
  2242. .TP
  2243. .B \-\-database DATABASE
  2244. .UNINDENT
  2245. .sp
  2246. Specifies the database to use. Defaults to \fBdefault\fP\&.
  2247. .INDENT 0.0
  2248. .TP
  2249. .B \-\-include\-stale\-apps
  2250. .UNINDENT
  2251. .sp
  2252. Deletes stale content types including ones from previously installed apps that
  2253. have been removed from \fI\%INSTALLED_APPS\fP\&. Defaults to \fBFalse\fP\&.
  2254. .SS \fBdjango.contrib.gis\fP
  2255. .SS \fBogrinspect\fP
  2256. .sp
  2257. This command is only available if \fI\%GeoDjango\fP
  2258. (\fBdjango.contrib.gis\fP) is installed.
  2259. .sp
  2260. Please refer to its \fI\%description\fP in the GeoDjango
  2261. documentation.
  2262. .SS \fBdjango.contrib.sessions\fP
  2263. .SS \fBclearsessions\fP
  2264. .INDENT 0.0
  2265. .TP
  2266. .B django\-admin clearsessions
  2267. .UNINDENT
  2268. .sp
  2269. Can be run as a cron job or directly to clean out expired sessions.
  2270. .SS \fBdjango.contrib.staticfiles\fP
  2271. .SS \fBcollectstatic\fP
  2272. .sp
  2273. This command is only available if the \fI\%static files application\fP (\fBdjango.contrib.staticfiles\fP) is installed.
  2274. .sp
  2275. Please refer to its \fI\%description\fP in the
  2276. \fI\%staticfiles\fP documentation.
  2277. .SS \fBfindstatic\fP
  2278. .sp
  2279. This command is only available if the \fI\%static files application\fP (\fBdjango.contrib.staticfiles\fP) is installed.
  2280. .sp
  2281. Please refer to its \fI\%description\fP in the \fI\%staticfiles\fP documentation.
  2282. .SH DEFAULT OPTIONS
  2283. .sp
  2284. Although some commands may allow their own custom options, every command
  2285. allows for the following options by default:
  2286. .INDENT 0.0
  2287. .TP
  2288. .B \-\-pythonpath PYTHONPATH
  2289. .UNINDENT
  2290. .sp
  2291. Adds the given filesystem path to the Python \X'tty: link https://docs.python.org/3/library/sys.html#sys.path'\fI\%sys.path\fP\X'tty: link' module
  2292. attribute. If this isn\(aqt provided, \fBdjango\-admin\fP will use the
  2293. \X'tty: link https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH'\fI\%PYTHONPATH\fP\X'tty: link' environment variable.
  2294. .sp
  2295. This option is unnecessary in \fBmanage.py\fP, because it takes care of setting
  2296. the Python path for you.
  2297. .sp
  2298. Example usage:
  2299. .INDENT 0.0
  2300. .INDENT 3.5
  2301. .sp
  2302. .EX
  2303. django\-admin migrate \-\-pythonpath=\(aq/home/djangoprojects/myproject\(aq
  2304. .EE
  2305. .UNINDENT
  2306. .UNINDENT
  2307. .INDENT 0.0
  2308. .TP
  2309. .B \-\-settings SETTINGS
  2310. .UNINDENT
  2311. .sp
  2312. Specifies the settings module to use. The settings module should be in Python
  2313. package syntax, e.g. \fBmysite.settings\fP\&. If this isn\(aqt provided,
  2314. \fBdjango\-admin\fP will use the \fI\%DJANGO_SETTINGS_MODULE\fP environment
  2315. variable.
  2316. .sp
  2317. This option is unnecessary in \fBmanage.py\fP, because it uses
  2318. \fBsettings.py\fP from the current project by default.
  2319. .sp
  2320. Example usage:
  2321. .INDENT 0.0
  2322. .INDENT 3.5
  2323. .sp
  2324. .EX
  2325. django\-admin migrate \-\-settings=mysite.settings
  2326. .EE
  2327. .UNINDENT
  2328. .UNINDENT
  2329. .INDENT 0.0
  2330. .TP
  2331. .B \-\-traceback
  2332. .UNINDENT
  2333. .sp
  2334. Displays a full stack trace when a \fI\%CommandError\fP
  2335. is raised. By default, \fBdjango\-admin\fP will show an error message when a
  2336. \fBCommandError\fP occurs and a full stack trace for any other exception.
  2337. .sp
  2338. This option is ignored by \fI\%runserver\fP\&.
  2339. .sp
  2340. Example usage:
  2341. .INDENT 0.0
  2342. .INDENT 3.5
  2343. .sp
  2344. .EX
  2345. django\-admin migrate \-\-traceback
  2346. .EE
  2347. .UNINDENT
  2348. .UNINDENT
  2349. .INDENT 0.0
  2350. .TP
  2351. .B \-\-verbosity {0,1,2,3}, \-v {0,1,2,3}
  2352. .UNINDENT
  2353. .sp
  2354. Specifies the amount of notification and debug information that a command
  2355. should print to the console.
  2356. .INDENT 0.0
  2357. .IP \(bu 2
  2358. \fB0\fP means no output.
  2359. .IP \(bu 2
  2360. \fB1\fP means normal output (default).
  2361. .IP \(bu 2
  2362. \fB2\fP means verbose output.
  2363. .IP \(bu 2
  2364. \fB3\fP means \fIvery\fP verbose output.
  2365. .UNINDENT
  2366. .sp
  2367. This option is ignored by \fI\%runserver\fP\&.
  2368. .sp
  2369. Example usage:
  2370. .INDENT 0.0
  2371. .INDENT 3.5
  2372. .sp
  2373. .EX
  2374. django\-admin migrate \-\-verbosity 2
  2375. .EE
  2376. .UNINDENT
  2377. .UNINDENT
  2378. .INDENT 0.0
  2379. .TP
  2380. .B \-\-no\-color
  2381. .UNINDENT
  2382. .sp
  2383. Disables colorized command output. Some commands format their output to be
  2384. colorized. For example, errors will be printed to the console in red and SQL
  2385. statements will be syntax highlighted.
  2386. .sp
  2387. Example usage:
  2388. .INDENT 0.0
  2389. .INDENT 3.5
  2390. .sp
  2391. .EX
  2392. django\-admin runserver \-\-no\-color
  2393. .EE
  2394. .UNINDENT
  2395. .UNINDENT
  2396. .INDENT 0.0
  2397. .TP
  2398. .B \-\-force\-color
  2399. .UNINDENT
  2400. .sp
  2401. Forces colorization of the command output if it would otherwise be disabled
  2402. as discussed in \fI\%Syntax coloring\fP\&. For example, you may want to pipe
  2403. colored output to another command.
  2404. .INDENT 0.0
  2405. .TP
  2406. .B \-\-skip\-checks
  2407. .UNINDENT
  2408. .sp
  2409. Skips running system checks prior to running the command. This option is only
  2410. available if the
  2411. \fI\%requires_system_checks\fP command
  2412. attribute is not an empty list or tuple.
  2413. .sp
  2414. Example usage:
  2415. .INDENT 0.0
  2416. .INDENT 3.5
  2417. .sp
  2418. .EX
  2419. django\-admin migrate \-\-skip\-checks
  2420. .EE
  2421. .UNINDENT
  2422. .UNINDENT
  2423. .SH EXTRA NICETIES
  2424. .SS Syntax coloring
  2425. .INDENT 0.0
  2426. .TP
  2427. .B DJANGO_COLORS
  2428. .UNINDENT
  2429. .sp
  2430. The \fBdjango\-admin\fP / \fBmanage.py\fP commands will use pretty
  2431. color\-coded output if your terminal supports ANSI\-colored output. It
  2432. won\(aqt use the color codes if you\(aqre piping the command\(aqs output to
  2433. another program unless the \fI\%\-\-force\-color\fP option is used.
  2434. .SS Windows support
  2435. .sp
  2436. On Windows 10, the \X'tty: link https://www.microsoft.com/en-us/p/windows-terminal-preview/9n0dx20hk701'\fI\%Windows Terminal\fP\X'tty: link' application, \X'tty: link https://code.visualstudio.com'\fI\%VS Code\fP\X'tty: link', and PowerShell
  2437. (where virtual terminal processing is enabled) allow colored output, and are
  2438. supported by default.
  2439. .sp
  2440. Under Windows, the legacy \fBcmd.exe\fP native console doesn\(aqt support ANSI
  2441. escape sequences so by default there is no color output. In this case either of
  2442. two third\-party libraries are needed:
  2443. .INDENT 0.0
  2444. .IP \(bu 2
  2445. Install \X'tty: link https://pypi.org/project/colorama/'\fI\%colorama\fP\X'tty: link', a Python package that translates ANSI color codes
  2446. into Windows API calls. Django commands will detect its presence and will
  2447. make use of its services to color output just like on Unix\-based platforms.
  2448. \fBcolorama\fP can be installed via pip:
  2449. .INDENT 2.0
  2450. .INDENT 3.5
  2451. .sp
  2452. .EX
  2453. \&...\e> py \-m pip install \(dqcolorama >= 0.4.6\(dq
  2454. .EE
  2455. .UNINDENT
  2456. .UNINDENT
  2457. .IP \(bu 2
  2458. Install \X'tty: link http://adoxa.altervista.org/ansicon/'\fI\%ANSICON\fP\X'tty: link', a third\-party tool that allows \fBcmd.exe\fP to process
  2459. ANSI color codes. Django commands will detect its presence and will make use
  2460. of its services to color output just like on Unix\-based platforms.
  2461. .UNINDENT
  2462. .sp
  2463. Other modern terminal environments on Windows, that support terminal colors,
  2464. but which are not automatically detected as supported by Django, may \(dqfake\(dq the
  2465. installation of \fBANSICON\fP by setting the appropriate environmental variable,
  2466. \fBANSICON=\(dqon\(dq\fP\&.
  2467. .SS Custom colors
  2468. .sp
  2469. The colors used for syntax highlighting can be customized. Django
  2470. ships with three color palettes:
  2471. .INDENT 0.0
  2472. .IP \(bu 2
  2473. \fBdark\fP, suited to terminals that show white text on a black
  2474. background. This is the default palette.
  2475. .IP \(bu 2
  2476. \fBlight\fP, suited to terminals that show black text on a white
  2477. background.
  2478. .IP \(bu 2
  2479. \fBnocolor\fP, which disables syntax highlighting.
  2480. .UNINDENT
  2481. .sp
  2482. You select a palette by setting a \fI\%DJANGO_COLORS\fP environment
  2483. variable to specify the palette you want to use. For example, to
  2484. specify the \fBlight\fP palette under a Unix or OS/X BASH shell, you
  2485. would run the following at a command prompt:
  2486. .INDENT 0.0
  2487. .INDENT 3.5
  2488. .sp
  2489. .EX
  2490. export DJANGO_COLORS=\(dqlight\(dq
  2491. .EE
  2492. .UNINDENT
  2493. .UNINDENT
  2494. .sp
  2495. You can also customize the colors that are used. Django specifies a
  2496. number of roles in which color is used:
  2497. .INDENT 0.0
  2498. .IP \(bu 2
  2499. \fBerror\fP \- A major error.
  2500. .IP \(bu 2
  2501. \fBnotice\fP \- A minor error.
  2502. .IP \(bu 2
  2503. \fBsuccess\fP \- A success.
  2504. .IP \(bu 2
  2505. \fBwarning\fP \- A warning.
  2506. .IP \(bu 2
  2507. \fBsql_field\fP \- The name of a model field in SQL.
  2508. .IP \(bu 2
  2509. \fBsql_coltype\fP \- The type of a model field in SQL.
  2510. .IP \(bu 2
  2511. \fBsql_keyword\fP \- An SQL keyword.
  2512. .IP \(bu 2
  2513. \fBsql_table\fP \- The name of a model in SQL.
  2514. .IP \(bu 2
  2515. \fBhttp_info\fP \- A 1XX HTTP Informational server response.
  2516. .IP \(bu 2
  2517. \fBhttp_success\fP \- A 2XX HTTP Success server response.
  2518. .IP \(bu 2
  2519. \fBhttp_not_modified\fP \- A 304 HTTP Not Modified server response.
  2520. .IP \(bu 2
  2521. \fBhttp_redirect\fP \- A 3XX HTTP Redirect server response other than 304.
  2522. .IP \(bu 2
  2523. \fBhttp_not_found\fP \- A 404 HTTP Not Found server response.
  2524. .IP \(bu 2
  2525. \fBhttp_bad_request\fP \- A 4XX HTTP Bad Request server response other than 404.
  2526. .IP \(bu 2
  2527. \fBhttp_server_error\fP \- A 5XX HTTP Server Error response.
  2528. .IP \(bu 2
  2529. \fBmigrate_heading\fP \- A heading in a migrations management command.
  2530. .IP \(bu 2
  2531. \fBmigrate_label\fP \- A migration name.
  2532. .UNINDENT
  2533. .sp
  2534. Each of these roles can be assigned a specific foreground and
  2535. background color, from the following list:
  2536. .INDENT 0.0
  2537. .IP \(bu 2
  2538. \fBblack\fP
  2539. .IP \(bu 2
  2540. \fBred\fP
  2541. .IP \(bu 2
  2542. \fBgreen\fP
  2543. .IP \(bu 2
  2544. \fByellow\fP
  2545. .IP \(bu 2
  2546. \fBblue\fP
  2547. .IP \(bu 2
  2548. \fBmagenta\fP
  2549. .IP \(bu 2
  2550. \fBcyan\fP
  2551. .IP \(bu 2
  2552. \fBwhite\fP
  2553. .UNINDENT
  2554. .sp
  2555. Each of these colors can then be modified by using the following
  2556. display options:
  2557. .INDENT 0.0
  2558. .IP \(bu 2
  2559. \fBbold\fP
  2560. .IP \(bu 2
  2561. \fBunderscore\fP
  2562. .IP \(bu 2
  2563. \fBblink\fP
  2564. .IP \(bu 2
  2565. \fBreverse\fP
  2566. .IP \(bu 2
  2567. \fBconceal\fP
  2568. .UNINDENT
  2569. .sp
  2570. A color specification follows one of the following patterns:
  2571. .INDENT 0.0
  2572. .IP \(bu 2
  2573. \fBrole=fg\fP
  2574. .IP \(bu 2
  2575. \fBrole=fg/bg\fP
  2576. .IP \(bu 2
  2577. \fBrole=fg,option,option\fP
  2578. .IP \(bu 2
  2579. \fBrole=fg/bg,option,option\fP
  2580. .UNINDENT
  2581. .sp
  2582. where \fBrole\fP is the name of a valid color role, \fBfg\fP is the
  2583. foreground color, \fBbg\fP is the background color and each \fBoption\fP
  2584. is one of the color modifying options. Multiple color specifications
  2585. are then separated by a semicolon. For example:
  2586. .INDENT 0.0
  2587. .INDENT 3.5
  2588. .sp
  2589. .EX
  2590. export DJANGO_COLORS=\(dqerror=yellow/blue,blink;notice=magenta\(dq
  2591. .EE
  2592. .UNINDENT
  2593. .UNINDENT
  2594. .sp
  2595. would specify that errors be displayed using blinking yellow on blue,
  2596. and notices displayed using magenta. All other color roles would be
  2597. left uncolored.
  2598. .sp
  2599. Colors can also be specified by extending a base palette. If you put
  2600. a palette name in a color specification, all the colors implied by that
  2601. palette will be loaded. So:
  2602. .INDENT 0.0
  2603. .INDENT 3.5
  2604. .sp
  2605. .EX
  2606. export DJANGO_COLORS=\(dqlight;error=yellow/blue,blink;notice=magenta\(dq
  2607. .EE
  2608. .UNINDENT
  2609. .UNINDENT
  2610. .sp
  2611. would specify the use of all the colors in the light color palette,
  2612. \fIexcept\fP for the colors for errors and notices which would be
  2613. overridden as specified.
  2614. .SS Bash completion
  2615. .sp
  2616. If you use the Bash shell, consider installing the Django bash completion
  2617. script, which lives in \X'tty: link https://github.com/django/django/blob/main/extras/django_bash_completion'\fI\%extras/django_bash_completion\fP\X'tty: link' in the Django source
  2618. distribution. It enables tab\-completion of \fBdjango\-admin\fP and
  2619. \fBmanage.py\fP commands, so you can, for instance...
  2620. .INDENT 0.0
  2621. .IP \(bu 2
  2622. Type \fBdjango\-admin\fP\&.
  2623. .IP \(bu 2
  2624. Press [TAB] to see all available options.
  2625. .IP \(bu 2
  2626. Type \fBsql\fP, then [TAB], to see all available options whose names start
  2627. with \fBsql\fP\&.
  2628. .UNINDENT
  2629. .sp
  2630. See \fI\%How to create custom django\-admin commands\fP for how to add customized actions.
  2631. .SS Black formatting
  2632. .sp
  2633. The Python files created by \fI\%startproject\fP, \fI\%startapp\fP,
  2634. \fI\%optimizemigration\fP, \fI\%makemigrations\fP, and
  2635. \fI\%squashmigrations\fP are formatted using the \fBblack\fP command if it is
  2636. present on your \fBPATH\fP\&.
  2637. .sp
  2638. If you have \fBblack\fP globally installed, but do not wish it used for the
  2639. current project, you can set the \fBPATH\fP explicitly:
  2640. .INDENT 0.0
  2641. .INDENT 3.5
  2642. .sp
  2643. .EX
  2644. PATH=path/to/venv/bin django\-admin makemigrations
  2645. .EE
  2646. .UNINDENT
  2647. .UNINDENT
  2648. .sp
  2649. For commands using \fBstdout\fP you can pipe the output to \fBblack\fP if needed:
  2650. .INDENT 0.0
  2651. .INDENT 3.5
  2652. .sp
  2653. .EX
  2654. django\-admin inspectdb | black \-
  2655. .EE
  2656. .UNINDENT
  2657. .UNINDENT
  2658. .INDENT 0.0
  2659. .TP
  2660. .B django.core.management.call_command(name, *args, **options)
  2661. .UNINDENT
  2662. .sp
  2663. To call a management command from code use \fBcall_command()\fP\&.
  2664. .INDENT 0.0
  2665. .TP
  2666. .B \fBname\fP
  2667. the name of the command to call or a command object. Passing the name is
  2668. preferred unless the object is required for testing.
  2669. .TP
  2670. .B \fB*args\fP
  2671. a list of arguments accepted by the command. Arguments are passed to the
  2672. argument parser, so you can use the same style as you would on the command
  2673. line. For example, \fBcall_command(\(aqflush\(aq, \(aq\-\-verbosity=0\(aq)\fP\&.
  2674. .TP
  2675. .B \fB**options\fP
  2676. named options accepted on the command\-line. Options are passed to the command
  2677. without triggering the argument parser, which means you\(aqll need to pass the
  2678. correct type. For example, \fBcall_command(\(aqflush\(aq, verbosity=0)\fP (zero must
  2679. be an integer rather than a string).
  2680. .UNINDENT
  2681. .sp
  2682. Examples:
  2683. .INDENT 0.0
  2684. .INDENT 3.5
  2685. .sp
  2686. .EX
  2687. from django.core import management
  2688. from django.core.management.commands import loaddata
  2689. management.call_command(\(dqflush\(dq, verbosity=0, interactive=False)
  2690. management.call_command(\(dqloaddata\(dq, \(dqtest_data\(dq, verbosity=0)
  2691. management.call_command(loaddata.Command(), \(dqtest_data\(dq, verbosity=0)
  2692. .EE
  2693. .UNINDENT
  2694. .UNINDENT
  2695. .sp
  2696. Note that command options that take no arguments are passed as keywords
  2697. with \fBTrue\fP or \fBFalse\fP, as you can see with the \fBinteractive\fP option above.
  2698. .sp
  2699. Named arguments can be passed by using either one of the following syntaxes:
  2700. .INDENT 0.0
  2701. .INDENT 3.5
  2702. .sp
  2703. .EX
  2704. # Similar to the command line
  2705. management.call_command(\(dqdumpdata\(dq, \(dq\-\-natural\-foreign\(dq)
  2706. # Named argument similar to the command line minus the initial dashes and
  2707. # with internal dashes replaced by underscores
  2708. management.call_command(\(dqdumpdata\(dq, natural_foreign=True)
  2709. # \(gause_natural_foreign_keys\(ga is the option destination variable
  2710. management.call_command(\(dqdumpdata\(dq, use_natural_foreign_keys=True)
  2711. .EE
  2712. .UNINDENT
  2713. .UNINDENT
  2714. .sp
  2715. Some command options have different names when using \fBcall_command()\fP instead
  2716. of \fBdjango\-admin\fP or \fBmanage.py\fP\&. For example, \fBdjango\-admin
  2717. createsuperuser \-\-no\-input\fP translates to \fBcall_command(\(aqcreatesuperuser\(aq,
  2718. interactive=False)\fP\&. To find what keyword argument name to use for
  2719. \fBcall_command()\fP, check the command\(aqs source code for the \fBdest\fP argument
  2720. passed to \fBparser.add_argument()\fP\&.
  2721. .sp
  2722. Command options which take multiple options are passed a list:
  2723. .INDENT 0.0
  2724. .INDENT 3.5
  2725. .sp
  2726. .EX
  2727. management.call_command(\(dqdumpdata\(dq, exclude=[\(dqcontenttypes\(dq, \(dqauth\(dq])
  2728. .EE
  2729. .UNINDENT
  2730. .UNINDENT
  2731. .sp
  2732. The return value of the \fBcall_command()\fP function is the same as the return
  2733. value of the \fBhandle()\fP method of the command.
  2734. .SH OUTPUT REDIRECTION
  2735. .sp
  2736. Note that you can redirect standard output and error streams as all commands
  2737. support the \fBstdout\fP and \fBstderr\fP options. For example, you could write:
  2738. .INDENT 0.0
  2739. .INDENT 3.5
  2740. .sp
  2741. .EX
  2742. with open(\(dq/path/to/command_output\(dq, \(dqw\(dq) as f:
  2743. management.call_command(\(dqdumpdata\(dq, stdout=f)
  2744. .EE
  2745. .UNINDENT
  2746. .UNINDENT
  2747. .SH AUTHOR
  2748. Django Software Foundation
  2749. .SH COPYRIGHT
  2750. Django Software Foundation and contributors
  2751. .\" Generated by docutils manpage writer.
  2752. .