Python Flask App fails on POST requests with passenger on cpanel

Miyadipity

Registered
Jun 7, 2020
2
0
0
France
cPanel Access Level
Website Owner
Hello everyone,

I have been trying for the last 3 days to import my flask app for production on cpanel hosted by Planet Hoster. For my understanding, it runs with passenger and apache. I have succeed at configuring a passenger_wsgi.py file and my app can be seen in the browser.

However, as soon as I try to pass data with POST or GET method it looks like it fails with an error:

Internal Server Error:
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.


I can go through some pages with some buttons that do not pass POST or GET methods and it works fine.

You can see my problem at :
[Third-Party URL removed per Forums guidelines]

All the POST and GET methods work on local flask run.

Do you have any insights on what might going on? Also, if you have used Flask, is it enough to pass by passenger_wsgi to turn it into production or should I add something ?

Thank you very much for your help.
 
Last edited by a moderator:

Miyadipity

Registered
Jun 7, 2020
2
0
0
France
cPanel Access Level
Website Owner
Edit: my POST method for sending mail is working !!! I made a mistake while creating my blueprints and didn't update some imports :

from flask_mail import Message, Mail
from appFlask.__init__ import mysql, mail


However, it still doesn't work for other POST method, I suspect a problem with my SQL connection. One question remaining: is it enough for turning Flask into production ?
 

cPSamuelM

Technical Analyst Team Lead
Staff member
Nov 20, 2019
182
31
103
USA
cPanel Access Level
Root Administrator
Hello @Miyadipity

You'll need to make sure the instructions outlined on the following page were followed closely:

https://docs.cpanel.net/knowledge-base/web-services/how-to-install-a-python-wsgi-application/

For any error messages you might still be receiving with your application, you might want to consider enabling debug mode. The following post explains how to do that:

https://stackoverflow.com/a/10219621

As for your question about turning Flask into production, I'm not sure I understand that. Can you rephrase the question please?

Best regards