在本地存储文件需要设置MEDIA_ROOT MEDIA_URL
File (django.core.files.File)
django使用File来代表文件
with open('/path/to/hello.world', 'w') as f:
myfile = File(f)
myfile.write('Hello World')
File storage
from django.core.files.storage import default_storage
default_storage.save size open delete exists
网友评论