diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-03-13 17:35:21 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-03-13 17:35:21 +0100 |
commit | 5cab689180436fb430f0526ff42ad6ba9f12c483 (patch) | |
tree | 7b7936119dfb25b00905d6322a4863792e5517e8 | |
parent | 6d96705b15bf57991640f5f10d65f81e8e291057 (diff) | |
download | ishtar-pergamon-5cab689180436fb430f0526ff42ad6ba9f12c483.tar.bz2 ishtar-pergamon-5cab689180436fb430f0526ff42ad6ba9f12c483.zip |
Add visit_site script to force CACHE update
-rw-r--r-- | home/templates/home/home_page.html | 2 | ||||
-rwxr-xr-x | scripts/visit_site.py | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/home/templates/home/home_page.html b/home/templates/home/home_page.html index b51869a..a41be36 100644 --- a/home/templates/home/home_page.html +++ b/home/templates/home/home_page.html @@ -38,7 +38,7 @@ <div class="p-3"> <h4><a href="/{{subpage.slug}}">{{subpage.title}}</a></h4> {{ subpage.showcase.body|richtext }}<br> - <a href="{% pageurl subpage %}">{% trans "Browse..." %}</a> + <a href="{% pageurl subpage %}" class="link-browse">{% trans "Browse..." %}</a> </div> </div> {% endfor %} diff --git a/scripts/visit_site.py b/scripts/visit_site.py new file mode 100755 index 0000000..abd6a21 --- /dev/null +++ b/scripts/visit_site.py @@ -0,0 +1,24 @@ +#!/usr/bin/python3 + +from bs4 import BeautifulSoup +import requests + + +def main(url): + if not url.startswith("http"): + url = "http://" + url + if not url.endswith("/"): + url += "/" + response = requests.get(url) + soup = BeautifulSoup(response.text, "html.parser") + for link in soup.find_all("a", "link-browse"): + href = link["href"] + try: + requests.get(url + href) + except Exception: + pass + + +if __name__ == '__main__': + from pergamon.settings.local import BASE_URL + main(BASE_URL)
\ No newline at end of file |