Premission Denied - Apache

23 views
Skip to first unread message

Giovanni Silva

unread,
Aug 31, 2020, 12:02:22 AM8/31/20
to django...@googlegroups.com
Can anyone help me please?

All my project folder is 777 permissions with www-data user owner and group

image.png

--
Giovanni Silva
(31) 9 9532-1877

Nitin Kalmaste

unread,
Aug 31, 2020, 12:46:55 AM8/31/20
to django...@googlegroups.com
It looks like you want to save some pdf but it isn't allowed. You need to check which directory you are using currently to perform this operation. I think Your current directory is not allowing you this operation.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABO2r9fgbFXa57vrGEZUkPpmtQYRHyuUQadsqvV9hMDkW%2BwYeQ%40mail.gmail.com.

Kasper Laudrup

unread,
Aug 31, 2020, 11:11:50 AM8/31/20
to django...@googlegroups.com
Hi Giovanni,

On 31/08/2020 06.00, Giovanni Silva wrote:
> Can anyone help me please?
>
> All my project folder is 777 permissions with www-data user owner and group
>

Please don't do that. That's a huge security risk and can cause all
kinds of other problems.

It is hard to know how to solve your issue since you haven't shared any
of your code, but I'd suggest you specify a base path for where you save
your PDF files in your settings.py, ensure that the user running your
django code has write access to that directory (and only that directory)
and then ensure you use that path when saving your PDF files (ie. no
relative paths).

Kind regards,

Kasper Laudrup

Giovanni Silva

unread,
Aug 31, 2020, 12:12:38 PM8/31/20
to django...@googlegroups.com
Hi Kasper, 

When I was running with the django local server, I have permission and works good. The error occurs when I publish the site with apache2
I gave 777 permission because I was trying to do it (give permission). 



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Kasper Laudrup

unread,
Aug 31, 2020, 12:33:37 PM8/31/20
to django...@googlegroups.com
Hi Giovanni,

On 31/08/2020 18.11, Giovanni Silva wrote:
> Hi Kasper,
>
> When I was running with the django local server, I have permission and
> works good. The error occurs when I publish the site with apache2
> I gave 777 permission because I was trying to do it (give permission).
>

I understand that. My point was that not not only didn't it solve your
problem, you opened up for a lot of other potential issues later on.

As long as you don't share your code it's hard to help you much more,
but have a look at the path you specify to pdformfill in line 441 of
your views.py file and see if my suggestions might be of any help.

Kind regards,

Kasper Laudrup

Giovanni Silva

unread,
Aug 31, 2020, 1:13:53 PM8/31/20
to django...@googlegroups.com
Dear Kasper, 

this is part of my code... 

image.png

Best Regards

Giovanni

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Kasper Laudrup

unread,
Aug 31, 2020, 2:49:52 PM8/31/20
to django...@googlegroups.com
Hi Giovanni,

On 31/08/2020 19.12, Giovanni Silva wrote:
> Dear Kasper,
>
> this is part of my code...
>

So you probably just need to ensure that the user running your Django
code has write access to BASE_DIR / media.

Now it's up to you to figure out who that user is, what that path is and
ensure the that path has the proper owner and permissions.

I personally wouldn't be afraid to add some print statements to the
deployed code for "dirty debugging" in cases like this, but that
definitely depends on you and your usecase.

Kind regards,

Kasper Laudrup
Reply all
Reply to author
Forward
0 new messages