A
A
Andrey Salnikov2016-04-06 13:54:02
Django
Andrey Salnikov, 2016-04-06 13:54:02

Why won't the file open?

On the site, when going to the document /media/uploads/2016/Buh_2015.pdf, it
gives a 403 error. The site is made with django. I can't say more, because I don't know anything else myself. Tell me, is it because of django or is it something server-side (well, that is, related to ngnix)?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Sergeev, 2016-04-06
@Shshzik

There are several nuances.
Are MEDIA_URL and MEDIA_ROOT specified in serttings.py?
Are you running locally or not?
If locally, then django itself cannot serve media files, you need to add to urls.py

from django.conf import settings
from django.conf.urls.static import static

if settings.DEBUG:
  urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

If on a production server, then configure apache/nginx

S
Swartalf, 2016-04-06
@Swartalf

error 403

S
Shoptenco, 2016-04-07
@Shoptenco

everything is simple to start, go through the mozilla, and write the script through the post, with the name of the link

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question