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