How to display messages using the messages framework in Django using a background job?
up vote
0
down vote
favorite
I am running background tasks in my Django app using Django Background Tasks, which is checking from a Django model if a particular deadline is crossed.
@background(schedule=10000)
def check_deadline(repeat=30000):
# Check if deadline has crossed from DB
# Return the record's title whose deadline has crossed
If the condition is satisfied, then the background task must send a message to any template that is being currently viewed. I am not sure how to send a message to the template from the background task.
python django django-models django-templates background-process
add a comment |
up vote
0
down vote
favorite
I am running background tasks in my Django app using Django Background Tasks, which is checking from a Django model if a particular deadline is crossed.
@background(schedule=10000)
def check_deadline(repeat=30000):
# Check if deadline has crossed from DB
# Return the record's title whose deadline has crossed
If the condition is satisfied, then the background task must send a message to any template that is being currently viewed. I am not sure how to send a message to the template from the background task.
python django django-models django-templates background-process
That doesn't make sense. Your job is running on the background, it's not associated with any request. Whose template would you send it to?
– Daniel Roseman
Nov 4 at 10:17
Is there no provision for the server to push messages to the frontend, no matter which template is being displayed?
– Sushant Kumar
Nov 4 at 10:20
You can use django channels. It may help you.
– a_k_v
Nov 4 at 10:21
Or firebase or amazon SNS
– a_k_v
Nov 4 at 10:22
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am running background tasks in my Django app using Django Background Tasks, which is checking from a Django model if a particular deadline is crossed.
@background(schedule=10000)
def check_deadline(repeat=30000):
# Check if deadline has crossed from DB
# Return the record's title whose deadline has crossed
If the condition is satisfied, then the background task must send a message to any template that is being currently viewed. I am not sure how to send a message to the template from the background task.
python django django-models django-templates background-process
I am running background tasks in my Django app using Django Background Tasks, which is checking from a Django model if a particular deadline is crossed.
@background(schedule=10000)
def check_deadline(repeat=30000):
# Check if deadline has crossed from DB
# Return the record's title whose deadline has crossed
If the condition is satisfied, then the background task must send a message to any template that is being currently viewed. I am not sure how to send a message to the template from the background task.
python django django-models django-templates background-process
python django django-models django-templates background-process
asked Nov 4 at 10:12
Sushant Kumar
93111
93111
That doesn't make sense. Your job is running on the background, it's not associated with any request. Whose template would you send it to?
– Daniel Roseman
Nov 4 at 10:17
Is there no provision for the server to push messages to the frontend, no matter which template is being displayed?
– Sushant Kumar
Nov 4 at 10:20
You can use django channels. It may help you.
– a_k_v
Nov 4 at 10:21
Or firebase or amazon SNS
– a_k_v
Nov 4 at 10:22
add a comment |
That doesn't make sense. Your job is running on the background, it's not associated with any request. Whose template would you send it to?
– Daniel Roseman
Nov 4 at 10:17
Is there no provision for the server to push messages to the frontend, no matter which template is being displayed?
– Sushant Kumar
Nov 4 at 10:20
You can use django channels. It may help you.
– a_k_v
Nov 4 at 10:21
Or firebase or amazon SNS
– a_k_v
Nov 4 at 10:22
That doesn't make sense. Your job is running on the background, it's not associated with any request. Whose template would you send it to?
– Daniel Roseman
Nov 4 at 10:17
That doesn't make sense. Your job is running on the background, it's not associated with any request. Whose template would you send it to?
– Daniel Roseman
Nov 4 at 10:17
Is there no provision for the server to push messages to the frontend, no matter which template is being displayed?
– Sushant Kumar
Nov 4 at 10:20
Is there no provision for the server to push messages to the frontend, no matter which template is being displayed?
– Sushant Kumar
Nov 4 at 10:20
You can use django channels. It may help you.
– a_k_v
Nov 4 at 10:21
You can use django channels. It may help you.
– a_k_v
Nov 4 at 10:21
Or firebase or amazon SNS
– a_k_v
Nov 4 at 10:22
Or firebase or amazon SNS
– a_k_v
Nov 4 at 10:22
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53139686%2fhow-to-display-messages-using-the-messages-framework-in-django-using-a-backgroun%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
That doesn't make sense. Your job is running on the background, it's not associated with any request. Whose template would you send it to?
– Daniel Roseman
Nov 4 at 10:17
Is there no provision for the server to push messages to the frontend, no matter which template is being displayed?
– Sushant Kumar
Nov 4 at 10:20
You can use django channels. It may help you.
– a_k_v
Nov 4 at 10:21
Or firebase or amazon SNS
– a_k_v
Nov 4 at 10:22