Deploying Flask API for my frontend application

ahmed-jan-farooquiTRIAL

a year ago

I have a Flask based server which runs some critical tasks such as querying an LLM with Retrieval Augmented Generation. The results of this are used by my frontend application. To run this server on my local host, I simply run "python3 .py". However, the build for this fails when I try to deploy it with the error:
Start command not found
originating from Nixpacks.
I cannot find how to configure this start command anywhere. Help is appreciated.
For context, the github repo structure looks like:
--> server.py
--> requirements.txt
--> firebase-admin-creds.json
--> GPTAPIkey.txt

View Deploy details

> ⓘ Deployment information is only viewable by Project members and Railway admins.

3 Replies

a year ago

This is a flask app, meaning you need to run it with gunicorn when on Railway, otherwise you are going to be running a very costly and very fragile development server.

You can specify your start command in a railway.json file as shown here -

https://github.com/railwayapp-templates/flask/blob/main/railway.json

The template has a main.py file and you have a server.py file, so you will need to slightly tweak the start command, but hopefully that gets you going.


ahmed-jan-farooquiTRIAL

a year ago

Thank you. I was able to deploy it successfully using gunicorn like you mentioned.


a year ago

Awsome!


Deploying Flask API for my frontend application - Railway Help Station