开发者

Is there an equivalent to the Apache “Alias” command in Django?

I have the following in the .htaccess file of a Django project directory

Alias ^$ app/misc/

Is there a way to accomplish the same thing just using Django (say in the urlconf).

The point of the Alias is that the page actually returned to the user is app/misc/default.html, and all the files that default.html references are in that same directory, which would have to be appended to each file reference in default.html without the alias. Maybe this is commonplace.

Edit: Don't 开发者_运维百科know what I could have been missing the above doesn't even work.


This is a long-shot and maybe I'm misunderstanding your question. As long as your anchors in default.html are defined as, say, <a href="link.html">link</a> or <a href="./link.html">link</a> they will be relative to /app/misc/ in this case. However, if you prefix them with a slash like <a href="/link.html">link</a> they will be relative to the root of your web server.

Is that helping you at all?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜