Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy and Host Bottle on Railway

Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. Perfect for building small web applications, REST APIs, and prototypes with minimal overhead and zero dependencies beyond the Python standard library.

Deploy on Railway

About Hosting Bottle

Hosting Bottle applications requires a WSGI server for production deployments. This template provides a pre-configured setup with Gunicorn as the WSGI server, automatic port binding, health check endpoints, and environment variable configuration. Railway handles the infrastructure automatically - no server management, manual scaling, or complex deployment pipelines needed. Just push your code and Railway builds, deploys, and scales your Bottle app instantly.

Common Use Cases

  • Quick API prototypes and microservices
  • Lightweight webhook handlers and integrations
  • Simple REST APIs that need to scale
  • Learning Python web development
  • Minimal web scrapers and data processors

Dependencies for Bottle Hosting

  • Python 3.13+ runtime environment
  • Gunicorn WSGI server for production serving
  • Environment variable support for configuration
  • Health check endpoint for monitoring

Deployment Dependencies

Implementation Details

This template includes a minimal main.py with two routes:

# Health check endpoint for Railway monitoring
@app.route('/health')
def health_check():
    return {"status": "healthy", "timestamp": time.time()}

# Main route
@app.route('/')
def index():
    return '<h1>Hello from Bottle!</h1>'

The app automatically binds to Railway's provided PORT environment variable with IPv4/IPv6 dual-stack support.

Why Deploy Bottle on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Bottle on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

🚀 Quick Start

Click the deploy button above and your app is live in seconds! Zero configuration needed - Railway handles everything automatically.

💻 Local Development

# Clone and setup
git clone git@github.com:shinypebble/railway-python-bottle-quickstart.git
cd railway-python-bottle-quickstart

# Create virtual environment (with uv - recommended)
uv venv --python 3.13
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# Install dependencies
uv sync

# Run locally
python main.py  # Development server on http://localhost:8080

🌐 Environment Variables

Variable Description Default
PORT Server port (auto-provided by Railway) 8080
LOG_LEVEL Gunicorn log level info

Railway automatically provides PORT - no configuration needed!

🔧 Customization

Add Dependencies:

# In pyproject.toml
dependencies = [
    "bottle>=0.12.25",
    "gunicorn>=21.2.0",
    "your-package>=1.0.0",
]

Add Routes:

# In main.py
@app.route('/api/users')
def users():
    return {'users': ['alice', 'bob']}

🚨 Troubleshooting

App won't start? → Check logs with railway logs
Dependencies failing? → Clear cache with railway up --no-cache
Health check failing? → Verify /health endpoint returns 200

📚 Resources


Made with 💎 by Shiny PebbleMIT License

About

railway-python-bottle-quickstart

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages