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