2

I don't have experience in web development at all, but I know python a bit. I developed a dashboard that shows few stats and graphs with Django templates and pages. I know nothing about using DBs or anything. So what I do is, I run a python script(let's say data_update.py) that updates .html and .js files in the repo to reflect the changes in webview. When an user access the pages, he views the latest pulled data on his browser.

This is all working fine when I host the application on local machine or a server, with "python manager.py runserver"

The problem is this isn't working on PCF. The webviews are showing the stale data from the time I pushed the app to pcf. I tried running data_update.py as task and worker. The .html and .js files are updating fine, except the updated data isn't reflected when accessed in browser.

JoshMc
  • 10,239
  • 2
  • 19
  • 38
Prof Lupin
  • 23
  • 1
  • 4
  • Have you tried in incognito/Private mode? Might be a problem of cache. Try clearing your browser cache data. – Shivendra Pratap Kushwaha Feb 26 '21 at 16:26
  • Also check if the Debug = False in settings.py. Try running through python manage.py runserver --insecure. – Shivendra Pratap Kushwaha Feb 26 '21 at 16:28
  • @ShivendraPratapKushwaha not browser end issue, opened incognito mode everytime. Debug=False makes all the staticfiles stuff crazy, setting it false doesn't work hosting even on my own machine. So i'm just trying to host debug=True on PCF as well. – Prof Lupin Feb 26 '21 at 18:14

2 Answers2

0

this is either a caching issue, or wsgi issue, try restarting the application after an update. I do not know how you set up the production but this may help you

tstoev
  • 1,415
  • 11
  • 12
  • Restarting the app on pcf doesn't help, tried it. Even if it works, i can't do it every 2 minutes, because that's how frequent i'm updating data in html and js files. – Prof Lupin Feb 26 '21 at 18:18
  • if restarting does not work you have probably misconfigured something. Can you update your post with the settings.py and the update script? You may also consider a different update mechanics – tstoev Feb 27 '21 at 07:50
  • Hey Got it working. I just put data_update.py as start command and invoked runserver in it with os module. Now it's running as expected. I just think the it was all running in separate instances/codebases with workers and tasks. – Prof Lupin Feb 28 '21 at 16:43
0

Try reloading your webserver. For example, if you are using Gunicorn, use the following commands.

sudo systemctl daemon-reload
sudo systemctl restart gunicorn
s4n7h0
  • 123
  • 2
  • 7