现在我正在处理生产服务器(AzureWebsites),我想打开我的.txt
文件。你知道吗
这是我用来保存stopwords.txt
的树
-App
-media
-App
stopwords.txt
-static
-templates
设置.py
MEDIA_ROOT = path.join(PROJECT_ROOT, 'media').replace('\\', '/')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'
我想用这个命令打开文本文件
handle = open('/media/stopwords.txt', 'r+')
var = handle.read()
这是我运行应用程序时遇到的错误
[Errno 13] Permission denied: '/media/stopwords.txt'
当我试图用这个
handle = open(settings.MEDIA_ROOT + 'stopwords.txt', 'r+')
我犯了这个错误
[Errno 2] No such file or directory: 'D:/home/site/wwwroot/mediastopwords.txt'
有人能帮忙解决这个问题吗?你知道吗
根据您的树,stopwords存储在/media/App下/停止字.txt 因此,要打开它,您需要:
试试
handle = open(settings.MEDIA_ROOT + '/stopwords.txt', 'r+')
相关问题 更多 >
编程相关推荐