J
J
joncus2021-12-12 09:54:17
Apache HTTP Server
joncus, 2021-12-12 09:54:17

How to deploy a Flask application via WSGI on Apache?

I decided to try my hand at web programming and started learning python with flask, bought hosting on jino and just don't understand how to deploy even the simplest application here. I dug up a bunch of sites - nothing happened.

For example, I have an application like this:

from flask import Flask
app = Flask(__name__)

@app.route("/")
def index():
 return "Hello world!"

if __name__ == "__main__":
 app.run()


How can I run it on hosting? Looked, simple `wsgi` works
def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    return "Hello world"

In .htaccess specified
AddHandler wsgi-script .wsgi

env deployed, installed flask via pip
Question: How can I make Flask application work on hosting?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question