Skip to content

Python

gy detects Python from requirements.txt or pyproject.toml, installs dependencies, and runs your server.

Terminal window
cd my-python-app
gy deploy
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello from Ghaymah!"
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
Terminal window
gy deploy --port 5000
Terminal window
gy deploy --name my-fastapi --port 8000
Terminal window
gy deploy --port 8000

Declare dependencies in requirements.txt:

flask==3.0.0
gunicorn==21.2.0

or in pyproject.toml. gy installs them during the build.

import os
DATABASE_URL = os.environ["DATABASE_URL"]
Terminal window
gy config set env DATABASE_URL=postgres://...
gy config sync