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

StackOverflow https://stackoverflow.com/questions/18191711

  •  24-06-2022
  •  | 
  •  

Вопрос

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