Skip to main content
Python is a versatile, high-level programming language widely used for building web applications and backend services. Its simplicity, readability, and extensive ecosystem of libraries and frameworks make it ideal for app hosting. Popular web frameworks, such asĀ Django,Ā Flask, andĀ FastAPI,Ā provide tools for routing, templating, database management, and API development, enabling developers to build scalable applications efficiently. Python also supports integrations with task queues, caching systems, and cloud services, making it well-suited for deploying modern web apps on Sevalla.

Framework guides

Best practices

Use a hosted database

In most cases, SQLite databases are not suitable for production. Instead, you can use a hosted database on Sevalla for your app. Create a database in Sevalla and select either Postgres, MySQL, or MariaDB. You can also add an internal connection from the application to the database to add the required environment variables.

Migrations

Migrations must run after your image has been built but before the container is started. We recommend creating a job to run the migrate command before deployment.

Background tasks

We recommend using Celery and Redis for your background tasks. However, you can use other task queues, such as Huey and RQ.

Caching

Use Redis caching to help reduce database load, lower latency, and improve scalability for web applications. Within Sevalla, you can create and connect a Redis database to your Python app. We also recommend using Sevalla’s CDN and edge caching to maximize performance.

Health checks

To support zero-downtime deployments, we recommend configuring a health check endpoint in your Python application. This allows Sevalla to verify that your app is running correctly before routing traffic to it. There are multiple ways to implement health checks in Python, depending on the level of control and visibility required.