Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

427
Vistas
How can I fix FastAPI application error on Apache WSGI?

I am trying to run FastAPI application on Apache running server.

I have configured Apache virtual host file accordingly
<VirtualHost *:80>
        ServerAdmin admin@example.com
        ServerName fastapi.example.com
        ServerAlias fastapi.example.com
        DocumentRoot /var/www/fastapi
        ErrorLog ${APACHE_LOG_DIR}/fastapi_error.log
        CustomLog ${APACHE_LOG_DIR}/fastapi_access.log combined
        WSGIScriptAlias / /var/www/fastapi/main.wsgi
        <Directory "/var/www/fastapi">
                AllowOverride All
        </Directory>
</VirtualHost>

and created main.wsgi and main.py files.

main.wsgi

#! /usr/bin/python3.7

import logging
import sys
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0, '/var/www/fastapi/')
from main import app as application
application.secret_key = 'alibaba'

main.py

from typing import Optional
from fastapi import FastAPI
app = FastAPI()

@app.get("/")
def read_root():
    return {"Hello": "World"}

@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
    return {"item_id": item_id, "q": q}

When i am trying to access the web, I got the 500 Internal server Error with the following log in fastapi_access.log

mod_wsgi (pid=24946): Exception occurred processing WSGI script '/var/www/fastapi/main.wsgi'.
TypeError: __call__() missing 1 required positional argument: 'send'

Could you please advice, how can I fix this problem and what am I doing wrong?

Thanks in advance.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

WSGI servers is not compatible with FastAPI, FastAPI only runs in ASGI server, gunicorn and all the other WSGI servers just implements PEP Standards with ASGI workers in depth they still work as ASGI with the workers.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda