且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

django文件上传:[Errno 13]权限被拒绝:'/static'

更新时间:2023-02-25 11:16:21

您上载媒体的Apache配置:

Your Apache configuration for the uploaded media:

Alias /media /var/www/webpage/webpage/

与您的Django设置不同步:

is not in-sync with your Django settings:

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = ''

根据您的Apache配置,您应该具有MEDIA_ROOT = '/var/www/webpage/webpage/'MEDIA_URL = '/media/'.

Based on your Apache configuration you should have MEDIA_ROOT = '/var/www/webpage/webpage/' and MEDIA_URL = '/media/'.