is the Django management command executed in a sep

2019-07-25 13:56发布

问题:

Django has many management commands. In addition, we can write our own commands.

What happens after I make a shell call python manage.py XXX? Will the code be executed in a process that launched from the shell? Or the shell process just communicates with the main Django process that executes the command?

回答1:

The shell starts a new process to run the Python interpreter. The Python interpreter reads manage.py and executes it directly. There's no such thing as "the main Django process".