0

I hope someone can help me to resolve this issue. I have a webapp developed in Django with postgresql, the app is working properly in my local pc, the issue started when i migrate the code into a server. I have a Windows Server 2019 core, and after configure the IIS to serve this app, appear the following issue:

Error occurred while reading WSGI handler: Traceback (most recent call last): File "C:\Python\Python38\lib\site-packages\django\db\backends\postgresql\base.py", line 25, in import psycopg2 as Database ModuleNotFoundError: No module named 'psycopg2'

I have installed the connector "psycopg2" and also i already tried all that i found in "google" but i couldnt fix that issue.

SO i dont know if i forgot configure something in the IIS or what is happening here because if i open the python console or django shell and import the PSYCOPG2 the connector is imported successfully.

Thanks and Regards.

  • 1
    is psycopg2 installed in same pyhton environment or different one – sahasrara62 Apr 22 '20 at 22:48
  • Does this answer your question? [Error: No module named psycopg2.extensions](https://stackoverflow.com/questions/12728004/error-no-module-named-psycopg2-extensions) – Elmahy Apr 22 '20 at 22:50
  • 1
    Make sure Python is added to your path, then make sure psycopg2 is installed with pip. E.g. pip install psycopg2 – CyberDemic Apr 22 '20 at 22:54
  • ELmahy, this is not my question. yes the psycopg2 is installed in both side into the pipenv and into a global server. Also i have istalled python 3.8 and djano 3.0.2 – Federico Pagani Apr 22 '20 at 23:41
  • try to run python -m pip install psycopg2-binary command – Jalpa Panchal Apr 28 '20 at 07:14
  • Hi Panchal, i tried this command but is not working. i couldnt fix this issue yet, but its very weird because if i open the python console or django console and try import psycopg2 is working as expected. – Federico Pagani May 08 '20 at 12:53
  • i could fix this issue. The issue was generated because i had 2 pythons installation. so the solution was delete all related with python and reinstall python and all libraries in one place. – Federico Pagani May 13 '20 at 17:59

0 Answers0