简体   繁体   English

从命令行调用views.py中的函数(django)

[英]Call function in views.py from command line (django)

I'm trying to run a function defined in the views file of my django app, from the command line. 我正在尝试从命令行运行我的django应用程序的视图文件中定义的函数。 Is there a way to do this? 有没有办法做到这一点?

I understand view functions are supposed to be called from a request but I need this function to be called from a cron eventually. 我理解视图函数应该从请求中调用,但我最终需要从cron调用此函数。

Thanks 谢谢

您可以使用自定义管理命令

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM