I am learning django, and I am trying to deploy my first basic django under apache.
What I have done so far: under root:
installed python3.4
pip3.4 install virtualenvwrapper
under user "Cheng":
added to .bashrc:
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.4
source /usr/local/bin/virtualenvwrapper.sh
mkvirtulenv ifthq
under root
pip3.4 install django
under "(ifthq)cheng"
navigate to /var/www
django-admin.py startproject ifthq
cd ifthq
python manage.py runserver <--works no problem
Then the fun part, attaching the project to apache:
Under root, I set ifthq.conf in the conf.d directory of /etc/httpd/. inside ifthq.conf is:
WSGIPythonPath /var/www/ifthq:/home/cheng/.virtualenvs/ifthq/lib/python3.4/site-packages/
<VirtualHost *:80>
ServerName www.ifthq.com
ServerAlias ifthq.com
ServerAdmin cheng@trekfederation.com
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
# Alias /robots.txt /www/STORE/coffestatic/robots.txt
# Alias /favicon.ico /www/STORE/coffeestatic/favicon.ico
Alias /static/ /var/www/ifthq/static/
<Directory /var/www/ifthq/>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias / /var/www/ifthq/ifthq/wsgi.py
ErrorLog /var/log/httpd/error.log
LogLevel warn
CustomLog /var/log/httpd/access.log combined
</VirtualHost>
when I fire up apache, I get the notorious 500 (Internal Server Error). Upon further review, I get this response from error.log:
[Sun Oct 18 18:34:55.944407 2015] [:error] [pid 19250] [client 144.76.29.66:56465] ImportError: No module named django.core.wsgi
As you can see, I'm trying to get apache to serve the page. The wgsi.py location is correct. The site-packages location is correct. I feel like I'm missing something silly here. in root outside virtualenv, I did a pip3.4 install django
to no avail.
What else am I missing? Thanks
UPDATE 1 here is my wsgi.py updated, still no go:
"""
WSGI config for ifthq project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os, sys
# add the hellodjango project path into the sys.path
sys.path.append('/var/www/ifthq')
# add the virtualenv site-packages path to the sys.path
sys.path.append('/home/cheng/.virtualenvs/ifthq/lib/python3.4/site-packages')
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ifthq.settings")
application = get_wsgi_application()