Internal Server Error with Postgres and Python

2.4k views Asked by At

I keep getting this error: "Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application."

This error only happens when I try to add new data to the database's tables through a website. The website is being run on a losthost. I'm not sure if postgres is the problem or if the open source python code I'm using with postgres is the issue. Postgres is running on port 5432, but I'm not sure what data cluster it's using. Since when I try pg_ctl -D data status (data being the data cluster folder) it says pg_ctl: no server running. But that could just be because I'm putting in the wrong data cluster folder. If I try sudo lsof -i :5432 to see if anything is running on port 5432 it gives

COMMAND  PID     USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
postgres  83 postgres    4u  IPv6 0x261d777f749af8e3      0t0  TCP *:postgresql (LISTEN)
postgres  83 postgres    5u  IPv4 0x261d777f769f7233      0t0  TCP *:postgresql (LISTEN)

I believe postgres and the python code are talking to each other since when I initiated the website with the python code it made 30 new tables in postgres to go with it. I just am at a lost for what is wrong. The error is not descriptive at all.

Edit: If I query select setting from pg_settings where name = 'data_directory'; it give this file path: /Library/PostgreSQL/9.4/data. Then using pg_ctl -D /Library/PostgreSQL/9.4/data status it still says pg_ctl: no server running. So why does it say postgres is running on the port if the other command says there is no server running?

0

There are 0 answers