0

I have a wordpress (/var/www/cb), which I wish to run as root (www.cb.com) and one Django app (/vc/cb/cb) as a subdirectory (cb.com/launch).

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
        ServerAdmin info@cb.com
        ServerName cb.com
        DocumentRoot /var/www/cb
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/cb>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride FileInfo Indexes
                Order allow,deny
                allow from all
        </Directory>

        WSGIScriptAlias /launch /vc/cb/cb/wsgi.py
        <Directory "/vc/cb/cb">
        <Files wsgi.py>
                Order deny,allow
                Allow from all
        </Files>
        </Directory>
</VirtualHost>
</IfModule>

A similar question has been asked here, however that was pre-Django-1.4, where you had to create your wsgi file manually.

In the documentation it says the wsgi.py is created automatically for you. The main difference I see is the file extension, in the link above they refer to the wsgi file as xx.wsgi while django 1.4 documentation points to wsgi.py. I don't know if this is an issue, but I get a 404 when I do a https://cb.com/launch

The content of wsgi.py:

import os
import sys

sys.path.append('/vc/cb')
sys.path.append('/vc/cb/cb')

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cb.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

What am I missing?

Community
  • 1
  • 1
Houman
  • 64,245
  • 87
  • 278
  • 460
  • The file name could be anything as long as the names match. This should not be the problem. I suspect an issue with Apache config. But my knowledge is limited here... – bcelary Aug 07 '12 at 10:28
  • Ah, and one more thing -- is the script set as executable? I think it should be. Just a thought... – bcelary Aug 07 '12 at 10:32
  • mhhh, you think i should do a `chmod +x wsgi.py` ? Not sure if this is the issue. I have also a mercurial on my server, and the script is set as: `-rw-r--r-- 1 root root 685 Aug 5 22:48 hgweb.wsgi` – Houman Aug 07 '12 at 10:34
  • worth a try :) nothing else comes to mind... ah and BTW, maybe try searching serverfault.com. – bcelary Aug 07 '12 at 10:40
  • 2
    It does not need to be executable. – Graham Dumpleton Aug 07 '12 at 11:16
  • 2
    Add a syntax error to the file. That is 'XXX' on a line by itself and restart Apache to see if the file is even being read in. – Graham Dumpleton Aug 07 '12 at 11:18
  • Graham, it was a good tip with creating an error on purpose. What I realized is, it seems wordpress is stealing the 404 error. I have forgotten to add Alias for the Media and Static files in my config. I think thats what is causing the 404 errors thrown by Django but captured by wordpress. Would it be better having a subdomain instead of a subdirectory, so that django app gets the root? You know what I mean? Maybe then django's 404 errors wont be captured by wordpress any longer.. – Houman Aug 07 '12 at 12:19
  • You appear to be already using a separate virtual host domain so not sure why you aren't already mounting it at '/'. – Graham Dumpleton Aug 08 '12 at 01:50
  • no, it is actually the same domain cb.com. The subdirectory doesn't come clean. I figured out a subdomain works really well here, because there I can bind to root. Will post the answer soon how I solved it. – Houman Aug 08 '12 at 09:40

0 Answers0