开发者

Django- Get Current manage.py Command

I Want To Know How Can Get Current manage.py Command.

For开发者_JAVA技巧 Example, When I syncdb In Shell, I Want To Get This Command Name.

How can I Do It?


Manage.py is just a python script: if you want to get the command passed to it in a script, it can be found in sys.argv[1]. Subsequent commands are further down the list: sys.argv[0] contains the name of the file executed (manage.py in your example); sys.argv[1:] has all parameters passed to the executed file.


Unless you have modified your file structure, manage.py always exists in the top-level directory of your project. If you are in the top-level directory, you can reference the script like this:

./manage.py
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜