2👍
I would like “fileToDoThings.py” do things with my models
To do arbitrary operations from the command line, write a new Django management command.
You write your ‘lorem_ipsum.py’ module within a particular app, placing it a fooapp/management/commands/lorem_ipsum.py
. Write it to define a command as per the documentation above.
Then you can invoke that as a management command: python3 -m manage lorem_ipsum
.
Am I missing something really simple?
Simple, yes; obvious, no.
Django is a framework, not a library. The difference has been characterised by saying that with a library, you write code that calls the library; with a framework, you write code that gets called by the framework.
In other words, the way to get things done in a framework is to find the places where your code fits, and write it to fit those places.
0👍
looks like you need create command
https://docs.djangoproject.com/en/1.10/howto/custom-management-commands/
- [Answered ]-Getting how the view was called with HttpRedirect in the next view
- [Answered ]-Signature error message when uploading file with fineuploader and django into S3
- [Answered ]-Django TemplateDoesNotExist and BASE_DIRS