The process of hosting a Robyn app on various cloud providers.
Railway
We will be deploying the app on Railway
.
A GitHub account is needed as a mandatory prerequisite.
We will deploy a sample "Hello World," demonstrating a simple GET route and serving an HTML file.
Directory structure:
bash
app folder/
main.py
requirements.txt
index.html
Note - Railway looks for a main.py as an entry point instead of app.py. The build process will fail if there is no main.py file.
py
from robyn import Robyn, serve_html
app = Robyn(__file__)
@app.get("/hello")
async def h(request):
print(request)
return "Hello, world!"
@app.get("/")
async def get_page(request):
return serve_html("./index.html")
if __name__ == "__main__":
app.start(url="0.0.0.0", port=PORT)
html
<h1> Hello World, this is Robyn framework! <h1>