DockHosting Docs
Deploying

Python

Deploy Django, FastAPI, or Flask apps on DockHosting.

DockHosting detects a Python project from a requirements.txt or pyproject.toml at the repository root, installs dependencies, and starts your app.

Requirements

  • requirements.txt (pip) or pyproject.toml (Poetry / PEP 621) listing your dependencies
  • A way to start your app that DockHosting can run — for Django, manage.py runserver isn't production-grade, so use gunicorn or uvicorn explicitly (see below)
  • Your app bound to 0.0.0.0 and the PORT environment variable, not a hard-coded port or 127.0.0.1

Django

Run with Gunicorn rather than the development server:

gunicorn myproject.wsgi:application --bind 0.0.0.0:$PORT

Add gunicorn to requirements.txt. Run python manage.py migrate against your attached database before or during your first deploy — either from a one-off shell or as part of your start command.

FastAPI

Run with Uvicorn:

uvicorn main:app --host 0.0.0.0 --port $PORT

For production, --workers with Gunicorn managing multiple Uvicorn workers scales better under real load than a single Uvicorn process.

Flask

gunicorn app:app --bind 0.0.0.0:$PORT

Flask's own built-in server (app.run()) is not meant for production traffic — use Gunicorn the same way as Django.

Databases

psycopg2 / psycopg (Postgres), mysqlclient or PyMySQL (MySQL/MariaDB), pymongo (MongoDB), and redis-py all accept the connection string DockHosting injects when you attach a database directly, or via your ORM's DATABASE_URL-style config (Django's dj-database-url, SQLAlchemy's create_engine(url)).

Environment variables

Read with os.environ["VARIABLE_NAME"] or os.getenv("VARIABLE_NAME"). Set them in your project's settings — see Environment variables.

On this page