Search code examples
pythonpelican

How do I make pelican development server to deliver files without extension?


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?


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