【发布时间】:2018-07-27 10:08:36
【问题描述】:
我正在尝试在我的开发服务器中上传文件,但无法正常工作。一世 继续获得:
FileNotFoundError at /select_text
[Errno 2] No such file or directory: '/home/metis/public_html/AGATA\\media\\dados_petroleo.txt'
Request Method: POST
Request URL: http://agata.pgie.ufrgs.br/select_text
Django Version: 2.0.1
Exception Type: FileNotFoundError
Exception Value:
[Errno 2] No such file or directory: '/home/metis/public_html/AGATA\\media\\dados_petroleo.txt'
Exception Location: /home/metis/public_html/AGATA/textMining/TextMining.py in separete_file_sentences, line 30
Python Executable: /usr/bin/python3
Python Version: 3.4.3
Python Path:
['/home/metis/public_html/AGATA',
'/home/metis/public_html/AGATA/agataenv/lib/python3.4',
'/home/metis/public_html/AGATA/agataenv/lib/python3.4/plat-x86_64-linux-gnu',
'/home/metis/public_html/AGATA/agataenv/lib/python3.4/lib-dynload',
'/usr/lib/python3.4',
'/usr/lib/python3.4/plat-x86_64-linux-gnu',
'/home/metis/public_html/AGATA/agataenv/lib/python3.4/site-packages']
Server time: Fri, 16 Feb 2018 13:19:48 +0000
也许它在 /home/metis/public_html/AGATA\\media\\dados_petroleo.txt' 上,应该是 /home/metis/public_html/AGATA/media/dados_petroleo.txt ,但它正在使用 \\ ...这是怎么回事?
settings.py:
STATIC_PATH = os.path.join(BASE_DIR,'static')
STATIC_URL = '/static/' # You may find this is already defined as such.
STATIC_ROOT = '/home/metis/public_html/static'
STATICFILES_DIRS = (
STATIC_PATH,
)
MEDIA_ROOT = '/home/metis/public_html/media'
MEDIA_URL = '/media/'
【问题讨论】:
-
请阅读Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - 总结是这不是解决志愿者的理想方式,并且可能会适得其反。请不要将此添加到您的问题中。
标签: django apache upload media