如何獲取網站的基本網址?Django 1.10 - 獲取網站的基址url
像 - https://stackoverflow.com/
我很想將其設置爲settings.py中
感謝
答:
真的很爲這樣一個貧窮的問題抱歉。 :(
我試着下面的代碼連接起來後 -
<a href="questions/{{ related_question.id }}">{{ related_question.question_text }}</a>
它把我從當前頁面的url,但我從基礎URL預計我想,我會得到像site_url()
的溶液等。 WordPress的,並可能在settings.py
使用它
但是我沒有這樣做,起價基本URL href
與/....
啓動,這樣,上述<a>
標籤應該是 - 。
<a href="https://stackoverflow.com/questions/{{ related_question.id }}">{{ related_question.question_text }}</a>
就是這樣。
添加更多上下文。你想從哪裏得到它?你想用它做什麼?你的問題很差。 – somecallitblues
嗨,我編輯了我的問題 – user3384985