Django: signal when user logs in?

前端 未结 7 1915
予麋鹿
予麋鹿 2020-11-29 19:25

In my Django app, I need to start running a few periodic background jobs when a user logs in and stop running them when the user logs out, so I am looking for an elegant way

7条回答
  •  心在旅途
    2020-11-29 20:18

    Rough idea - you could use middleware for this. This middleware could process requests and fire signal when relevant URL is requested. It could also process responses and fire signal when given action actually succeded.

提交回复
热议问题