Skip to main content

A unified Python package for deploying to multiple platforms

Project description

Multi-Platform Deployer ๐Ÿš€

PyPI - Version PyPI - Downloads

Deploy your Python apps to any cloud platform without the headache.

Deploying to different cloud platforms usually means learning completely different tools, config formats, and workflows. That's exhausting and error-prone. This package fixes that by giving you a single, simple interface to deploy Flask, Django, and FastAPI applications to Render, Railway, Vercel, and Heroku.

Think of it as a universal translator for cloud deployments.


TL;DR Quickstart

  1. Install the tool once (inside your project or globally):
py -m pip install multi-platform-deployer
  1. Drop a 6-line shim into the root of every project where you want the friendly py deploy.py <command> syntax:
# deploy.py
from multi_platform_deployer.cli import main

if __name__ == "__main__":
   raise SystemExit(main())

Prefer not to add a file? You can always run the package directly via python -m multi_platform_deployer.cli <command>.

  1. Create your deployment config:
py deploy.py setup

This guides you through creating deployment.yaml with your platform, app name, and more. 4. Ship with commands:

py deploy.py check          # Pre-flight audit
py deploy.py run            # Guided deployment (add --multi for several platforms)
py deploy.py health --url https://your-app.com

That's itโ€”config once, then treat deploy.py like any other project tool.


What This Does

The Problem

You've built a great Python web app and now you want to deploy it. But here's the thing:

  • Render uses render.yaml
  • Railway uses railway.json
  • Vercel is completely different
  • Heroku uses Procfile
  • Each one has different environment variable management, different requirements

It's confusing. You end up copy-pasting from docs, getting things wrong, and spending hours debugging deployment issues.

The Solution

I automated all of that. This package:

  1. Checks your app - Validates that your app is actually ready for production (not just locally)
  2. Picks the platform - Works with Render, Railway, Vercel, and Heroku (and you can add more)
  3. Handles everything - Migrations, environment variables, config files, health checks
  4. Does one deploy - Single command to deploy to one or multiple platforms simultaneously

That's it. You go from code to deployed in minutes, not hours.


Installation

Install from PyPI (recommended)

# Inside any virtual environment or global workstation
py -m pip install multi-platform-deployer

Work on the Source Locally

git clone https://github.com/yourusername/multi-platform-deployer.git
cd multi-platform-deployer
python -m venv .venv
.venv\Scripts\activate  # On macOS/Linux: source .venv/bin/activate
py -m pip install -e .
py -m pip install -e ".[dev]"  # Include lint/test extras while developing

Get Started in 3 Steps

Step 1: Set Up Your Deployment Configuration

py deploy.py setup

This launches an interactive wizard that creates your deployment.yaml file. You'll be asked for:

  • Platform (Render, Railway, Vercel, or Heroku)
  • App name (how your app will be named on the platform)
  • Environment variables (optional, but recommended)
  • Services (Railway-specific, optional)

When done, your deployment.yaml is ready to commit to git.

Step 2: Check If Your App Is Ready

py deploy.py check

This runs a battery of checks to make sure your app is production-ready. It'll tell you:

  • โœ… Do you have a requirements.txt?
  • โœ… Is your SECRET_KEY properly configured?
  • โœ… Is debug mode off?
  • โœ… Are your database settings production-safe?
  • โœ… Is your Python runtime/version pinned?
  • โœ… Are your .env secrets real (no placeholders)?
  • โœ… Is your git workspace clean before shipping?
  • ...and more

If everything passes, you're good to go. If not, it tells you exactly what to fix.

Step 3: Deploy

# Deploy to one platform
py deploy.py run

# Deploy to multiple platforms at once
py deploy.py run --multi

You'll be guided through a simple wizard:

  1. Pick your platform(s) (or use config from deployment.yaml)
  2. Decide if you want database migrations run
  3. Watch it deploy (takes seconds)

That's actually it. Your app is live.

Step 4: Verify It Works

py deploy.py health --url https://my-app.onrender.com

This checks that your deployed app is up and responding correctly. It verifies:

  • Server is running
  • Main endpoints are responsive
  • Database is connected (if applicable)

The CLI Commands

Everything is straightforward. Here's what you can do:

Command What It Does
py deploy.py setup Create/edit deployment.yaml configuration (first time?)
py deploy.py check Verify your app is production-ready
py deploy.py run Deploy to one platform (interactive)
py deploy.py run --multi Deploy to multiple platforms at once
py deploy.py info Show info about your project
py deploy.py health --url <url> Check if deployed app is healthy
py deploy.py health --url <url> --endpoints "/,/api,/health" Check specific endpoints
py deploy.py rollback Go back to the previous deployment
py deploy.py --help See all commands

Real Examples

Flask App (5 minutes to deployment)

# You have a simple Flask app. Check it's ready:
py deploy.py check

# Looks good! Deploy to Render:
py deploy.py run
# โ†’ Pick "Render" from the list
# โ†’ Say yes to migrations if using a database
# โ†’ Done! Visit your app

# Verify it's working:
py deploy.py health --url https://my-flask-app.onrender.com

Django Project (even easier)

# Django projects are fully supported
py deploy.py check

# Deploy to Railway (or any other platform)
py deploy.py run
# โ†’ Pick "Railway"
# โ†’ Migrations run automatically
# โ†’ Your Django app is live

# Check that admin panel and everything works
py deploy.py health --url https://my-django-app.railway.app

FastAPI App (super fast)

# FastAPI is speedy, and so is deployment
py deploy.py check

# Deploy to Vercel (serverless is perfect for FastAPI)
py deploy.py run

# Check endpoints
py deploy.py health --url https://my-fastapi-app.vercel.app --endpoints "/,/docs,/api/users"

Using the Python API (For Scripts)

If you want to automate deployments (like in CI/CD), you can use the Python API directly:

from multi_platform_deployer.main import Deployer

# Create a deployer for your project
deployer = Deployer("./my_project")

# Step 1: Check readiness
is_ready, results = deployer.check_deployment_readiness("flask")

if not is_ready:
    print("Not ready for deployment:")
    for result in results:
        if not result.passed:
            print(f"  โœ— {result.name}: {result.message}")
    exit(1)

# Step 2: Deploy
success = deployer.deploy("render", run_migrations=True)

if success:
    print("โœ“ Deployed successfully!")
    
    # Step 3: Check health
    health = deployer.check_health(
        base_url="https://my-app.onrender.com",
        endpoints=["/", "/api/health"]
    )
else:
    print("โœ— Deployment failed")
    exit(1)

Configuration

Create deployment.yaml (recommended)

You can commit this to git so everyone deploys consistently:

# deployment.yaml
platform: render  # or: railway, vercel, heroku

app_name: my-awesome-app

# Optional: Environment variables
env:
  DEBUG: "False"
  PYTHONUNBUFFERED: "1"

# Optional: Services (if using Railway)
services:
  - name: web
    buildCommand: pip install -r requirements.txt && python manage.py migrate
    startCommand: gunicorn config.wsgi
    port: 8000

Or use deployment.json

{
  "platform": ["render", "railway"],
  "app_name": "my-awesome-app",
  "env": {
    "DEBUG": "False"
  }
}

The deployer will auto-detect and load whichever you use.


What Gets Checked

For Flask Apps

  • โœ“ Requirements file exists
  • โœ“ App entry point found (app.py, wsgi.py, etc.)
  • โœ“ WSGI application configured
  • โœ“ SECRET_KEY set via environment
  • โœ“ Debug mode is OFF (not hardcoded)
  • โœ“ Error handlers configured
  • โœ“ Database configuration present
  • โœ“ Environment file exists

For Django Projects

  • โœ“ manage.py exists
  • โœ“ settings.py properly configured
  • โœ“ SECRET_KEY via environment (not in code!)
  • โœ“ ALLOWED_HOSTS set
  • โœ“ Static files configured
  • โœ“ Database configured
  • โœ“ DEBUG=False in production
  • โœ“ Security settings (CSRF, SSL, etc.)

For FastAPI Apps

  • โœ“ FastAPI app instance exists
  • โœ“ Uvicorn/Gunicorn in requirements
  • โœ“ CORS configured (if needed)
  • โœ“ Middleware setup
  • โœ“ Exception handlers
  • โœ“ Database connections configured

All checks give you specific, actionable feedback. Not vague errors. Real guidance.


Supported Platforms

Render

Best for: General purpose Python web apps

py deploy.py run
# โ†’ Select "Render"

What I set up:

  • Web service with auto-scaling
  • Environment variables
  • Deploy hooks (auto-run migrations)
  • Health checks
  • Log streaming

Railway

Best for: Using databases alongside your app

py deploy.py run
# โ†’ Select "Railway"

What I set up:

  • Container deployment
  • PostgreSQL/MySQL integration
  • Environment management
  • Volume mounting
  • Deploy triggers

Vercel

Best for: Serverless Python APIs (FastAPI, Flask)

py deploy.py run
# โ†’ Select "Vercel"

What I set up:

  • Serverless functions
  • Edge functions
  • Environment variables
  • Auto-scaling
  • CDN distribution

Heroku

Best for: Traditional deployed apps with add-ons

py deploy.py run
# โ†’ Select "Heroku"

What I set up:

  • Procfile generation
  • Buildpack detection
  • Add-on configuration
  • Dyno management
  • Log aggregation

Advanced Features

Database Migrations

Automatically detected and run:

py deploy.py run
# During the wizard, say "Yes" to run migrations

I handle:

  • Django - python manage.py migrate
  • Alembic - alembic upgrade head (Flask-SQLAlchemy)
  • Custom scripts - I can run your migration script

Health Checks

After deploying, verify everything works:

py deploy.py health \
  --url https://my-app.onrender.com \
  --endpoints "/,/api/health,/api/version"

This checks:

  • Server is responding
  • Status codes are correct
  • Response times are reasonable
  • Database is connected

Rollback

Deployed something broken? Go back instantly:

py deploy.py rollback

Behind the scenes I snapshot your project after every successful deployment and tag it with the platform (Render, Railway, Vercel, or Heroku). A rollback restores that snapshot, replays the right deployment steps for the recorded platform, and gets you back online with minimal fuss.

Deploy to Multiple Platforms

Want your app on Render AND Railway for redundancy?

py deploy.py run --multi
# โ†’ Select both Render and Railway
# โ†’ Everything deploys simultaneously

Each platform gets properly configured. You now have failover coverage.


Complete CLI Reference

USAGE:
  py deploy.py <command> [options]

COMMANDS:
  setup              Create/edit deployment.yaml configuration
  check              Check if your app is ready for deployment
  run                Deploy your app (use --multi for multiple platforms)
  info               Show project information
  health             Check deployed app health
  rollback           Rollback to previous deployment

OPTIONS:
  --multi            Deploy to multiple platforms
  --url URL          App URL for health check
  --endpoints PATHS  Comma-separated endpoints to check (default: /)

EXAMPLES:
  py deploy.py setup                    # Create deployment config
  py deploy.py check                    # Check readiness
  py deploy.py run                      # Deploy to one platform
  py deploy.py run --multi              # Deploy to multiple platforms
  py deploy.py info                     # Show project info
  py deploy.py health --url https://... # Check health
  py deploy.py rollback                 # Rollback deployment

Testing

I test everything thoroughly. Run the tests yourself:

# Install dev dependencies
pip install -e ".[dev]"

# Run all tests
pytest

# Run with coverage report
pytest --cov=src --cov-report=html

# Run specific test file
pytest tests/test_deployers.py -v

# Run one specific test
pytest tests/test_checkers.py::TestFlaskChecker::test_check_requirements -v

Current status: 36 tests, all passing, 57% code coverage.


Project Structure

multi-platform-deployer/
โ”‚
โ”œโ”€โ”€ src/                    # The actual package
โ”‚   โ”œโ”€โ”€ main.py            # Main Deployer class (orchestrates everything)
โ”‚   โ”œโ”€โ”€ deployers/         # Code for each platform
โ”‚   โ”‚   โ”œโ”€โ”€ render.py      # Render deployer
โ”‚   โ”‚   โ”œโ”€โ”€ railway.py     # Railway deployer
โ”‚   โ”‚   โ”œโ”€โ”€ vercel.py      # Vercel deployer
โ”‚   โ”‚   โ””โ”€โ”€ heroku.py      # Heroku deployer
โ”‚   โ”œโ”€โ”€ checkers/          # Readiness checkers
โ”‚   โ”‚   โ”œโ”€โ”€ flask_checker.py
โ”‚   โ”‚   โ”œโ”€โ”€ django_checker.py
โ”‚   โ”‚   โ””โ”€โ”€ fastapi_checker.py
โ”‚   โ”œโ”€โ”€ config/            # Config file handling
โ”‚   โ”‚   โ”œโ”€โ”€ loader.py      # Load YAML/JSON config
โ”‚   โ”‚   โ””โ”€โ”€ validator.py   # Validate config
โ”‚   โ”œโ”€โ”€ scripts/           # Helper scripts
โ”‚   โ”‚   โ”œโ”€โ”€ migrator.py    # Database migrations
โ”‚   โ”‚   โ”œโ”€โ”€ health_check.py
โ”‚   โ”‚   โ””โ”€โ”€ rollback.py
โ”‚   โ””โ”€โ”€ utils/             # Utility functions
โ”‚       โ”œโ”€โ”€ helpers.py     # Command execution, file I/O
โ”‚       โ”œโ”€โ”€ logger.py      # Logging setup
โ”‚       โ””โ”€โ”€ validators.py  # Validation functions
โ”‚
โ”œโ”€โ”€ tests/                 # Test suite
โ”‚   โ”œโ”€โ”€ test_main.py       # Tests for Deployer
โ”‚   โ”œโ”€โ”€ test_deployers.py  # Tests for each platform
โ”‚   โ”œโ”€โ”€ test_checkers.py   # Tests for readiness checks
โ”‚   โ”œโ”€โ”€ test_config.py     # Tests for config management
โ”‚   โ””โ”€โ”€ test_utils.py      # Tests for utilities
โ”‚
โ”œโ”€โ”€ examples/              # Example applications
โ”‚   โ”œโ”€โ”€ flask_app/         # Complete Flask example
โ”‚   โ”œโ”€โ”€ django_app/        # Complete Django example
โ”‚   โ””โ”€โ”€ fastapi_app/       # Complete FastAPI example
โ”‚
โ”œโ”€โ”€ deploy.py              # CLI entry point (run this!)
โ”œโ”€โ”€ cli.py                 # CLI implementation
โ”œโ”€โ”€ setup.py               # Package setup
โ”œโ”€โ”€ pyproject.toml         # Project config
โ”œโ”€โ”€ requirements.txt       # Dependencies
โ”œโ”€โ”€ README_COMPLETE.md     # This file
โ””โ”€โ”€ LICENSE                # MIT License

Troubleshooting

"ModuleNotFoundError: No module named 'yaml'"

You need to install dependencies:

pip install -e .

"Could not auto-detect framework"

The checker couldn't figure out if you're using Flask, Django, or FastAPI. Just tell it:

py deploy.py check
# โ†’ When asked, type: 1 (Flask), 2 (Django), or 3 (FastAPI)

"Deployment failed: API key not found"

Some platforms (Vercel, Heroku) need API credentials. Set them as environment variables:

# For Vercel
export VERCEL_TOKEN=your_token_here

# For Heroku  
export HEROKU_API_KEY=your_key_here

# For Render
export RENDER_API_KEY=your_key_here

"Health check failed: Connection refused"

Your app isn't responding. Check:

  1. Is the deployment actually finished? (refresh after a minute)
  2. Is your app listening on the right port?
  3. Do you have if __name__ == '__main__' in Flask apps? (remove it for production)

"Django migration failed"

Make sure:

  1. Your database is running and accessible
  2. DATABASE_URL environment variable is set correctly
  3. Your migrations are in the right folder

Contributing

Have an idea? Found a bug? Want to add AWS support? I'd love help!

Getting started:

git clone https://github.com/yourusername/multi-platform-deployer.git
cd multi-platform-deployer
pip install -e ".[dev]"

# Make your changes
pytest tests/ -v  # Make sure tests pass

# Push and create a PR!

Code style (I use Black and isort):

black src/ tests/
isort src/ tests/

Roadmap

Things I'm working toward:

  • AWS deployment (EC2, Elastic Beanstalk)
  • Google Cloud Platform
  • Azure
  • Kubernetes support
  • Automated Docker image generation
  • Cost estimation before deployment
  • Multi-region deployments
  • Advanced monitoring/alerting integration
  • Load balancer setup
  • SSL certificate automation

FAQ

Q: Can I use this with my existing production app? A: Yes! Just run py deploy.py check to see if there are any issues. If it passes, you're good to deploy.

Q: Does this support databases? A: Absolutely. I automatically handle migrations for Django and Alembic-based apps. I also detect and maintain database configurations.

Q: What if I don't want to use the CLI? A: The Python API works just fine for scripts and CI/CD pipelines. You have full control either way.

Q: Can I deploy the same app to multiple platforms? A: Yes! That's the whole point. py deploy.py run --multi will deploy simultaneously to whichever platforms you choose.

Q: Is my data safe? A: We never store your credentials or deploy to anything without your explicit permission. Everything runs on your machine or the platforms you authorize.

Q: How long do deployments take? A: Typically 30 seconds to 2 minutes depending on the platform and your app size.

Q: Can I rollback? A: Yes. py deploy.py rollback takes you back to the previous working deployment.

Q: Is this production-ready? A: Absolutely. 36 tests, all passing. We handle errors, validation, and edge cases. Real projects use it.


License

MIT License - You're free to use this however you want.


Let's Deploy Something

There's no reason deployment should be complicated. This package takes the friction out of getting your app live.

Get started right now:

git clone https://github.com/yourusername/multi-platform-deployer.git
cd multi-platform-deployer
pip install -e .
py deploy.py check

Then watch your app go live.

Good luck out there! ๐Ÿš€


Questions? Open an issue on GitHub. Want to contribute? Pull requests welcome!

Made with โค๏ธ to make deployment less awful.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multi_platform_deployer-0.1.1.tar.gz (30.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multi_platform_deployer-0.1.1-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file multi_platform_deployer-0.1.1.tar.gz.

File metadata

  • Download URL: multi_platform_deployer-0.1.1.tar.gz
  • Upload date:
  • Size: 30.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for multi_platform_deployer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b47fb14e1f3d1267f82cc0632503b77300daddf9537ca66b532524c244a2884b
MD5 4dd80d168935dde698c418905c818a67
BLAKE2b-256 cd03777119ad5b47dc9c11889bbf3d24b7632823d9211df89c6a8f7fd06df2f0

See more details on using hashes here.

File details

Details for the file multi_platform_deployer-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for multi_platform_deployer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 881bf233d6de32857358a497d79286ffdd9bd8b3eddd50033b4e3b9ff01a3525
MD5 a217af44ea7ba24100fca07ecf7c2d8d
BLAKE2b-256 900e24e4a4079536f47451ff8bea51f09973ff3b78653e82ce4f7c01c330c48b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page