(Disclaimer: I'm a frontender and don't know much about python; I'm trying to deploy the backend that my partner made to Heroku along with my React build. Apologies in advance if I'm hard to understand/using JS terminology)
I'm trying to host a django app on Heroku. If I include import django_heroku django_heroku.settings(locals())
and then try to run the server, I get this error:
ModuleNotFoundError: No module named 'django_heroku'
This thread reports that it's because of a missing dependency. However, when I try to run pip3 install psycopg2
I get this cascade of errors -- it's like pip is trying to install older and older versions of psycopg2 until it find a match, but each time it errors out. And the error states:
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
I don't have a pg_config file/package, nor a steup.cfg or a setup.py package. There is a setuptools_build.py.
When I actually commit and run the heroku hooks, I get any variation of ModuleNotFoundError: No module named _______
and then just whichever packages comes first after the django.contrib apps. The CLI suggest running heroku config:set DISABLE_COLLECTSTATIC=1
, but this thread suggests that's probably just kicking the can down the road.
EDIT:
I originally wanted to host SQLite on Heroku, but it was rightly pointed out below that Heroku doesn't support SQLite. So I've installed postgres (via brew install postgres
and export PATH=/local/pgsql/bin:$PATH
) and psycogp2-binary
as advised in this thread, and can now sccessfully install psycopg2
. However, when I try to run the server, I still get the same ModuleNotFoundError: No module named 'django_heroku'
msg.