How to Use fastapi with OLS

#1
There is a very helpful guide on setting the OLS server for Flask and for Django, but I have not been able to find any similar guide for the fastapi. I followed the instructions on https://fastapi.tiangolo.com/, but I got:

[ERROR] [UID:65534][149926] wsgiHandler getApp [application] failed, pApp=(nil).
AttributeError: module 'wsgi' has no attribute 'application'

I followed the instructions at https://openlitespeed.org/kb/python-wsgi-applications/ for setting up the server for using a venv, and that worked.

Any help setting up fastapi on the OLS server would be appreciated.
 
#3
Thanks for the answer, I'll give that a try. One reason for using fastapi is that it is supposed to be faster than using Flask. Would it be worth it to use Gunicorn + reverse proxy on OLS as you describe? Would fastapi still be faster than using Flask on the OLS server? Would this take a lot of server resources?
 

Cold-Egg

Administrator
#4
For OLS as a reverse proxy, it won't take many resources, but I am not sure about the performance between Flask and fastapi+gunicorn, so no comment on it.
 
Top