I get this in my error logs:
ImportError: no module named flask
It looks like Django + mod_wsgi + apache: ImportError in / No module named djproj.urls , but I tried this solution and it doesnโt seem to work ... I correctly insert the home folder and the parent folder of the application in the system path, but this an error still occurs.
Going to my page still causes 500 pages.
Additional Information: I am using Amazon EC2 free tier, with Apache as httpd. Everything is installed correctly, I'm sure ...
Here are my things (badassery application name and hatemail application home folder name - I will change my mind a lot):
Error log
[Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] mod_wsgi (pid=28143): Target WSGI script '/home/ec2-user/hatemail/badassery.wsgi' cannot be loaded as Python module. [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] mod_wsgi (pid=28143): Exception occurred processing WSGI script '/home/ec2-user/hatemail/badassery.wsgi'. [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] Traceback (most recent call last): [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] File "/home/ec2-user/hatemail/badassery.wsgi", line 6, in <module> [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] from badassery import app as application [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] File "/home/ec2-user/hatemail/badassery.py", line 6, in <module> [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] from flask import Flask, request, session, url_for, redirect, render_template, abort, g, flash, _app_ctx_stack [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] ImportError: No module named flask [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] mod_wsgi (pid=28143): Target WSGI script '/home/ec2-user/hatemail/badassery.wsgi' cannot be loaded as Python module. [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] mod_wsgi (pid=28143): Exception occurred processing WSGI script '/home/ec2-user/hatemail/badassery.wsgi'. [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] Traceback (most recent call last): [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] File "/home/ec2-user/hatemail/badassery.wsgi", line 6, in <module> [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] from badassery import app as application [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] File "/home/ec2-user/hatemail/badassery.py", line 6, in <module> [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] from flask import Flask, request, session, url_for, redirect, render_template, abort, g, flash, _app_ctx_stack [Sun Nov 11 07:14:45 2012] [error] [client 18.189.71.148] ImportError: No module named flask
badassery.wsgi
import sys sys.path.insert(0,'/home/ec2-user/hatemail') sys.path.insert(1,'/home/ec2-user') from badassery import app as application
Additions to the httpd.conf file
WSGISocketPrefix /var/run/wsgi <VirtualHost *:80> ServerName 54.243.61.41 DocumentRoot "/home/ec2-user/hatemail" WSGIDaemonProcess badassery user=apache group=apache processes=1 threads=5 WSGIScriptAlias / /home/ec2-user/hatemail/badassery.wsgi WSGIScriptReloading On <Directory /home/ec2-user/hatemail> WSGIProcessGroup badassery WSGIApplicationGroup %{GLOBAL} Order deny,allow Allow from all </Directory> </VirtualHost>
Directory structure
~ hatemail badassery.py badassery.wsgi Procfile README requirements.txt schema.sql static/ templates/ venv/bin/activate
Yes, I do "if name == 'main': app.run ()".
How can I fix this problem?