public inbox for [email protected]  
help / color / mirror / Atom feed
(no subject)
4+ messages / 3 participants
[nested] [flat]

* (no subject)
@ 2023-04-17 07:31 Johan Antonissen <[email protected]>
  2023-04-17 13:54 ` Re: Tom Lane <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Johan Antonissen @ 2023-04-17 07:31 UTC (permalink / raw)
  To: [email protected]

hello!

I’m trying to learn django using this
<https://www.feldroy.com/books/a-wedge-of-django; book.


It gives a great low-level tutorial for deploying djang on using
cookiecutter.


However when I try to deploy django and connect to my postgres server
postgres gives me a permission error:

python manage.py sqlcreate | sudo -u postgres psql -U postgres

results to:

Could not change directory ... permission deniedCREATE ROLECREATE DATABASEGRANT

The error arises on the part after | I’ve found out. My error is therefore
a postgres permission error rather than a django error I think.

I’ve found numerous people that are also facing permission errors when
using postgres but these solutions have however not helped me understand
and fix the error.

I’m running Fedora and systemctl and pg_isready shows everything should be
working correctly.

Should I just add the user postgres to my username group to fix this error
? Or does that create a security problem ?

This should be a fairly common error, but can anyone tell me why this is
occuring ?

Thank you in advance!

Johan
<http://www.young-energy.eu/;


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re:
  2023-04-17 07:31 (no subject) Johan Antonissen <[email protected]>
@ 2023-04-17 13:54 ` Tom Lane <[email protected]>
  2023-04-17 15:46   ` Re: Josh Innis <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2023-04-17 13:54 UTC (permalink / raw)
  To: Johan Antonissen <[email protected]>; +Cc: [email protected]

Johan Antonissen <[email protected]> writes:
> However when I try to deploy django and connect to my postgres server
> postgres gives me a permission error:

> python manage.py sqlcreate | sudo -u postgres psql -U postgres

> results to:

> Could not change directory ... permission deniedCREATE ROLECREATE DATABASEGRANT

The "Could not change directory ... permission denied" part is mostly
cosmetic.  It happens when psql is invoked in a current working
directory that the postgres user can't read.  The fact that you're
getting "CREATE ROLE", "CREATE DATABASE", etc command completion
acknowledgements indicates that the SQL script is executing
successfully anyway.  So what you've showed us doesn't really
indicate that anything is wrong; although you could try it from
a publicly-readable starting directory if you want to be sure.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re:
  2023-04-17 07:31 (no subject) Johan Antonissen <[email protected]>
  2023-04-17 13:54 ` Re: Tom Lane <[email protected]>
@ 2023-04-17 15:46   ` Josh Innis <[email protected]>
  2023-04-17 18:06     ` Re: Johan Antonissen <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Josh Innis @ 2023-04-17 15:46 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: Johan Antonissen <[email protected]>; [email protected]

+1

On Mon, Apr 17, 2023 at 10:54 PM Tom Lane <[email protected]> wrote:

> Johan Antonissen <[email protected]> writes:
> > However when I try to deploy django and connect to my postgres server
> > postgres gives me a permission error:
>
> > python manage.py sqlcreate | sudo -u postgres psql -U postgres
>
> > results to:
>
> > Could not change directory ... permission deniedCREATE ROLECREATE
> DATABASEGRANT
>
> The "Could not change directory ... permission denied" part is mostly
> cosmetic.  It happens when psql is invoked in a current working
> directory that the postgres user can't read.  The fact that you're
> getting "CREATE ROLE", "CREATE DATABASE", etc command completion
> acknowledgements indicates that the SQL script is executing
> successfully anyway.  So what you've showed us doesn't really
> indicate that anything is wrong; although you could try it from
> a publicly-readable starting directory if you want to be sure.
>
>                         regards, tom lane
>
>
>


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re:
  2023-04-17 07:31 (no subject) Johan Antonissen <[email protected]>
  2023-04-17 13:54 ` Re: Tom Lane <[email protected]>
  2023-04-17 15:46   ` Re: Josh Innis <[email protected]>
@ 2023-04-17 18:06     ` Johan Antonissen <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Johan Antonissen @ 2023-04-17 18:06 UTC (permalink / raw)
  To: Josh Innis <[email protected]>; +Cc: Tom Lane <[email protected]>; [email protected]

Hello!

Ok thanx for the information the clarification! I’m getting a ton of errors
when I do a migration after running that line but then I guess there’s a
bug in the code of the book. I also see that it’s GitHub has not been
updated since 2021. I’m just going for another book then!

Thank you again for the help!

On Mon, 17 Apr 2023 at 17:46, Josh Innis <[email protected]> wrote:

> +1
>
> On Mon, Apr 17, 2023 at 10:54 PM Tom Lane <[email protected]> wrote:
>
>> Johan Antonissen <[email protected]> writes:
>> > However when I try to deploy django and connect to my postgres server
>> > postgres gives me a permission error:
>>
>> > python manage.py sqlcreate | sudo -u postgres psql -U postgres
>>
>> > results to:
>>
>> > Could not change directory ... permission deniedCREATE ROLECREATE
>> DATABASEGRANT
>>
>> The "Could not change directory ... permission denied" part is mostly
>> cosmetic.  It happens when psql is invoked in a current working
>> directory that the postgres user can't read.  The fact that you're
>> getting "CREATE ROLE", "CREATE DATABASE", etc command completion
>> acknowledgements indicates that the SQL script is executing
>> successfully anyway.  So what you've showed us doesn't really
>> indicate that anything is wrong; although you could try it from
>> a publicly-readable starting directory if you want to be sure.
>>
>>                         regards, tom lane
>>
>>
>> --
Met vriendelijke groet,

Johan Antonissen
<http://www.young-energy.eu/;


^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2023-04-17 18:06 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-04-17 07:31  Johan Antonissen <[email protected]>
2023-04-17 13:54 ` Re: Tom Lane <[email protected]>
2023-04-17 15:46   ` Re: Josh Innis <[email protected]>
2023-04-17 18:06     ` Re: Johan Antonissen <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox