Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top