Django custom command and cron

后端 未结 6 1839
刺人心
刺人心 2020-12-02 15:17

I want my custom made Django command to be executed every minute. However it seems like python /path/to/project/myapp/manage.py mycommand doesn\'t seem to work

6条回答
  •  不思量自难忘°
    2020-12-02 15:27

    If you want your Django life a lot more simple, use django-command-extensions within your project:

    http://code.google.com/p/django-command-extensions/

    You'll find a command named "runscript" so you simply add the command to your crontab line:

    ****** root python /path/to/project/myapp/manage.py runscript mycommand
    

    And such a script will execute with the Django context environment.

提交回复
热议问题