1

I deployed my django application with sqlite3, uwsgi emperor mode and python v3.6.7 on ubuntu 18.04 Now I changed database to postgresql, every thing worked fine in my local machine, but in the server when I run uwsgi server.ini (for testing purpose) I get this error:

django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'

and application just shows "Internal Server Error" in the browser.

  • I can import psycopg2 in the python shell without any error
  • psycopg2 is installed in my virtualenv
  • I installed python-psycopg2 using apt-get too
  • django will run without any problem using python manage.py runserver
  • I did not use sudo with pip to install psycopg2
  • django settings.py configs are right, because I performed migrations

I read all similar problems and tried their answers, nothing worked :(

4
  • I read than answer, the problem is that I can import psycopg2 in python shell Commented May 23, 2019 at 11:44
  • Are you sure that the shell is using the same environment. Commented May 23, 2019 at 11:44
  • Yes, I used virutalenv wrapper and I open python shell while virtualenv is enabled @Sayse Commented May 23, 2019 at 11:45
  • @Sayse: How does one figure out whether the shell is using the same environment? Commented Dec 23, 2020 at 22:10

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.