Django: Getting Started Transcripts
Chapter: Custom Django Commands
Lecture: Chapter review

Login or purchase this course to watch this video and the rest of the course contents.
0:00 You've been using Django management commands throughout the course this chapter reviewed some of the ones
0:06 you've used as well as pointed you at some others. Then I showed you how you can write your own,
0:12 you do that by inheriting from base command in a script file that is in the management commands subdirectory of an app.
0:21 Your commands entry point is the handle method and you can use the add arguments
0:25 method along with arg parse to define extra arguments for your command. And of course a quick reminder that you should use base command's standard out
0:35 and standard error streams instead of calling print. As otherwise the standard out command line option won't operate properly,
0:42 which makes testing problematic and means people using your command will have to write extra code to trap your output In the next chapter,
0:51 I'll take you deeper into database management and show you how migration scripts work.


Talk Python's Mastodon Michael Kennedy's Mastodon