server error (500)
fuad47
HOBBYOP

3 months ago

I am deploying a django project via github. Projects works in localhost. Deployment also finishes successfully. But I get error when opening the domain: server error (500). Setting debug to true doesn't change the system message.

These lines in deploy log are colored red.

[2025-12-02 14:53:00 +0000] [1] [INFO] Starting gunicorn 23.0.0

[2025-12-02 14:53:00 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)

[2025-12-02 14:53:00 +0000] [1] [INFO] Using worker: sync

[2025-12-02 14:53:00 +0000] [7] [INFO] Booting worker with pid: 7

my procfile (maybe helpful):

web: pip install -r requirements.txt && python manage.py migrate && python manage.py collectstatic --noinput && gunicorn bgremover.wsgi --bind 0.0.0.0:$PORT

Solved$10 Bounty

Pinned Solution

fuad47
HOBBYOP

3 months ago

The problem was that environment key for redis_url service was pointing to wrong address (previous redis server which was deleted).

I updated the address and it worked.!

Thank you for your effort !

Attachments

11 Replies

Railway
BOT

3 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


3 months ago

Those are from the build logs? raised_eyebrow emoji

You shouldn't be starting your app in the build process, try removing the runtime behaviour from your build process and move it into the deployment process instead

If you're using Railpack/Nixpacks then you can change this by changing the build command to only handle build stuff, migrations would likely be in predeploy command and the gunicorn startup command would be in the start command


dev

Those are from the build logs?You shouldn't be starting your app in the build process, try removing the runtime behaviour from your build process and move it into the deployment process insteadIf you're using Railpack/Nixpacks then you can change this by changing the build command to only handle build stuff, migrations would likely be in predeploy command and the gunicorn startup command would be in the start command

fuad47
HOBBYOP

3 months ago

it is actually deploy log (i corrected)


3 months ago

Oh alright, that makes much more sense sweat_smile emoji

one question then, how come your dependency installations and startup command is in one command?

You'd actually want your dependency installation to happen in the build phase


3 months ago

Also, could you send the domain in question? It might help with debugging


dev

Also, could you send the domain in question? It might help with debugging

fuad47
HOBBYOP

3 months ago

https://bgremover-production-1ddb.up.railway.app

I havent setup any custom build or start command.

Attachments


3 months ago

That error 500 is actually an application-error, Railway-side errors don't look like that

Good news: that means everything between your PC to your application is working

Bad news: your app isn't working

Do you have any endpoints/middleware or anything that return error 500?


dev

That error 500 is actually an application-error, Railway-side errors don't look like thatGood news: that means everything between your PC to your application is workingBad news: your app isn't workingDo you have any endpoints/middleware or anything that return error 500?

fuad47
HOBBYOP

3 months ago

it is running perfect in local.

Attachments


fuad47
HOBBYOP

3 months ago

Do you have any endpoints/middleware or anything that return error 500? ->

I dont think so.


3 months ago

Honestly, I think the best course of action right now is for you to add exception handling in your application so we know where the error originates from

The reason I say this is because that error is about as generic as they get, and could come from literally anything, so I'd say it's best to tie up loose ends so we can narrow down where it could be coming from. Do you have a database or something? Might be worth looking at that first, it's a likely culprit

I'd also recommend seperating your commands into the correct locations:

  • installations in build command (though since you're using Railpack then this is handled automatically so you can just remove it)

  • manage.py and gunicorn start in the start command or keep it in your Procfile


fuad47
HOBBYOP

3 months ago

The problem was that environment key for redis_url service was pointing to wrong address (previous redis server which was deleted).

I updated the address and it worked.!

Thank you for your effort !

Attachments


Status changed to Solved noahd 3 months ago


Loading...