Django 服务器上的 UserDir

发布于 2024-08-21 15:49:56 字数 626 浏览 5 评论 0原文

我有一个使用 mod_python 和 Apache 运行的 django 网站。当前配置将所有 / 流量定向到 django 站点。现在,我还需要在计算机上启用 userDir /~user 。我已经在 Apache 中启用了 userDir 模块。由于 Apache 将所有请求重定向到 django 应用程序,因此 /~user 无法工作,因为 django 只是脱口而出 404。我知道发生这种情况是由于以下原因

<Location "/">
  SetHandler python-program
  PythonHandler django.core.handlers.modpython
  SetEnv DJANGO_SETTINGS_MODULE web.settings
  PythonOption django.root
  PythonDebug off
  PythonPath "['/path/to/the/django/source/'] + sys.path"
</Location>

我需要做什么来提供网页服务/ 并还从 /~user 提供 userDir 服务? (我认为这与正则表达式和 LocationMatch Apache 指令有关。我对正则表达式不够好,无法做我想做的事情)。任何帮助将不胜感激。

I have a django website running with mod_python and Apache. The current configuration directs all / traffic to the django site. Now, I need to enable userDir /~user on the machine as well. I have enabled the userDir module in Apache. Since, Apache is redirecting all the request to the django app, /~user is not working as the django just blurts out a 404. I understand that this is happening due to the following reason

<Location "/">
  SetHandler python-program
  PythonHandler django.core.handlers.modpython
  SetEnv DJANGO_SETTINGS_MODULE web.settings
  PythonOption django.root
  PythonDebug off
  PythonPath "['/path/to/the/django/source/'] + sys.path"
</Location>

What would I have to do to serve the webpage from / and also serve userDir from /~user ? (I think it has to do with regex and LocationMatch Apache directive. I am not good enough with regex to do what I want). Any help will be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乄_柒ぐ汐 2024-08-28 15:49:56
<LocationMatch "^/(?!~)">
  ....
</LocationMatch>
<LocationMatch "^/(?!~)">
  ....
</LocationMatch>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文