-
Hi All Thank you so much for this amazing code ! I was up and running in no time. Now i need to deploy this static site. I have a react site built on vite with wouter as my router. I am using python http server to serve the final dist directory. after |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @ymolists, thank you for your kind words! You probably have one I'm not familiar with Python's web server, but here is a pretty decent recipe from chat gpt: To serve a static single-page application (SPA) with Python and support SPA routes, you can use a lightweight web framework like Flask. Flask allows you to define routes and serve static files easily. Here's an example of how you can achieve this:
Flask is a flexible web framework that allows you to add more functionality as needed. You can use templating engines like Jinja2, handle form submissions, implement APIs, and more. Refer to the Flask documentation for more details on how to customize and extend your application based on your specific requirements. |
Beta Was this translation helpful? Give feedback.
Hi @ymolists, thank you for your kind words!
You probably have one
index.html
file at the root of your static folder and it's expectable that the web server can't serve any other route except for/
because it looks for actual static html files. For example, when you request/about
the web server tries to locate/about/index.html
(which isn't there ofc). You need to setup your web server so that it supports an "SPA wildcard routing" which will return yourindex.html
for all routes that it doesn't know about.I'm not familiar with Python's web server, but here is a pretty decent recipe from chat gpt:
To serve a static single-page application (SPA) with Python and support SPA routes, you can…