apache - Django Image Upload Fails...File not written to directory (weird bug) -


i have django model supposed upload image media directory on server via imagefield.

i've done before on linux server. in case, i've changed group www-data , changed permissions g+w allow apache write files specific media folder media root.

when save model via both admin portal , modelform in frontend of site, model validates. expected, link file stored in database. file isn't written.

this confusing because a) working on local server , b) have different model saves , writes image server. can't figure out why both of things working while other image upload failing.

here model:

    class post_photo(models.model):        post=models.foreignkey(post,blank=true,null=true)        photo=models.filefield(upload_to="post_photos")          def __unicode__(self):            return str(self.post) 

here settings file:

    media_root = '/home/public_html/media' 

the directory post_photos lives @ /home/public_html/media/post_photos. said, made changes group , perms allow server write files.

again, when save modelform or model directly through admin, gives me proper link, no file exists there.

if can me solve this, eternally grateful

you try setting variable define local storage:

local_storage = filesystemstorage(location=site_root, base_url='/post_photos')

then using on model:

photo = models.filefield(storage=local_storage)


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -