0

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%2F20220307%2Fus-east-1%2Fs3%2Faws4_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@protonmail.com
2022-03-07T22:03:03.734406+00:00 app[api]: Deploy 922870fe by user email@protonmail.com
2022-03-07T22:03:03.734406+00:00 app[api]: Running release v26 commands by user email@protonmail.com
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@protonmail.com
2022-03-07T22:03:12.919074+00:00 app[api]: Release v26 command failed by user email@protonmail.com
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 structure is like:

runtime.txt
requirements.txt
Procfile
backend/
    |-- __init__.py
        api/
        feh/
            |-- __init__.py
                errorlog
                settings.py
                urls.py
                wsgi.py
        static/
        db.sqlite3
        manage.py
scraper.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!

rustyhu
  • 1,912
  • 19
  • 28
Domini
  • 75
  • 6

1 Answers1

1

Neither of the processes in your Procfile is specified correctly.

  • The web command's --pythonpath should just be backend and it should receive the dotted path feh.wsgi as an argument:

    web: gunicorn --pythonpath backend feh.wsgi --log-file -
    
  • The 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, and - - no-input should be the single argument --no-input. Try this instead:

    release: python backend/manage.py makemigrations --no-input
    
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • Thank you. But... now I'm getting an error where it says it can't find my feh/ folder. ``` text upon text of logs... 2022-03-08T02:24:28.926500+00:00 app[web.1]: ModuleNotFoundError: No module named 'feh'``` I suppose this might be for another question then. Thank you. – Domini Mar 08 '22 at 02:29
  • Okay, figured out my other error: Taken from [here](https://stackoverflow.com/questions/49457037/heroku-cant-find-my-settings-py-file), My web line in my Procfile should have been: `web: gunicorn --pythonpath backend feh.wsgi --log-file - ` Since Django isn't at the root of my project, I have specify django project directory. I knew my Procfile was the source of all my problems, THANK YOU CHRIS!!! – Domini Mar 08 '22 at 03:09
  • @Domini, you're right, I missed that. Thanks for pointing it out. I've updated my answer accordingly in case it helps others. – ChrisGPT was on strike Mar 08 '22 at 12:10