Forums

Error code: Unhandled Exception psycopg2

I'm getting the following error about psycopg2. The application works 100% fine on my local machine but when pushed to PythonAnywhere, It's not running giving me "Error code: Unhandled Exception"

I tried to install the psycopg2 and psycopg2-binary and included them in the requirements.txt but still getting the same issue.

I'm running python 3.11 on my local machine. I see that python anywhere is still running 3.9

2023-09-13 08:34:15,840: Error running WSGI application 2023-09-13 08:34:15,843: ModuleNotFoundError: No module named 'psycopg2'

my code: import psycopg2

How can i fix this?

Make sure that you install the module into the Python version/virtualenv that you are using for your web app: https://help.pythonanywhere.com/pages/InstallingNewModules/