django trailing slash base url

时间:2012-05-05 08:01:29

标签: python django mod-wsgi

我在我的django应用程序中用wsgi尾随斜杠

WSGIScriptAlias /rp1 /var/www/reports/app.wsgi
WSGIPythonPath /var/www/reports/
documentroot /var/www/reports/

<Directory /var/www/reports>
    Order deny,allow
    Allow from all
</Directory>   

通过此网址访问此应用程序:172.30.12.37/rp1
在我的所有网址中添加/ rp1前缀的最佳方法是什么?

1 个答案:

答案 0 :(得分:1)

你不需要在urls.py中做任何特别的事情。 '/ rp1'前缀将自动适应。如果你是代码/模板的构造重定向,你需要确保使用适当的API来构造URL而不是硬编码路径。 Django设置模块中的某些设置(例如LOGIN_URL)确实需要显式包含前缀。

所以,更具体地说明你遇到的实际问题是什么。

相关问题