[英]How do I link to another directory with python?
In blog.py template_dir = os.path.join(os.path.dirname( file ), 'templates') 在blog.py template_dir = os.path.join(os.path.dirname( file ),'templates')中
^I know this is the way to search for the templates folder in the same directory, but what about sibling directories (ie other folders of the current folder's parent) ^我知道这是在同一目录中搜索模板文件夹的方法,但是同级目录(即当前文件夹父级的其他文件夹)又如何呢?
The problem is: 问题是:
Current File WebAppName/Backend/blog.py 当前文件WebAppName / Backend / blog.py
How Do I Reference? 我如何参考? WebAppName/Frontend/templates/
WebAppName / Frontend / templates /
What should I change template_dir to in order to access templates in the Frontend folder 我应该将template_dir更改为什么才能访问Frontend文件夹中的模板
template_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__),
'../Frontend/templates'))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.