Before I used mod_python for python websites. Unfortunately mod_python is not up to date any more so I looked for another framework and found mod_wsgi.
In mod_python it was possible to have an index method and also other methods. I would like to have more than one page that will be called. Something like this:
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]
def test(environ, start_response):
status = '200 OK'
output = 'Hello test!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
Is that possible with mod_wsgi?
SOLUTION: The Flask framework does what I need
#!/usr/bin/python
from flask import Flask
from flask import request
app = Flask(__name__)
app.debug = True
@app.route("/")
def index():
return "Hello index"
@app.route("/about")#, methods=['POST', 'GET'])
def about():
content = "Hello about!!"
return content
if __name__ == "__main__":
app.run()