[SOLVED] SettingNotSet on PostgreSQL in the production configuration

0 views
Skip to first unread message

Mikko Ohtamaa

unread,
Nov 20, 2009, 5:44:53 AM11/20/09
to Satchmo users
Symptoms: cannot run Satchmo on the production server, hilarious
SettingNotSet exceptions all over the place

Configuration: Apache / mod_wsgi / PostgresSQL

Cause: PostgreSQL does not allow passworded connections from the
localhost. Satchmo hides the error (swallows the exception?) when
PostgreSQL tries to report about the invalid credentials.

Root cause: Bad architecture. Satchmo uses "livesettings" table which
tries to make Django settings loadable from database instead of a
file. However, Django architecture is not exactly flexible enough and
the code could be more robust. If there are any database errors they
will be masked as "SettingNotSet" exception. The proper solution would
be make livesettings and Django to use explicit application
initialization patterns instead of current lazy initialization . The
intermediate solution would be to do some kind of database check when
Satchmo starts in the production mode.

The above applies to all kind of cache/database errors, not just
PostgreSQL.

Fix:

If you dig deep enough you'll get this error visible:

Fri, 20 Nov 2009 12:25:40 configuration WARNING Problem finding
settings LANGUAGE.SHOW_TRANSLATIONS, FATAL: Ident authentication
failed for user "yourdatabaseuser"

1. Do not use localhost as DATABASE_HOST in settings.py, use explicit
IP address of your computer. PostgreSQL configuration will try to do
ident check for localhost connections.

2. Add your database user to /etc/postgresql/8.3/main/pg_hba.conf as a
line

host yourdatabaseuser yourdatabaseuser 0.0.0.0/0 md5

3. Restart PostgreSQL

References:

http://archives.postgresql.org/pgsql-admin/2006-10/msg00142.php

http://groups.google.com/group/satchmo-users/browse_thread/thread/4299574cd83146a8/4bada9d7aeb5a472?lnk=raot

--
Mikko Ohtamaa
http://www.twinapex - Python professionals for hire

ruckc

unread,
Dec 6, 2009, 7:09:42 PM12/6/09
to Satchmo users
I'm running into this issue (SettingNotSet with no connections being
attempted to database). I have full debug5 logging enabled on my
database and i am not seeing apache2/mod_wsgi attempt connecting to
the database. I changed it from localhost to the ip and ensured
pg_hba.conf was configured properly and allows connections on the ip,
but that doesn't offer any resolution or change in symptoms.



On Nov 20, 5:44 am, Mikko Ohtamaa <mi...@redinnovation.com> wrote:
> Symptoms: cannot run Satchmo on the production server, hilariousSettingNotSetexceptions all over the place
> http://groups.google.com/group/satchmo-users/browse_thread/thread/429...
>
> --
> Mikko Ohtamaahttp://www.twinapex- Python professionals for hire
Reply all
Reply to author
Forward
0 new messages