Using Python Flask-restful with mod-wsgi
<p>I am trying to use mod-wsgi with Apache 2.2</p>

<p>I have the following directory structure:</p>

<pre><code>scheduling-algos
-lib
-common
 -config
  -config.json
resources
-Optimization.py
optimization.wsgi
optimization_app.py
</code></pre>

<p>My <code>optimization_app.py</code> is the following:</p>

<pre><code>from flask import Flask
from flask_restful import Api
from resources.Optimization import OptimizationAlgo

def optimizeInstances():
    optimization_app = Flask(__name__)
    api = Api(optimization_app)
    api.add_resource(OptimizationAlgo, '/instances')

if __name__ == '__main__':
    optimizeInstances()
    optimization_app.run(host='0.0.0.0', debug=True)
</code></pre>

<p>My <code>Optimization.py</code> code looks like the following:</p>

<pre><code>class OptimizationAlgo(Resource):
    def post(self):
       return "success"
</code></pre>

<p>When I make a <code>POST</code> request to the url <code>http://&lt;host&gt;:5000/instances</code>, it works just as expected. I want make this work using <code>WSGI</code>. I have <code>mod-wsgi</code> installed with Apache 2.2.</p>

<p>My <code>optimization.wsgi</code> file looks like the following</p>

<pre><code>import sys
sys.path.insert(0, '&lt;path to app&gt;')

from optimization_app import optimizeInstances as application
</code></pre>

<p>I get the following error: <code>TypeError: optimizeInstances() takes no arguments (2 given)</code> . Apparently this is not the correct way to use WSGI. What is the correct way to use WSGI?
Apparently, this is not the correct way to use <code>WSGI</code>. </p>