Python Forum
any concerns around using os.path.isFile() in web app
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
any concerns around using os.path.isFile() in web app
#7
(Aug-23-2020, 09:15 PM)it07 Wrote: in that way, i do not have to hardcode each page i have. if i want to add a page, i simply create an html file inside the templates/pages folder and call it whatever i want to call it. ir i call it helloworld.html, then that page will be available via /helloworld

This could be possible, but is total nonsense.
If you follow this pattern, you've to shift the complete business logic into your templates.


If you just want to do, what Apach2 or Nginx does, then use static files.

Static files are sent unmodified, and they don't use the template engine.
Static files, which should change afterwards, can do a fetch or XHR-Request
to get additional information from a route and manipulating the DOM.
This is what the shiny frameworks like Angular are doing.

If you hate javascript, then you better use the templates.
This saves you, to write javascript, which has to fetch the information.

To be more secure, you've to use a Nginx-Reverse-Proxy.
There you can also forbid routes.

My small project uses all 3 Methods (but with FastAPI).
I've the normal static content, which is delivered by Nginx (not from Python).
My templates do have fixed routes in Nginx (which I want to change).
Then I've the on the index page some javascripts, which fetches the information
from a LiFePo4 battery and visualizes it.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
RE: any concerns around using os.path.isFile() in web app - by DeaD_EyE - Aug-24-2020, 04:33 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020