2

I have a model:

class Provider(models.Model):
    name = models.CharField(max_length=256, verbose_name=_("Name"))
    favicon = models.ImageField(upload_to="providers/", null=True, blank=True)

And in settings:

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, "../media")

And in apache config I have:

#rest of code...
Alias /media/ /home/sever/ap/media/
<Directory /home/server/ap/media>
    Require all granted
</Directory>

But when I 'm trying add record to this model by admin pag, when I add an images I get the error:

PermissionError at /admin/ap/provider/add/
[Errno 13] Permission denied: '/home/server/ap/media/providers/Samsung.png'
1
  • 1
    did you add chown -R www-data:www-data on your media folder ? Commented Sep 29, 2016 at 15:09

1 Answer 1

2

As sebb said. I forgot add: chown -R www-data:www-data on my media folder. Now it works. Thanks!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.