Flask with WSGI cannot fetch data in certain portions of application

In one part of my application, I am fetching and transferring an object which is supposed to be looped into on the main page.

so this is the code

the route:

@mod_site.route("/test/new", methods = ["GET", "POST"])
def createTest():
    if session.get("user") == True and session['type'] == "admin" :
        from app.models.Batch import Batch
        batches = Batch.query.all()
        if request.method == "POST" :
            return "adding test"
        return render_template("admin/test/create_test.html", batches = batches)

and this is the html form I created where I want to iterate through the object "Batch":

<form action="" method="post">
    <input type="text" name="name" placeholder="name" /><br><br>
    <input type="text" name="date" id="datepicker" placeholder="date" /><br><br>
    <label for="batch">Select Batch: &nbsp;</label>
    <select name="batch" id="batch">
        {% for batch in batches %}
        <option value="{{batch.id}}">{{batch.name}}</option>
        {% endfor %}
    <h4>Select Students:</h4>
    <div id="loadStudents"></div>
    <input type="text" name="type" placeholder="type of test" /><br><br>

    <button>Confirm test</button>

Now, This code works properly on my local machine while running on native flask env. But there is some problem with it while running with apache and mod_WSGI. I also checked the error log of apache2, and this is the error I found a lot:

[Tue Apr 17 01:39:41.693338 2018] [wsgi:error] [pid 3301] [client] mod_wsgi (pid=3301): Request data read error when proxying data to daemon process: Partial results are valid but processing is incomplete.

I cannot understand why this is happening, as other parts of website are working great with the db except for this.

1 answer

  • answered 2018-04-17 06:00 Graham Dumpleton

    That error message would occur where the HTTP client dropped the connection while still sending through the request content. How big is the request content? Are you dealing with unreliable client connections, such as over mobile data networks?