I believe it's kinda old thread, but please post a solution directly here.
Appreciated!
How to auto-restart cPanel Python app upon code changes?
Collapse
X
-
All,
I was facing same issues too, trying to achieve this, but i solved it using a script. So, you can bring my attention if still needed so i can help out.
Best regards,
EDFolmiLeave a comment:
-
Hello Chris,
Unless you have root access, you will not be able to use this solution because PassengerPoolIdleTime can ONLY be added to server config, it cant go inside .htaccess.Leave a comment:
-
Hi Sergey,
Can you please tell me exactly what to put inside the .htaccess file and where this file should be located?
I tried appending Kates code block to the .htaccess file located inside my Application URL folder that cPanel generated (ie, the PassengerBaseURI directory). But now I receive an Error 500 Internal Server Error.
ThanksLeave a comment:
-
Hello Chris,
In this case, PassengerMinInstances can protect in .htaccess and it should work. Unfortunately, the second option is only available in server config
Thank you for contacting us.Leave a comment:
-
Hello Kate,
Unfortunately I am not allowed to modify the Passenger configuration because I am on a shared server.Leave a comment:
-
Hello Chris,
Thank you for your question. There is no ready solution that would allow you to achieve what you want out of the box. I am not aware of any way you could make Passenger reload its workers when a code change is detected. It would involve one more component that would have been doing the actual detection.
However, there is a way to make Passenger reload workers much faster based on its configuration:
Code:<IfModule mod_passenger.c> PassengerMinInstances 0 PassengerPoolIdleTime 10 </IfModule>
Leave a comment:
-
How to auto-restart cPanel Python app upon code changes?
Hello,
I have installed a Python application using cPanels "Setup Python App" feature on a CloudLinux server.
Id like to have the app automatically reload whenever I make changes to the .py files in the application root folder. Of course, clicking the RESTART button always updates the .py files, but it would be better if I could skip this step and have it done automatically.
It seems that the app may in fact restart automatically on its own after some time period... maybe every hour? I say this because sometimes the .py files are reloaded even though I never restarted the application.
I have tried various solutions with no success.
For instance, I have added three new variables to the "Environment variables" section of the Python application editor:
Name: FLASK_APP Value: app.py
Name: FLASK_DEBUG Value: true
Name: FLASK_ENV Value: development
But, they have no effect. I also tried adding these environmental variables into the bin/activate file (eg: export FLASK_ENV="development" ) .
I did a search and only found this:
https://How to restart Passenger WSG... command line?
Is what I want to accomplish possible?Tags: None
Leave a comment: