Django管理员的“现场视图”指向example.com而不是我的域 [英] Django Admin's "view on site" points to example.com instead of my domain
本文介绍了Django管理员的“现场视图”指向example.com而不是我的域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我向我的一个模型添加了一个 get_absolute_url
函数。
I added a get_absolute_url
function to one of my models.
def get_absolute_url(self):
return '/foo/bar'
管理站点选择它,并添加一个视图在现场链接到该对象的详细信息页面(当我把一个真正的URL,而不是/ foo / bar)。
The admin site picks it up and adds a "view on site" link to the detail page for that object (when I put a real URL there instead of "/foo/bar").
问题不是转到 http:// localhost:8000 / foo / bar
,而是转到 http://example.com / foo / bar
。
The problem is instead of going to http://localhost:8000/foo/bar
, it goes to http://example.com/foo/bar
.
我做错了什么?
推荐答案
您必须更改默认网站域值。
这篇关于Django管理员的“现场视图”指向example.com而不是我的域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文