Home > Net >  Django deployment to Heroku error: python: can't open file '/app/backend.manage.py':
Django deployment to Heroku error: python: can't open file '/app/backend.manage.py':

Time:03-08

I've once again come to beg stackoverflow for help. I am attempting to deploy a django project to Heroku and I'm getting slapped left and right with errors but hopefully this is the last one.

2022-03-07T22:03:09.363036 00:00 heroku[release.9772]: Starting process with command `/bin/sh -c 'if curl https://heroku-release-output.s3.amazonaws.com/log-stream?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3LIQ2SWG7V76SVQ/20220307/us-east-1/s3/aws4_request&X-Amz-Date=20220307T220304Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=ddb760b1c36e913b7c0cc984428e3b853cdac67755e4cfa6038cef77a37b6a25 --silent --connect-timeout 10 --retry 3 --retry-delay 1 >/tmp/log-stream; then
2022-03-07T22:03:10.031451 00:00 heroku[release.9772]: State changed from starting to up
2022-03-07T22:03:10.527868 00:00 app[release.9772]: python: can't open file '/app/backend.manage.py': [Errno 2] No such file or directory
2022-03-07T22:03:10.706087 00:00 heroku[release.9772]: Process exited with status 2
2022-03-07T22:03:10.901301 00:00 heroku[release.9772]: State changed from up to complete
2022-03-07T22:02:37.000000 00:00 app[api]: Build started by user [email protected]
2022-03-07T22:03:03.734406 00:00 app[api]: Deploy 922870fe by user [email protected]
2022-03-07T22:03:03.734406 00:00 app[api]: Running release v26 commands by user [email protected]
2022-03-07T22:03:05.039171 00:00 app[api]: Starting process with command `/bin/sh -c 'if curl $HEROKU_RELEASE_LOG_STREAM --silent --connect-timeout 10 --retry 3 --retry-delay 1 >/tmp/log-stream; then
2022-03-07T22:03:05.039171 00:00 app[api]:   chmod u x /tmp/log-stream
2022-03-07T22:03:05.039171 00:00 app[api]:   /tmp/log-stream /bin/sh -c '"'"'python backend.manage.py makemigrations - - no-input'"'"'
2022-03-07T22:03:05.039171 00:00 app[api]: else
2022-03-07T22:03:05.039171 00:00 app[api]:   python backend.manage.py makemigrations - - no-input
2022-03-07T22:03:05.039171 00:00 app[api]: fi'` by user [email protected]
2022-03-07T22:03:12.919074 00:00 app[api]: Release v26 command failed by user [email protected]
2022-03-07T22:03:15.000000 00:00 app[api]: Build succeeded

And when I try to run the program in a virtual environment on my local machine using the command heroku local:

6:06:35 PM web.1 |  [2022-03-07 18:06:35 -0400] [33412] [INFO] Starting gunicorn 20.1.0
6:06:35 PM web.1 |  [2022-03-07 18:06:35 -0400] [33412] [ERROR] Connection in use: ('0.0.0.0', 5000)
6:06:35 PM web.1 |  [2022-03-07 18:06:35 -0400] [33412] [ERROR] Retrying in 1 second.
6:06:36 PM web.1 |  [2022-03-07 18:06:36 -0400] [33412] [ERROR] Connection in use: ('0.0.0.0', 5000)

And so on and so on.

I suspect this has to do with my Procfile. And admittedly, I'm not too sure on how to set it up. I currently have in my Procfile:

web: gunicorn --pythonpath backend.feh backend.feh.wsgi --log-file - 
release: python backend.manage.py makemigrations - - no-input

And my directory is setup via:

FE_APP/

runtime.txt
requirements.txt
Procfile
backend/
scraper.py

In FE_AP/backend/

__init__.py
api/
feh/
static/
db.sqlite3
manage.py

Where FE_APP/backend/feh/ has

__init__.py
errorlog
settings.py
urls.py
wsgi.py

I'm positive my Procfile is the cause for this issue but I don't know how to go about debugging this. At the very least, the project runs fine on my venv. Thank you in advance!

CodePudding user response:

Your release command refers to a file called backend.manage.py:

release: python backend.manage.py makemigrations - - no-input

That argument should be a path to a file, not a dotted Python module. I'm pretty sure you also want to use --no-input instead of - - no-input. Try this instead:

release: python backend/manage.py makemigrations --no-input
  • Related