Old web page persists in browser - python

I built a web site with python and django which is deployed with apache 2.2.
Recently I made a huge change to the website. I just replaced the all the programs and templates and static files with the new version and restarted apache.
However, from my browser I still saw the old webpage. I then refreshed the page several times before the new page showed up. Worse, one of my colleagues still cannot access my new webpage after clearing his browser data and restarted computer. With developer tools, I found his browser got the right source html but somehow failed to show the right webpage.
I have the following questions:
Is this problem browser related or server related?
How can I ensure every browser display the right webpage?

Related

Deploying Web App problems on chrome however, not on Microsoft edge. WHY?

I have recently deployed my web app utilizing the hosting service pythonanywhere.com. My website seems to do just fine when being opened on Microsoft Edge. However, when I open the site on chrome it is does not load the majority of images/animations/text. In addition, my website works well when running on my computer on chrome (not local host just a regular link). It is running using Flask (python) and html/CSS/JavaScript. I do not know where to start looking in terms of trouble shooting this problem. Does anyone have any advice?
I tried to change the html files for each page as they are saved as Microsoft Edge html files to chrome files. Have yet to fully pursue that potential solution, as I am using git to transfer the files to pythonanywhere so I think i need to change the files in git and not just my computer.

Selenium python plugin and permission issues

I am using python and Selenium for a project.
But I am stuck trying to open a web page.
To access this page you require to authenticate and then press a usb device for second factor authentication, but only one time for each browser session.
I always get the page "you did not present a posture cookie. please install or repair your AEA plugin"
Comparing a manual browser it seems to have the plugin.
I have tried the following:
1)Tried by authenticating manually and then saving the browser cookies.
2)I have also tried by adding chrome_options.add_argument("user-data-dir=C:\Users\"+username+"\AppData\Local\Google\Chrome\User Data\Default") that is apparently where cookies are stored but both method fails.
I found the plugin ID, packed the plugin and tried to add the extension to the webdriver, but got the error "Loading of unpacked extensions is disabled by the administrator."
Is there any way to make the os thing that I browsing manually? By searching I fund that the option options.setExperimentalOption("useAutomationExtension", false); used to work on previous chrome webdriver versions, but is not working anymore, and disabling all plugins does not seem to be an option here.
Any advice would be appreciated.

How to run selenium on an actual webserver?

I've no idea on how to do this and all the documentation that I could find by google did not help. A while back I was introduced to selenium through this tutorial and now that I'm more comfortable with it, I want my selenium "bot" to run on a webserver 24/7, receiving orders from me through facebook messenger (something I already did with it running on my local machine).
I tried to find answers online and was overwhelmed by the amount of information, finding nothing that is clear to understand. All the pages I've been through require me to learn about a large array of things and have been very specific about their tools. And some times I try to follow along something just to receive an error I don't understand nor is it explained on said something how to fix it.
I also asked this question on Reddit only to be downvoted without answer. I've no idea how to run selenium + chrome on a server.
Take me for the stupidest person on earth, How can I do this in the most clear steps? I'd prefer to use chrome with selenium, through python or php.
You can try it by making your chromedriver run headlessly. I was introduced to it by this tutorial. a headless browser means a web browser without a graphical user interface. Headless browsers provide automated control of a web page in an environment similar to your local browser and you can get screenshots too.
If headless browser is giving you an error which can't be resolved(like screen sharing error), then you can try aws or Google Cloud like platforms

How to clear all caches in Apache?

I have a django app running in a virtualenv on Windows 10 WSL1 (Ubuntu). The python version is 3.6.8.
When using the django development web server, python manage.py runserver, everything is fine. I access that with http://localhost:8000/<my app name>/
But when using apache2, version 2.4.29, months-old javascript code shows up in the browser debugger in a VMxxx file (though I haven't yet found an eval() that supposedly is the cause of the VMxxx being generated).
Also, old server-side code shows up: an old javascript error that resulted from the django python code sending the wrong content type - a bug that was fixed a couple of weeks ago.
I'm accessing apache2 with http://localhost/<my app name>/
I disabled mod_cache:
a2dismod cache
Module cache already disabled.
Also ran htcacheclean -r -l1k and manually looked at the page cache directory, which was empty.
I clear the Chrome cache on every page load, but also get the same errors when using a different browser (Firefox) that wasn't even installed when this old code that's showing up was written.
I put in a HTTP header to request no caching:
<meta http-equiv="Cache-Control" content="no-store" />
The closest thing to a cache that I have configured in Django settings is
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db',
no CACHES settings.
And, of course, I stopped and restarted Apache.
service apache2 stop
service apache2 start
All to no effect.
Where is this old code coming from?
Duh! I had copied (not moved) the entire directory tree to a different location, but didn't update the apache2 configuration, so it was still pointing to the old location.
I'm leaving this up in case someone else makes the same mistake.

Autoreload webpage when source changed

I wonder is there some optional configuration to the dev server to autorefresh page when files changed. I know that django dev server autoreload project when some changes appear but what i am looking for is refreshing the webpage like it is in for example meteor. I was googling a little and find some apps and plugins to ff and chrome.
Django is designed to web development so i suspect that such feature should be in the core of dev server. Is it?
No, dev server is just a simple server that accepts request, passes it to the django app and returns a response from the app. It is something different than you can find in some JavaScript libraries or frameworks, where data are held in browser and you only hot reload the source code and library regenerates the page using the same data.

Categories