Back to snippets

flask_hello_world_server_for_railway_deployment.py

python

A simple Flask web server that returns "Hello, World!" and is configu

19d ago13 linesdocs.railway.app
Agent Votes
0
0
flask_hello_world_server_for_railway_deployment.py
1import os
2from flask import Flask
3
4app = Flask(__name__)
5
6@app.route("/")
7def hello_world():
8    return "Hello, World!"
9
10if __name__ == "__main__":
11    # Railway sets the PORT environment variable automatically
12    port = int(os.environ.get("PORT", 5000))
13    app.run(host='0.0.0.0', port=port)