I am using Pelican to develop some static HTML websites which are configured to serve pretty URLs, but the development server does not serve the pages without the file extension.

/output/index.html -> should be accesible sith http://localhost:8000 (works)
/output/contact.html -> should be accesible sith http://localhost:8000/contact (doesn't work)
/output/products/index.html -> should be accesible sith http://localhost:8000/products (doesn't work)

On production this is served by nginx, which is configured properly so it does serve the documents with the pretty URLs.

The problem is how to make the devenv server to do the same?

有帮助吗?

解决方案

The "devserver" is just a wrapper around python -m SimpleHTTPServer, which as the name suggests is a very simple web server that does not have all the rewriting features of Nginx. Potential solutions include:

  1. Output all files via /output/products/index.html pattern and access locally at http://localhost:8000/products/ (not http://localhost:8000/products however)

  2. Install and configure nginx locally to match the server-side configuration

其他提示

It seems that this was missing but with minimal effort I was able to add this feature to SimpleHTTPServer.

Here is the pull request https://github.com/getpelican/pelican/pull/1040

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top