2đź‘Ť
Just put the snippet in {appname}/management/commands/
, where {appname}
is the name of an installed app. Each Python module in that directory will be auto-discovered and registered as a command that can be executed as an action when you run manage.py
.
You’ll need to put an empty __init__.py
in both {appname}/management/
and {appname}/management/commands/
for this to work, if those files don’t already exist.
See the docs for more on writing custom commands (obviously in your case, the command is already written).
1đź‘Ť
I haven’t updated that djangosnippets version for a while, I hope it works for you.
Note that, you don’t need to “install” pure python apps like django_extensions
; you can use it by just putting the folder on your path somewhere (like where you project’s directory is). Failing that, try and use the dumpscript.py
file found in django_extensions
(it’s newer)
I should have some time in the next few weeks to develop dumpscript
a little further and get it to play better with some of the newer django features 🙂
Cheers, Will
- [Django]-Django Multiple Levels Choices for Field
- [Django]-Django best practices – ensuring atomicity while executing business logic