Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker目录挂载的问题 #460

Open
csthenry opened this issue Jul 17, 2023 · 7 comments
Open

docker目录挂载的问题 #460

csthenry opened this issue Jul 17, 2023 · 7 comments

Comments

@csthenry
Copy link

csthenry commented Jul 17, 2023

使用的版本:最新

默认挂载的容器目录为/var/loonflow-media,但是附件上传之后,并没有上传到这个文件夹啊,而是上传到了/opt/loonflow/media/里面去了,搞的前端无论如何也访问不了附件,我尝试挂载容器目录/opt/loonflow/media/,结果上传直接报错。

完全看不懂是什么操作

@blackholll
Copy link
Owner

nginx.conf中配置的media映射为/var/loonflow-media. 应该不会传到/opt/loonflow/media/. 你是用代码中docker-compose.yml启动的么?

@csthenry
Copy link
Author

现在我用docker-compose.yml重新启动了一遍,上传附件提示:

<html> <head><title>405 Not Allowed</title></head> <body> <center><h1>405 Not Allowed</h1></center> <hr><center>nginx/1.22.1</center> </body> </html> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page -->

@blackholll
Copy link
Owner

服务器磁盘空间不够了?

@csthenry
Copy link
Author

现在可以上传了,但文件确实还是传到了/opt/loonflow/media/ticket_file,nginx.conf配置我也没有做任何更改。

@blackholll
Copy link
Owner

是个bug. 这里写的上传到os.path.join(settings.MEDIA_ROOT, 'ticket_file/{}'.format(file_name):

f = open(os.path.join(settings.MEDIA_ROOT, 'ticket_file/{}'.format(file_name)), 'wb')

所以导致写到opt/loonflow/media目录下了。
你可以暂时先这么处理:
1.进到容器将 /opt/loonflow/settings/config.py中MEDIA_ROOT 配置改成/var/loonflow-media
2.然后kill 杀掉uwsgi进程,再重启uwsgi:
/opt/venv/loonflow/bin/uwsgi /opt/loonflow/uwsgi.ini

@csthenry
Copy link
Author

好的,问题解决了,不过MEDIA_ROOT 配置改成/var/loonflow-media后,还要手动在该文件夹内创建ticket_file文件夹才行。

@blackholll
Copy link
Owner

下个版本会修复这个问题, 也会优化需要手工创建ticket_file的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants