How to Deploy and Host Python (Flask) Web Applications on TechTorio | TechTorio – Techtorio
Services Domains Features How it Works Pricing Articles
Background Remover DNS & Email Checker Email Readiness Scanner Blacklist Checker Security Headers Auditor Robots & Sitemap Validator Product Poster Creator Business Card Maker Page Speed Insights Metadata Checker
Get Started Free

How to Deploy and Host Python (Flask) Web Applications on TechTorio

A comprehensive step-by-step guide to deploying and hosting isolated Python Flask web applications on TechTorio. Learn about production Gunicorn WSGI configuration, resource limits, manual ZIP deployment, automated GitHub Actions CI/CD webhooks, and real-time container log monitoring.

Modern web development often requires more than static frontends. Whether you are building dynamic REST APIs, web scrapers, database-driven microservices, or machine learning interfaces, Python and Flask offer one of the most productive and lightweight ecosystems available.

TechTorio now provides native Python (Flask) container hosting. Every deployed application runs in an isolated Docker container with dedicated memory and CPU boundaries, pre-configured with a production-ready Gunicorn WSGI server and seamless reverse proxy routing directly to your custom domain.

In this guide, you will learn how to structure your Flask project, configure your deployment settings, deploy manually via the dashboard or automatically via GitHub Actions, and monitor live application logs.

---

1. Plan Requirements & Resource Allocations

Python web application hosting requires an active Business or Enterprise subscription plan. Dedicated compute and memory are allocated according to your tier:

  • Starter Plan: Standard no-code visual website builder.
  • Business Plan: 512 MB RAM, 1.0 CPU Core, and up to 500 MB storage quota.
  • Enterprise Plan: 2,048 MB (2 GB) RAM, 2.0 CPU Cores, and up to 5,000 MB (5 GB) storage quota.
---

2. Required Project Structure

TechTorio automatically compiles your source code into an optimized Linux container. For the automated build pipeline to succeed, your project must include two essential components in the root directory:

  1. requirements.txt: Lists all Python packages and libraries required by your application.
  2. Entry Point Python File: A Python module (typically app.py) that defines your Flask WSGI instance (e.g., app = Flask(__name__)).

Note: You do not need to install Gunicorn manually in your requirements. Gunicorn is automatically baked into the TechTorio Python runtime environment.

Example Project Directory

my-flask-app/
├── app.py              # Main entry point
├── requirements.txt    # Project dependencies
├── templates/          # HTML templates (optional)
│   └── index.html
├── static/             # CSS / JS / Images (optional)
│   └── style.css
└── utils/              # Helper modules (optional)
    └── helpers.py

Sample app.py

from flask import Flask, jsonify, render_template

app = Flask(__name__)

@app.route("/")
def index():
    return "<h1>Welcome to My TechTorio Flask Application!</h1><p>Serving live from an isolated container.</p>"

@app.route("/api/health")
def health():
    return jsonify({
        "status": "healthy",
        "platform": "TechTorio Cloud",
        "runtime": "Python 3.12"
    })

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000)

Sample requirements.txt

Flask==3.0.3
requests==2.32.3
---

3. Deployment Method A: Manual ZIP Upload (Dashboard)

If you prefer deploying directly from your local computer, you can package your project and upload it via the TechTorio Admin Panel.

Step 1: Create a ZIP Archive

When compressing your project, make sure to exclude virtual environments (venv/), git directories (.git/), and cache folders (__pycache__/):

  • Windows (PowerShell):
    Compress-Archive -Path app.py, requirements.txt, templates, static -DestinationPath app.zip
  • macOS & Linux (Terminal):
    zip -r app.zip . -x "*.git*" "venv/*" "__pycache__/*"

Step 2: Deploy via Dashboard

  1. Log in to your TechTorio Admin Panel.
  2. From the left navigation bar under WEBSITE, click on Hosting & Deploy (/hosting).
  3. Click on the Python App (Flask/Gunicorn) tab.
  4. Configure your parameters:
    • Entry Point: In module:variable format. Defaults to app:app (meaning app.py with app = Flask(...)). If your file is main.py, enter main:app.
    • Runtime Version: Choose Python 3.12 (Recommended), 3.11, 3.10, or 3.13.
    • Custom Start Command: Leave blank to use the high-performance default: gunicorn app:app --bind 0.0.0.0:5000 --workers 2 --timeout 60.
  5. Upload your app.zip file and click Build & Run Python App.

The system will extract your code, verify dependencies, build the container image, and start your application within 20 to 45 seconds.

---

4. Deployment Method B: Automated CI/CD (GitHub Actions)

You can set up continuous deployment so that every time you run git push, your application automatically updates on TechTorio.

  1. On the Hosting & Deploy page, copy your Deploy Webhook Secret Endpoint URL.
  2. In your GitHub repository, navigate to Settings > Secrets and variables > Actions and create a secret named TECHTORIO_DEPLOY_TOKEN with your webhook token.
  3. Create a file named .github/workflows/deploy.yml in your repository with the following workflow:
name: Deploy Flask App to TechTorio
on:
  push:
    branches: [ main ]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      - name: Create Zip Archive
        run: |
          zip -r app.zip . -x "*.git*" "venv/*" "__pycache__/*" ".github/*"

      - name: Deploy to TechTorio
        run: |
          curl -X POST "https://admin.techtorio.com/api/deploy/webhook/${{ secrets.TECHTORIO_DEPLOY_TOKEN }}?type=python" \
            -F "build=@app.zip"
---

5. Monitoring & Managing Your Application

Once deployed, your live application can be managed directly from the dashboard:

  • Real-Time Container Logs: Click View Container Logs to stream terminal output, incoming request logs, and Python stack traces.
  • Build Diagnostics: If a package in requirements.txt fails to compile, an expandable log details the exact pip error.
  • Stop Container: Safely halt container execution without losing your code.
  • Revert to Platform Template: Instantly switch your site back to your visual website builder layout while keeping your Python app stored.
  • Purge & Delete: Completely wipe container images and uploaded source code.
---

6. Production Best Practices

  1. Stateless Container Design: Container filesystems are refreshed upon redeployment. For user-uploaded media or PDFs, store files in external cloud storage (such as Amazon S3, Cloudflare R2, or Supabase Storage).
  2. Database Connections: Connect your Flask application to cloud-hosted databases (PostgreSQL on Neon or Supabase, MySQL, or MongoDB Atlas) using connection strings.
  3. Worker Timeouts: Gunicorn workers have a default request timeout of 60 seconds. Long-running AI generation or heavy report generation should be handled asynchronously or streamed.
---

7. Troubleshooting Common Issues

  • 502 Bad Gateway / Application Unavailable: The Python process crashed on startup. Open View Container Logs to check for missing environment variables or syntax errors.
  • Missing requirements.txt: Ensure requirements.txt is in the root directory of your zip file, not nested inside an additional folder.
  • Entry Point Not Found: If your main file is named main.py, set the Entry Point field in the dashboard to main:app instead of app:app.
Back to Articles