Reputation: 311
I'm trying to set up my first Python web application through Flask. I've used the setup module on my hosting service, and I've hit a problem. When I try to run the app, I get an error page from Phusion Passenger. In the searching I've done so far, similar problems seem to come from Passenger's inability to locate the needed software. But I haven't done this before, so I may well be misunderstanding the problem. All help much appreciated.
Here are the contents of passenger_wsgi.py:
import imp
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
wsgi = imp.load_source('wsgi', 'flaskblog.py')
application = wsgi.application
And here is what the site admin pulled from the error log:
[ E 2020-05-25 15:09:08.9018 32404/T1q age/Cor/App/Implementation.cpp:221 ]:
Could not spawn process for application /home/eriksimp/public_html/flaskblog: The application process exited prematurely.
App 28117 output: File "/home/eriksimp/virtualenv/public_html/flaskblog/3.7/lib64/python3.7/imp.py", line 171, in load_source
App 28117 output: File "/home/eriksimp/public_html/flaskblog/passenger_wsgi.py", line 8, in <module>
App 28117 output: File "/home/eriksimp/virtualenv/public_html/flaskblog/3.7/lib64/python3.7/imp.py", line 171, in load_source
Upvotes: 0
Views: 819
Reputation: 311
The problem was that I hadn't activated the environment. (I was following instructions that didn't include that step.) I created the app using cPanel, and at the end of the process, cPanel provided a Terminal command (at the top of the page) to activate the app. I entered Terminal through cPanel, ran that command, then ran "pip install flask."
Then I restarted the application and reloaded the page. Now it works!
Upvotes: 1