私はこのモデルを持っています:
projectDirPath = path.dirname(path.dirname(__file__))
storeImageDir = FileSystemStorage(location=projectDirPath + '/couponRestApiApp/stores')
class stores(models.Model):
""" This is the store model """
storeName = models.CharField(max_length=15) # Store Name
storeDescription = models.TextField() # Store Description
storeURL = models.URLField() # Store URL
storePopularityNumber = models.IntegerField(max_length=1) # Store Popularity Number
storeImage = models.ImageField(upload_to="images",storage=storeImageDir) # Store Image
storeSlug = models.CharField(max_length=400) # This is the text you see in the URL
createdAt = models.DateTimeField(auto_now_add=True) # Time at which store is created
updatedAt = models.DateTimeField(auto_now=True) # Time at which store is updated
storeTags = models.ManyToManyField(tags) # All the tags associated with the store
def __unicode__(self):
return unicode(self.storeName)
def StoreTags(self):
return '\n'.join([s.tag for s in self.storeTags.all()])
def StoreImage(self):
return '<img src="%s" height="150"/>' % (self.storeImage)
StoreImage.allow_tags = True
しかし、管理ページに画像が読み込まれておらず、画像の URL は次のとおりです。http://localhost:8000/admin/couponRestApiApp/stores/static/mcDonalds.jpg/
が表示されていますが、正しいパスは次のとおりです。/home/vaibhav/TRAC/coupon-rest-api/couponRestApi/couponRestApiApp/stores/static/mcDonalds.jpg/
Django 管理ページに表示されるように、画像をどこに保存する必要がありますか?