My original message in my slack channel, which explains the situation, as follows:
Good afternoon everyone. I am getting the following psycopg errors. I have tried most things under the sun and not able to deploy my project successfully to Heroku. I reached out to Heroku, who gave me the following link, which I also implemented with no success: Heroku article dot com/articles/connecting-heroku-postgres#connecting-in-python the actual problem code that they mentioned was at:
2023-05-04T22:58:07.473453+00:00 app[web.1]: import psycopg2 as Database
2023-05-04T22:58:07.473453+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.11/site-packages/psycopg2/init.py”, line 51, in
2023-05-04T22:58:07.473454+00:00 app[web.1]: from psycopg2._psycopg import ( # noqa
2023-05-04T22:58:07.473454+00:00 app[web.1]: SystemError: initialization of _psycopg raised unreported exception
I’ve also raised an issue with stackoverflow: python - Why does psycopg2 raise a postgreSQL error when deploying Django site to Heroku? - Stack Overflow with a more detailed synopsis of my problem, and currently waiting for a savvy developer to possibly be able to assist, as my tutor hours for this week are done. Any advise would be greatly appreciated. (edited)
Since the above message, I decided to deploy to Render.com, as I had problems with a previous heroku deployment, but the same code was able to deploy successfully to Render. I followed the render steps:
render. com/docs/migrate-from-heroku#step-1-generate-a-dockerfilerender-and-renderyaml
and the deployment failed with error codes:
May 5 01:25:14 PM 23 | # in place. We then run the apply-buildpacks.py script here because, unlike our
May 5 01:25:14 PM 24 | # v2
image, this allows us to expose build-time env vars to your app.
May 5 01:25:14 PM 25 | >>> RUN /render/build-scripts/apply-buildpacks.py ${HEROKU_STACK}
May 5 01:25:14 PM 26 |
May 5 01:25:14 PM 27 | # We strongly recommend that you package a Procfile with your application, but
May 5 01:25:14 PM --------------------
May 5 01:25:14 PM error: failed to solve: process “/bin/bash -c /render/build-scripts/apply-buildpacks.py ${HEROKU_STACK}” did not complete successfully: exit code: 1
May 5 01:25:14 PM error: exit status 1
That thing about theh Procfile, I’m not understanding, as my Procfile is configured, as follows:
web: gunicorn django_newssite.wsgi:application -b 0.0.0.0:8000
-Any help would be greatly appreciated, thanks.