Where do I define the domain to be used by url_for() in Flask?

后端 未结 1 872
别那么骄傲
别那么骄傲 2020-11-28 08:49

When I call url_for(\'index\') it will generate \'/\' but there are times where I\'d like it to generate \'domain.tld/\' instead. I ca

相关标签:
1条回答
  • 2020-11-28 09:35

    url_for takes an _external keyword argument that will return an absolute (rather than relative) URL. I believe you will need to set a SERVER_NAME config key with your root domain to make it work correctly.

    0 讨论(0)
提交回复
热议问题