Skip to content Skip to sidebar Skip to footer

Django App Under Uwsgi Failing To Start When Using Postgresql Database

I setup an app in Ubuntu 14.04 on AWS -> NGINX -> UWSGI -> DJANGO APP. The app runs completely fine when using sqllite3, but when I use django.db.backends.postgresql_psyco

Solution 1:

I finally figured out what my problem was. In my uwsgi.ini file I had

limit-as = 128

This switch limits the address space of uwsgi process to 128mb. I guess that was not enough for PostgreSQL driver. After removing the switch everything works like a charm. Although it's better to find a value that works instead of just removing the value altogether.

Solution 2:

Root exception is this:

django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: libgpg-error.so.0: failed to map segment fromsharedobject: Cannot allocate memory

From what I found, it may be a 32/64-bit issue. For example, see this page:

https://serverfault.com/questions/329418/cannot-allocate-memory-error-for-psycopg2-and-libgcrypt-so-on-debian-6-64bit

You might want to use the file tool and check the architectures of your libs (specifically _psycopg.so and libgpg-error.so.0). Also compare with python -c "import platform; print platform.architecture()"

Post a Comment for "Django App Under Uwsgi Failing To Start When Using Postgresql Database"