Deploy a Python App on Railway under 2 minutes!
Here we have a very simple Flask App:
import flask
app = flask.Flask(__name__)
@app.route('/')
def index():
return "Hello World!"
if __name__ == '__main__':
app.run()
We name this file main.py
We create two more files:
-
requirements.txt
Flask gunicorn
-
Procfile
web: gunicorn server:app
The directory should look like this:
├── src
│ ├── main.py
│ │
│ ├── Procfile
│ |
│ ├── requirements.txt
Now simply create a GitHub Repository and add the files that we just created.
Log in to your Railway dashboard and create a new project.
Choose Deploy from GitHub repo
After that, simply configure your GitHub settings to allow Railway to read the repository with your app.
And just like that you have deployed your Python App to Railway!
You can generate a domain for your app or even connect your custom domain!
Written by Soham Datta ✌🏻
i do exactly this and get no module named 'server' error