| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
While reviewing #356, the instructions of the PR template for reviewing seem to no longer work to render the site from the GHA artifact. With these changes, it seems to work again though, using python -m http.server 8887
|
For me, the preview still works with the described procedure (e.g. from the parent of the extracted tutorial...). Also, localhost is synonymous to 127.0.0.1, and not to 0.0.0.0 (see here). |
Sorry, something went wrong.
|
@florisvdh See issue #343. It seems the situation hasn't changed since I wrote this, so I don't know how to deal with it. (I don't have any knowledge of this kind of tools, I used to just follow the provided instructions.) |
Sorry, something went wrong.
|
Thanks @ElsLommelen; yeah I saw the same about Chrome OS from Chromium, so it's the same in Chrome then. Good that you made the issue.
@falkmielke yes of course, and I first tried that (as in the instructions), but there the CSS was not found (as seen from the console errors) so the website rendered without CSS: this is not the served path. However then I looked better at below output: it literally points to 0.0.0.0 and indeed that did work. But the website only works well if run it in the root of the tutorials site, not from the parent directory as prescribed (hence my changes). $ python -m http.server 8887
Serving HTTP on 0.0.0.0 port 8887 (http://0.0.0.0:8887/) ...So this is puzzling (it used to work before, the way you describe it). After reading some of the docs at https://docs.python.org/3/library/http.server.html (no docs available locally?), I tried: $ python -m http.server --bind 127.0.0.1 8887
Serving HTTP on 127.0.0.1 port 8887 (http://127.0.0.1:8887/) ...That works; for me this is required to use localhost. Using python 3.10. The --bind feature is there since 3.4. Still it only works for all subpages (like 'categories', 'installation +' etc) when run directly from the tutorials directory, not from the parent directory. Would it be due to some sys config in Linux Mint 21.3, since I'm using the system's python here? So I tried in an 'isolated' environment (actually this is just by controlling PATH as far as I understand conda, so not sure if this provides enough isolation). Same result though. $ conda activate floris
(floris) $ which python
/home/floris/miniconda3/envs/floris/bin/python
(floris) $ python --version
Python 3.11.9
(floris) $ python -m http.server 8887
Serving HTTP on 0.0.0.0 port 8887 (http://0.0.0.0:8887/) ...More isolation, still the same: $ docker run -it -v .:/website/tutorials -p 8887:8887 rocker/tidyverse bash
root@56ac6c351a97:/# which python
root@56ac6c351a97:/# which python3
/usr/bin/python3
root@56ac6c351a97:/# ls website/tutorials/
404.html assets categories create_tutorial favicon-32x32.png favicon.png images index.xml js rmarkdown-libs search tags
articles authors code css favicon.ico html index.html installation list_of_categories robots.txt sitemap.xml tutorials
root@56ac6c351a97:/# cd website/
root@56ac6c351a97:/website# python3 -m http.server 8887
Serving HTTP on 0.0.0.0 port 8887 (http://0.0.0.0:8887/) ...
172.17.0.1 - - [10/Feb/2025 20:09:08] code 404, message File not found
172.17.0.1 - - [10/Feb/2025 20:09:08] "GET /create_tutorial/ HTTP/1.1" 404 -
172.17.0.1 - - [10/Feb/2025 20:09:11] code 404, message File not found
172.17.0.1 - - [10/Feb/2025 20:09:11] "GET /create_tutorial/ HTTP/1.1" 404 -
172.17.0.1 - - [10/Feb/2025 20:09:13] code 404, message File not found
172.17.0.1 - - [10/Feb/2025 20:09:13] "GET /categories/ HTTP/1.1" 404 -
^C
Keyboard interrupt received, exiting.
root@56ac6c351a97:/website# cd tutorials/
root@56ac6c351a97:/website/tutorials# python3 -m http.server 8887
Serving HTTP on 0.0.0.0 port 8887 (http://0.0.0.0:8887/) ...
172.17.0.1 - - [10/Feb/2025 20:09:30] "GET /create_tutorial/ HTTP/1.1" 200 -
172.17.0.1 - - [10/Feb/2025 20:09:30] "GET /create_tutorial/images/new_file.png HTTP/1.1" 200 -
172.17.0.1 - - [10/Feb/2025 20:09:30] "GET /create_tutorial/images/folder_file_name.png HTTP/1.1" 200 -
172.17.0.1 - - [10/Feb/2025 20:09:30] "GET /create_tutorial/images/knit_md.png HTTP/1.1" 200 -
172.17.0.1 - - [10/Feb/2025 20:09:30] "GET /create_tutorial/images/propose_file.png HTTP/1.1" 200 -
172.17.0.1 - - [10/Feb/2025 20:09:32] "GET /categories/ HTTP/1.1" 200 -And it's only when running from the tutorials site root (second try above in docker) that all subpages work well (e.g. 'create tutorial' / 'categories' doesn't when running from parent directory). But, if it works for you, then we may not want to change it. |
Sorry, something went wrong.
|
I found out that this worked for me because I had accidentally unpacked the tutorials website into top level of my messy Download folder. Sorry! I got this to work with another keyword to python::http.server: --directory. python -m http.server 8887 --bind localhost --directory tutorials I suggest to document the whole command to make it safe. My fullly repetitive one-line linux pipeline now is rm -rf tutorials_website && unzip pr-<*>-inbo-tutorials-website.zip -d tutorials_website && python -m http.server 8887 --bind localhost --directory tutorials_website (you have to replace the <*> per PR) Finally, to see python docs for http.server locally, try pydoc http.server or to search: pydoc -k http.server. I will try to find an alternative for the chrome web app on the other issue. |
Sorry, something went wrong.
|
@florisvdh mind if I take over this PR to adjust the documentation to use servr? |
Sorry, something went wrong.
|
Thanks for the research @falkmielke !
Thanks for the hint! Out-of-the-box I had to use pydoc3, but indeed it's there!
I'd be delighted, great that you found an R solution! I have a lot of trust in packages by the author of {rmarkdown}, {bookdown}, {knitr} etc. 🙂 So you're welcome to take over update_pr_template from me. |
Sorry, something went wrong.
|
@florisvdh I have re-read and adjusted the relevant files and would appreciate your comments in turn. (the PR is yours, so I cannot involve you as a reviewer) |
Sorry, something went wrong.
There was a problem hiding this comment.
There were more additions from my side, also to tackle #343
Thank you for double checking!
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you @falkmielke for these very thoughtful additions; excellent work. Sorry for the late response from my side.
Ha, I cannot approve in GitHub as I started the PR (in effect, I usually recommend to not share branches & PRs, so here we see an example why).
But let this be my approval of your commits. That means, I only added optional 🙂 suggestions.
So once you're all fine, please approve the PR and merge into master. (It should be main actually, but that migration is a separate job.)
Sorry, something went wrong.
There was a problem hiding this comment.
Excellent.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
While reviewing #356, the instructions of the PR template for reviewing seem to no longer work to render the site from the GHA artifact, using python -m http.server 8887.
With these changes, it seems to work again though, using python -m http.server 8887.
I did not check Google Chrome though, having Chromium installed instead. @ElsLommelen I think you tested this in the past; can you test whether the new instructions also work with the Google Chrome Web Server app? You can e.g. use the artifact from #356.
EDIT: closes #343.