我尝试了最简单的方法将文件保存在我的django媒体文件夹中,这是我的.conf apache wsgi配置文件
ServerName testapplication.com
WSGIScriptAlias / /home/seba/git/CNBLUE/supergestor/supergestor/wsgi.py
WSGIPythonPath /home/seba/git/CNBLUE/supergestor
Alias /static /home/seba/git/CNBLUE/supergestor/static/
Alias /media /home/seba/git/CNBLUE/supergestor/media/
<Directory /home/seba/git/CNBLUE/supergestor/supergestor>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
<Directory /home/seba/git/CNBLUE/supergestor/media/>
Require all granted
</Directory>
<Directory /home/seba/git/CNBLUE/supergestor/static/>
Require all granted
</Directory>
我在我的settings.py文件中设置了MEDIA_ROOT='/home/seba/git/CNBLUE/supergestor/media/‘
和MEDIA_URL='‘
媒体文件夹位于我的项目文件夹的根目录下,django项目是supergestor
当我尝试上传时,我得到了这个错误Errno 13权限被拒绝:'/home/seba/git/CNBLUE/supergestor/media‘我没有线索
发布于 2015-04-27 00:46:09
MEDIA_ROOT
应该像这样设置:
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
MEDIA_ROOT = os.path.join(BASE_DIR, "/media")
我建议你先检查目录权限。
https://stackoverflow.com/questions/29884310
复制相似问题