Flask Applications

#1
Can someone tell me how to get a Flask application up and running under LiteSpeed?

How would I route all incoming requests to: http://www.mydomain.com/api to the Python Flask app that looks something like this?
Code:
def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World!'
    response_headers = [('Content-type', 'text/plain'),  ('Content-Length', str(len(output)))]
    start_response(status, response_headers)
    return [output]
Thanks in advance.
 
Last edited by a moderator:

Pong

Administrator
Staff member
#4
We don't have a particular wiki on how to configure flask application since you can easily refer to flask forum or flask web site, however Litespeed does provide Python support and we do provide wiki on how to install/configure Python program in general. such as links provide by NiteWave as well as the following if LSWS native mode.
https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:other-ext-apps:python-lsapi
please let us know if you have any questions when you follow along with the wiki.
 
#5
All of the walkthroughs I have seen expect the the incoming HTTP request to be for a specific .wsgi file like the following:
http://IP-ADDRESS:8088/hello.wsgi

However, my needs are for a REST API. So incoming requests will be something like:
http://IP-ADDRESS:8088/api/things

What I want is for all requests to http://IP-ADDRESS:8088/api to be handed off to a specific python file/function which will handle all WSGI requests.

I'm not sure these examples satisfy my needs. Either that or I am not fully understanding it all.

Thanks.
 
Last edited by a moderator:
Top