Forums

Webapp not updating after reload

This is bit weird and I have been banging my head against it for a couple of days.

When I update the code base using git pull, the code is updated without any errors. I even see the changes in the files. However reloading the app does nothing and I am still stuck at version of the app two days ago even though the git head in PA has moved up by 4 counts.

So the problem is code changes are not served on live app. There are no errors whatsoever. Not in error log or in bash console. This is new. I haven't experienced this before here.

Am I missing something? git pull followed by app reload has worked perfectly so far and I can not understand why it should stop working.

Thanks

oh..forgot to mention my app address. http://www.nirvana.market/

CNAME: webapp-356981.pythonanywhere.com

Also the changes I am talking about are in javascript files served statically. The files are uptpdate but the app is not

hi there, two things to check:

  1. if you're using django, you probably need to run collectstatic
  2. make sure you clear your browser cache

these debugging tips may also help? https://help.pythonanywhere.com/pages/DebuggingStaticFiles/

Thanks for your message.

I am using Django and instead of setting STATIC_ROOT, I am using STATIC_URL = '/assets/'

STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'assets'), )

In the web tab, I have

URL Directory
/assets/ /home/hawkeye/pydev/theProject/assets

These settings help me avoid running collectstatic as I am serving all the files from this directory rather than copying them somewhere else. This has worked perfectly well so far and I never had to run collectstatic before. In fact, it throws error saying I haven't set STATIC_ROOT in settings.py


This started happening after I pointed my own domain to the web app. It was working fine before. I tried to rename my app to the earlier name and reloaded but it didn;t work. So not sure if there is a cause there.

Also, I cleared browser cache and also tried it in chrome, firefox and IE. Same problem.

OK, can you follow the debugging steps here and share a specific example with the 3 pieces of information required? https://help.pythonanywhere.com/pages/DebuggingStaticFiles/

I can actually see and access the static files So, the three pieces are http://www.nirvana.market/assets/js/components/plotEQRR.js /home/hawkeye/pydev/theProject/assets/js/components/plotEQRR.js

URL Directory /assets/ /home/hawkeye/pydev/theProject/assets

I see the most updated version of the file as it should be in the browser. The only problem is it is not the same code that is run in the app. The app serves version which is much older.

so one explanation would be that the app isn't using the version that's being served by the static files system? can you share a link to an example page from the app that references plotEQRR.js?

oh..I just realized I was doing something incredibly dumb.

I had updated copies of the code but not the webpack bundle. After updating it everything works fine now.

Sorry I wasted your time and thanks a bunch for your patience and help

No problem -- and glad you worked it out!

hi i'm new to django. How do you update webpack bundle? Thanks in advance

I don't think Django involves webpack by default. If you're using a library of some sort to use webpack with Django, then you should check the documentation for how to update the bundle.

Am an absolute beginner, please after i pull my code to python anywhere and reload the web, there is no change effected, how can i go about thus please?

If the code has been updated, then the changes should be visible. Just to double-check -- did you reload the website using the button on the "Web" page inside PythonAnywhere (as opposed to the browser's own "reload" button)? Are you sure that the directory that you pulled the code into is the code that your website is using (and not, say, another copy)?

hi, I read all the answers above it didn't help me out. I pull my code

  1. I double-check it in my files the code is updated the
  2. I clear my cache
  3. I clicked on the reload button in (web tab in pythonanywhere)
  4. Its been 8 hours to my pull still there are no changes

I don't know where it's rendering my old code. I clear my cache 4 5 time

thanks in advance

Start at the wsgi file for your app and check that it's loading the code from where you expect it to be loading your code. Then check one of the views that you believe is running the old code and follow the code from the definition of the url to the code that you expect it to be running. In short: Check that your web app is actually running the code that you are changing and not something else (perhaps in a different directory or a different file to the one that you're checking)

I think there is another possibility. When you introduce an error into the flask app, the refresh can sometimes revert to a previous version. I swear this is the case and I've tested it just now when running into the same issue.

I can't see any way that could happen; we just read the files off disk using a normal Python interpreter. Are you sure you're looking at the right part of the error logs? The most recent error will be at the bottom of the file. Older errors are not cleared from the file when you reload.

I've been able to solve the issue. It seems that the error log shows all the errors that you've had in the app from the beginning. Each line shows the date that the error occurred, actually. You need to ignore all the errors at the top of the log and go to the last one. There must still be an error in the code that makes the app fail. I've checked several times that if you fix an error, the app is correctly reloaded and works. Just look at the last error of the log :) Hope this helps somebody.

I don't know how but it seems that if your updated project has errors, like missing packages, virtualenv and stuff, somehow an older working version may be loaded, after going step by step and fixing all my problems(some of which appeared in the error logs), and refreshed my website from the web tab, everything worked fine.