美文网首页
python中的os.path.dirname(__file__

python中的os.path.dirname(__file__

作者: joldy | 来源:发表于2016-12-07 16:47 被阅读0次

在使用web.py,结合apache wsgi发布的时候,会出现不能访问的情况,是因为地址的原因图片如下

此时应该这样解决

# -*- coding:utf-8 -*-

import os,sys

abspath = os.path.dirname(os.path.abspath(__file__))

sys.path.append(abspath)

os.chdir(abspath)

相关文章

网友评论

      本文标题:python中的os.path.dirname(__file__

      本文链接:https://www.haomeiwen.com/subject/vvzdmttx.html