I am trying to set up apache with an existing django project using the tutorial in django site here. My os is Ubuntu, and everything is installed (django apache2 libapache2-mod-wsgi)
My conf file
WSGIPythonPath /home/avlahop/development/django/rhombus2/rhombus/
<VirtualHost *:80>
ServerName myrhobmus.com
ServerAlias www.myrhombus.com
WSGIScriptAlias / /home/avlahop/development/django/rhombus2/rhombus/rhombus/wsgi.py
</VirtualHost>
After I created the conf file I ran the a2ensite Ubuntu command for enabling the site.
Putting WSGIPythonPath inside VirtualHost gives me an apache configtest failure
Files inside directive inside directory (as described in the example) gives me the same failure
If I go to www.myrhombus.com I get a Google chrome could not find the specified address message.
What am I doing wrong? Every tutorial on the Internet is using the old file.wsgi while now Django creates this for you but it is a python file with .py extension. How can I serve my django with apache? And If I wanted to go production at my own server where would you put django code and where would you put template files?
EDIT: I am only getting the Index of / page. Is there something I have to do with mysites location in terms of permissions? Could you give me a working example of an django site apache conf file?
I use Django 1.8 and I successfully deployed my project Apache server. I followed basic concept like you and enable Apache this module early.
enable module
You can my project structure this question.Refer this question to understand project structure
--------------this is my virtual host file----------------------------------
WSGIPythonPath /home/umayanga/Desktop/view_site/serialKey_gen_site:/home/umayanga/Desktop/view_site/serialKey_gen_site/myvenv/lib/python3.4/site$
<VirtualHost *:80>
ServerAdmin admin@key.com
ServerName key.com
ServerAlias www.key.com
Alias /templates/ /home/umayanga/Desktop/view_site/serialKey_gen_site/templates/
Alias /static/ /home/umayanga/Desktop/view_site/serialKey_gen_site/static/
<Directory "/home/umayanga/Desktop/view_site/serialKey_gen_site/static">
Require all granted
</Directory>
<Directory "/home/umayanga/Desktop/view_site/serialKey_gen_site/templates">
Require all granted
</Directory>
WSGIScriptAlias / /home/umayanga/Desktop/view_site/serialKey_gen_site/mysite/wsgi.py
<Directory "/home/umayanga/Desktop/view_site/serialKey_gen_site/mysite">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
-----------------wsgi.py---------------------------------------
"""
WSGI config for mysite 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
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
application = get_wsgi_application()
I think this will be help to you.