从 url django 中删除井号

Remove pound symbol from url django

所以,我有一个标准的 bootstrap 单页网站。我正在使用 django 作为后端。对于站点的每个部分,我使用我提供给它的 html id 从导航栏导航到它。

唯一的问题是我不知道如何清除 url 中的井号。我仍然想要类似的东西:

example.com/contact

自动导航到联系人部分,但是,它看起来像:

example.com/#contact

我该如何改变它?我需要添加到 django urls.py 文件中吗?

How do I go about changing this? Is it something I need to add to the django urls.py file?

没有

# 在 URL 中是 Fragment identifier.

来自https://blog.httpwatch.com/2011/03/01/6-things-you-should-know-about-fragment-urls/

... fragment identifier is only used by the browser – it doesn’t affect which resource is returned from the server.

由于它被浏览器使用,除非您更改导航实现,否则您不能对其做太多事情。