Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 17, 2010 20:18:55

a.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django vs Postgres Connection


Hi,
this is the first time i try to deploy a django project and i'm not
being able to solve a problem.

On my local machine everything is running fine, but when i try to
deploy to a running server with apache (mod_wsgi), i'm getting the
following error (database related):

Caught OperationalError while rendering: could not connect to server:
Permission denied
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?

The fact is that when i try to connect to the database using psql -
U... is working fine, so postgree is working ok, it seems to be with
django :S

Exception Location: /usr/lib/python2.6/site-packages/django/db/
backends/postgresql_psycopg2/base.py in _cursor, line 136

this is my django version (just in case): 1.2.3

Anyone here has faced this problem ?
have any ideas?

Thanks

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 17, 2010 20:25:52

Christophe P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django vs Postgres Connection


On Dec 17, 2010, at 12:02 PM, armandoperico wrote:
> On my local machine everything is running fine, but when i try to
> deploy to a running server with apache (mod_wsgi), i'm getting the
> following error (database related):
>
> Caught OperationalError while rendering: could not connect to server:
> Permission denied
> Is the server running on host "127.0.0.1" and accepting
> TCP/IP connections on port 5432?

What's your database configuration on the Apache machine?

--
-- Christophe Pettus
x...@thebuild.com

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 17, 2010 20:30:37

Servais N.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django vs Postgres Connection


Hello, I think postgresql is not running or doesnt use the 5432 port. Check
your processus.
Le 17 déc. 2010 21:25, "Christophe Pettus" <x...@thebuild.com> a écrit :
>
> On Dec 17, 2010, at 12:02 PM, armandoperico wrote:
>> On my local machine everything is running fine, but when i try to
>> deploy to a running server with apache (mod_wsgi), i'm getting the
>> following error (database related):
>>
>> Caught OperationalError while rendering: could not connect to server:
>> Permission denied
>> Is the server running on host "127.0.0.1" and accepting
>> TCP/IP connections on port 5432?
>
> What's your database configuration on the Apache machine?
>
> --
> -- Christophe Pettus
> x...@thebuild.com
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
.
> For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.
>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Dec. 17, 2010 20:38:11

Mathieu L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django vs Postgres Connection


check if postgresql is listening to 127.0.0.1, 0.0.0.0 or nothing in postgrsql

On Fri, Dec 17, 2010 at 3:30 PM, Servais Nabil <nabil.serv...@gmail.com> wrote:
> Hello, I think postgresql is not running or doesnt use the 5432 port. Check
> your processus.
>
> Le 17 déc. 2010 21:25, "Christophe Pettus" <x...@thebuild.com> a écrit :
>>
>> On Dec 17, 2010, at 12:02 PM, armandoperico wrote:
>>> On my local machine everything is running fine, but when i try to
>>> deploy to a running server with apache (mod_wsgi), i'm getting the
>>> following error (database related):
>>>
>>> Caught OperationalError while rendering: could not connect to server:
>>> Permission denied
>>> Is the server running on host "127.0.0.1" and accepting
>>> TCP/IP connections on port 5432?
>>
>> What's your database configuration on the Apache machine?
>>
>> --
>> -- Christophe Pettus
>> x...@thebuild.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>>http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>



--
Mathieu Leduc-Hamel

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Dec. 17, 2010 20:47:00

James D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django vs Postgres Connection


This sounds more like a Postgresql settings problem than a Django/Python
specific problem.

I'd suggest taking a look at your pg_hba.conf file. It can be finicky, so
you probably want to reference this if you haven't already:http://www.postgresql.org/docs/8.4/static/auth-pg-hba-conf.html-Jamie

-----Original Message-----
From: django-users@googlegroups.com
On Behalf Of armandoperico
Sent: Friday, December 17, 2010 2:03 PM
To: Django users
Subject: Django vs Postgres Connection

Hi,
this is the first time i try to deploy a django project and i'm not
being able to solve a problem.

On my local machine everything is running fine, but when i try to
deploy to a running server with apache (mod_wsgi), i'm getting the
following error (database related):

Caught OperationalError while rendering: could not connect to server:
Permission denied
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?

The fact is that when i try to connect to the database using psql -
U... is working fine, so postgree is working ok, it seems to be with
django :S

Exception Location: /usr/lib/python2.6/site-packages/django/db/
backends/postgresql_psycopg2/base.py in _cursor, line 136

this is my django version (just in case): 1.2.3

Anyone here has faced this problem ?
have any ideas?

Thanks

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#6 Dec. 17, 2010 20:49:54

a.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django vs Postgres Connection


on settings.py..

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'dbname', # Or path to database
file if using sqlite3.
'USER': 'myuser', # Not used with
sqlite3.
'PASSWORD': 'mypass', # Not used with
sqlite3.
'HOST': '127.0.0.1', # Set to empty
string for localhost. Not used with sqlite3.
'PORT': '5432', # Set to empty string for
default. Not used with sqlite3.
}
}

On Dec 17, 9:25 pm, Christophe Pettus <x...@thebuild.com> wrote:
> On Dec 17, 2010, at 12:02 PM, armandoperico wrote:
>
> > On my local machine everything is running fine, but when i try to
> > deploy to a running server with apache (mod_wsgi), i'm getting the
> > following error (database related):
>
> > Caught OperationalError while rendering: could not connect to server:
> > Permission denied
> >    Is the server running on host "127.0.0.1" and accepting
> >    TCP/IP connections on port 5432?
>
> What's your database configuration on the Apache machine?
>
> --
> -- Christophe Pettus
>    x...@thebuild.com

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#7 Dec. 17, 2010 20:51:28

a.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django vs Postgres Connection


on my pg_hba.conf i right now have this:

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 192.168.0.1/32 trust
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust


On Dec 17, 9:38 pm, Mathieu Leduc-Hamel <marra...@gmail.com> wrote:
> check if postgresql is listening to 127.0.0.1, 0.0.0.0 or nothing in postgrsql
>
>
>
>
>
>
>
>
>
> On Fri, Dec 17, 2010 at 3:30 PM, Servais Nabil <nabil.serv...@gmail.com>
> wrote:
> > Hello, I think postgresql is not running or doesnt use the 5432 port. Check
> > your processus.
>
> > Le 17 déc. 2010 21:25, "Christophe Pettus" <x...@thebuild.com> a écrit :
>
> >> On Dec 17, 2010, at 12:02 PM, armandoperico wrote:
> >>> On my local machine everything is running fine, but when i try to
> >>> deploy to a running server with apache (mod_wsgi), i'm getting the
> >>> following error (database related):
>
> >>> Caught OperationalError while rendering: could not connect to server:
> >>> Permission denied
> >>> Is the server running on host "127.0.0.1" and accepting
> >>> TCP/IP connections on port 5432?
>
> >> What's your database configuration on the Apache machine?
>
> >> --
> >> -- Christophe Pettus
> >> x...@thebuild.com
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Django users" group.
> >> To post to this group, send email to django-us...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Mathieu Leduc-Hamel

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#8 Dec. 17, 2010 20:51:50

Anurag C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django vs Postgres Connection


You might want to check your wsgi script.

Looks like the environment variables that you have in there are wrong and
not allowing the import of settings.py

Regards,
Anurag

On Sat, Dec 18, 2010 at 1:32 AM, armandoperico <armandoper...@hotmail.com>wrote:

> Hi,
> this is the first time i try to deploy a django project and i'm not
> being able to solve a problem.
>
> On my local machine everything is running fine, but when i try to
> deploy to a running server with apache (mod_wsgi), i'm getting the
> following error (database related):
>
> Caught OperationalError while rendering: could not connect to server:
> Permission denied
> Is the server running on host "127.0.0.1" and accepting
> TCP/IP connections on port 5432?
>
> The fact is that when i try to connect to the database using psql -
> U... is working fine, so postgree is working ok, it seems to be with
> django :S
>
> Exception Location: /usr/lib/python2.6/site-packages/django/db/
> backends/postgresql_psycopg2/base.py in _cursor, line 136
>
> this is my django version (just in case): 1.2.3
>
> Anyone here has faced this problem ?
> have any ideas?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#9 Dec. 17, 2010 21:00:28

a.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django vs Postgres Connection


Below follows my wsgi script.
But i don't think it's not being able to read the settings.py because
it is actually complaining about the info that is inside there. (the
DB infos)
:S

---------wsgi
-------------------------------------------------------------------------------------------
import os
import sys

sys.path.append('*******/wsgi/src/mysite/')
sys.path.append('*/wsgi/')

os.environ = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
---------wsgi
-------------------------------------------------------------------------------------------

On Dec 17, 9:51 pm, Anurag Chourasia <anurag.choura...@gmail.com>
wrote:
> You might want to check your wsgi script.
>
> Looks like the environment variables that you have in there are wrong and
> not allowing the import of settings.py
>
> Regards,
> Anurag
>
> On Sat, Dec 18, 2010 at 1:32 AM, armandoperico
> <armandoper...@hotmail.com>wrote:
>
>
>
>
>
>
>
> > Hi,
> > this is the first time i try to deploy a django project and i'm not
> > being able to solve a problem.
>
> > On my local machine everything is running fine, but when i try to
> > deploy to a running server with apache (mod_wsgi), i'm getting the
> > following error (database related):
>
> > Caught OperationalError while rendering: could not connect to server:
> > Permission denied
> >        Is the server running on host "127.0.0.1" and accepting
> >        TCP/IP connections on port 5432?
>
> > The fact is that when i try to connect to the database using psql -
> > U... is working fine, so postgree is working ok, it seems to be with
> > django :S
>
> > Exception Location:     /usr/lib/python2.6/site-packages/django/db/
> > backends/postgresql_psycopg2/base.py in _cursor, line 136
>
> > this is my django version (just in case): 1.2.3
>
> > Anyone here has faced this problem ?
> > have any ideas?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@google
> > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#10 Dec. 17, 2010 21:05:17

Anurag C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django vs Postgres Connection


On this server, are you able to connect to the PostGre database using the
command line?

psql -U myuser -h 127.0.0.1 -p 5432 -d dbname

Regards,
Anurag

On Sat, Dec 18, 2010 at 2:19 AM, armandoperico <armandoper...@hotmail.com>wrote:

> on settings.py..
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'dbname', # Or path to database
> file if using sqlite3.
> 'USER': 'myuser', # Not used with
> sqlite3.
> 'PASSWORD': 'mypass', # Not used with
> sqlite3.
> 'HOST': '127.0.0.1', # Set to empty
> string for localhost. Not used with sqlite3.
> 'PORT': '5432', # Set to empty string for
> default. Not used with sqlite3.
> }
> }
>
> On Dec 17, 9:25 pm, Christophe Pettus <x...@thebuild.com> wrote:
> > On Dec 17, 2010, at 12:02 PM, armandoperico wrote:
> >
> > > On my local machine everything is running fine, but when i try to
> > > deploy to a running server with apache (mod_wsgi), i'm getting the
> > > following error (database related):
> >
> > > Caught OperationalError while rendering: could not connect to server:
> > > Permission denied
> > > Is the server running on host "127.0.0.1" and accepting
> > > TCP/IP connections on port 5432?
> >
> > What's your database configuration on the Apache machine?
> >
> > --
> > -- Christophe Pettus
> > x...@thebuild.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 23rd of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support