How to Deploy a Django Project with Webpack on Railway?

abe-101HOBBY

a month ago

I'm deploying a Django project on Railway, and my railway.json looks like this:

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

The project includes a build step for Webpack, but the deployment fails because Python isn't installed. It seems Nixpacks installs dependencies based on the commands provided, but I need both Python and Node.js for this project.

How can I configure Nixpacks to install both Python and Node.js?

0 Replies

abe-101HOBBY

a month ago

9f5f4d34-96e6-48ba-9a8a-815fd9678a96


a month ago

Hi! You can include it as a provider in the service settings


a month ago

there should be a "nodejs" already on the list


abe-101HOBBY

a month ago

manually add python?


abe-101HOBBY

a month ago

that seems to solve it


a month ago

you can also do it through config files with a nixpacks.toml


abe-101HOBBY

a month ago

just curious,
is there a way to define that in the railway.json?


a month ago

railway.json has a nixpacksPlan properties that include a "providers" array


a month ago

but I never used it