krypton201
krypton201
RRailway
Created by krypton201 on 6/12/2023 in #✋|help
Issue with Flask Deployment
Hello, here is my project id: e8d46baa-5de4-495e-bc2e-a8a2b37ed2b0. I am trying to deploy my flask/redis application to railway so that one server is running where 1 port is running the flask api part and another part which is running the redis part. I believe I got the redis part on railway to work, as I can see all my data, but for some reason the flask deployment isnt working as expected. In my main.py, I have this code:
if __name__ == '__main__':
load_data_to_redis()
app.run(host='0.0.0.0', port=int(os.getenv("RAILWAY_PORT", 5000)), debug=True)
if __name__ == '__main__':
load_data_to_redis()
app.run(host='0.0.0.0', port=int(os.getenv("RAILWAY_PORT", 5000)), debug=True)
However, when I run the deployment, I see this in the deploy logs:
* Serving Flask app 'main'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://172.17.0.225:5000
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 122-734-501
* Serving Flask app 'main'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://172.17.0.225:5000
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 122-734-501
For some reason, it's running locally instead of the railway url and it gives this notification/popup above the logs saying "Looks like your app is listening on 127.0.0.1. You may need to listen on 0.0.0.0 instead." even though I am listening on 0.0.0.0. I can provide more of what's in my main.py if needed. I'm not sure what I am doing wrong so would really appreciate it if someone could take a look. Much appreciated!
39 replies