/bin/bash: line 1: gunicorn: command not found

joefreyTRIAL

a year ago

I have encountered this error and because of this the deployment has not been successful.

requirements.txt

asgiref==3.7.2
Django==5.0.1
django-appconf==1.0.6
django-compressor==4.4
django-widget-tweaks==1.5.0
gunicorn==20.0.4
packaging==23.2
pillow==10.2.0
psycopg2-binary==2.9.9
rcssmin==1.1.1
rjsmin==1.2.1
setuptools==69.1.1
sqlparse==0.4.4
wheel==0.42.0
whitenoise==6.6.0

runtime.txt
Python 3.11

Please help this is my first time to deploy django project

Solved

12 Replies

joefreyTRIAL

a year ago

Here's the screenshot https://imgur.com/a/uM563rT


a year ago

do you have a different package management file? like a pyproject.toml or a pipfile?


joefreyTRIAL

a year ago

Yes, I have package.json and tailwind.config.js for TailwindCSS

Procfile
web: gunicorn dsdamembership.wsgi --log-file -


joefreyTRIAL

a year ago

I tried using railway.json and remove Procfile

{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn dsdamembership.wsgi",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}

But no lack. I always got crashed on every deployment


joefreyTRIAL

a year ago

And now I have got this error.
https://imgur.com/a/6jOoivd

It says
/bin/bash: line 1: python: command not found


a year ago

please share your repo


joefreyTRIAL

a year ago

Shared with you. Thank you for helping me even though you stated in your profile here that "I don't work for Railway". Really appreciated your help..


a year ago

try using this railway.json file instead

{
  "$schema": "https://schema.up.railway.app/railway.schema.json",
  "build": {
    "builder": "NIXPACKS",
    "nixpacksPlan": {
      "providers": ["python"],
      "phases": {
        "setup": {
          "nixPkgs": ["...", "nodejs"]
        },
        "npm:install": {
          "dependsOn": ["setup"],
          "cmds": ["npm ci"]
        }
      }
    }
  },
  "deploy": {
    "startCommand": "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn dsdamembership.wsgi",
    "restartPolicyType": "ON_FAILURE",
    "restartPolicyMaxRetries": 10
  }
}

Edit, seems the start command is getting a little messed up, please correct that when you put this into use.


Status changed to Solved railway[bot] about 1 year ago


joefreyTRIAL

a year ago

I have applied this new code in railway.json and corrected the start command and redeploy it and I think it worked!.

I want to share the deploy logs
https://imgur.com/a/7gmA7g4

There are INFO logs, are all these fine? right?

[2024-03-11 01:22:55 +0000] [7] [INFO] Starting gunicorn 21.2.0
[2024-03-11 01:22:55 +0000] [7] [INFO] Listening at: http://0.0.0.0:6111 (7)
[2024-03-11 01:22:55 +0000] [7] [INFO] Using worker: sync
[2024-03-11 01:22:55 +0000] [12] [INFO] Booting worker with pid: 12


a year ago

logs look good to me


joefreyTRIAL

a year ago

Wow! It worked! I can see the page now.. Thank you so much for your help.


a year ago

no problem