How to tell railway to install pip files for python server

cadhig
HOBBY

a year ago

I am doing a React/TS frontend with a Flask Python backend. I have a requirements.txt and have this listed in railway.toml

[build.nixpacksPlan.phases.install]
dependsOn = ["setup"]
cmds = ["npm install", "pip install -r requirements.txt"]

i keep getting the error:error: undefined variable 'pip'

3 Replies

a year ago

React frontend and a flask backend are very different things, please share your repo so that we can understand what you are attempting to deploy.


cadhig
HOBBY

a year ago


a year ago

This is an amalgamation of a react app and a flask app, not an ideal project structure to say the least, you would want to adopt a more conventional project structure, a monorepo would be best for this, and your structure would look something like this -

.
├── frontend/
│   ├── src/
│   ├── index.html
│   ├── package.json
│   ├── package-lock.json
│   └── ...
└── backend/
    ├── model.pth
    ├── drawAi.py
    ├── server.py
    ├── requirements.txt
    └── ...

That is going to be a far better project structure than throwing everything in the same folder.

Let me know when you have made these changes and then we can proceed.