标签:http os 文件 io for ar new amp
For example, the following code will store uploaded files under /media/photos regardless of what your
MEDIA_ROOT setting is:
from django.db import models
from django.core.files.storage import FileSystemStorage
fs = FileSystemStorage(location=’/media/photos’)
class Car(models.Model):
...
photo = models.ImageField(storage=fs)
else:
MEDIA_ROOT = ‘static/media/images/‘
# 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 = ‘/static/media/images/‘
img = models.ImageField(upload_to=‘upload/news/%Y/%m/%d‘, blank=True, null=True)
标签:http os 文件 io for ar new amp
原文地址:http://www.cnblogs.com/tuifeideyouran/p/3876790.html