+ 4

How to update realtime data in django

I am creating a webapp with django in which it reads some data from a text file and then preview it to a web page and I want that the data get automatically update on changes(or time to time) without refreshing the whole page.

2nd Sep 2020, 10:24 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
6 Antworten
+ 6
Thanks for tagging Are the changes triggered by the current browsing user only? Or some other users using at the same time? Or API and occur at the data? For first case, you can use a frontend framework like React, Angular or Vue. The content can get updated automatically when the state changes. https://youtu.be/F9o4GSkSo40 If it is peer-to-peer, use Web Socket. https://youtu.be/32iJlPDNLQY If it is changed at data, you can set some triggers at the database. https://youtu.be/6Mtd6O_DVSo
2nd Sep 2020, 2:46 PM
Gordon
Gordon - avatar
+ 1
Gordon I am trying to build a simple (very simple universal chatting app) with django. For basic purpose I am storing all the messages in a text file. The problem is that messages are not getting updated automatically, we have to refresh the page to get updates. I think your second link may work for me. I will see the video...
2nd Sep 2020, 3:28 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
You can use Ajax for the thing you looking for I am also making a chat Web application using django where I will be using Ajax to send and receive message from my django views. You can also refer to my project https://github.com/Ajay2810-hub/AwesomeList The Ajax code is in static/js/AwesomeList/index.js line no. 194 and the view reading the message is at designer/views.py -> functions mark_complete and delete
9th Sep 2020, 4:30 AM
AJAY LINGAYAT
AJAY LINGAYAT - avatar
+ 1
AJAY LINGAYAT can you help me with simpler method like by sharing a part of code only to understand. Because understanding someones code is not easy as we think. (I am making a very simple chat app. In that all messages will be stored in a text file)
9th Sep 2020, 5:31 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
AKSHAY Yes sure
9th Sep 2020, 6:07 AM
AJAY LINGAYAT
AJAY LINGAYAT - avatar
0
Jan Markus , Gordon can you help me in this. I have heard something "use ajax to update data" but I don't know how to use Ajax. So can you please help me.
2nd Sep 2020, 10:52 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar