yetty
yetty

Reputation: 2466

Django: only blank page

I have a server with Apache and I would like to start website written in Django. I user mod_wsgi. Now I have it prepared. But the respond of a server is empty. And in error log, there is nothing. Do you know what is the reason why?

If some file could help (*.wsgi, settings.py) I will append it.

Prochazky.wsgi

import os
import sys
import site

os.environ['PYTHON_EGG_CACHE'] = '/home/prochazky/venv/.python-eggs'

site.addsitedir('/home/prochazky/venv/lib/python2.6/site-packages')

os.environ['DJANGO_SETTINGS_MODULE'] = 'Prochazky.settings'

sys.path.append('/home/prochazky/')
sys.path.append('/home/prochazky/Prochazky/')

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Apache vhost:

<VirtualHost *:80>
    WSGIScriptAlias / /home/prochazky/Prochazky/Prochazky.wsgi
    ServerName testing.prochazky.net
    DocumentRoot /home/prochazky

    ErrorLog /home/prochazky/wsgi.log
</VirtualHost>

Upvotes: 3

Views: 3060

Answers (3)

James Khoury
James Khoury

Reputation: 22319

This is from my setup (names altered to protect the innocent guilty).

<VirtualHost *:80>
        ServerName site.domain.com 
        ServerAdmin [email protected] 

        WSGIScriptAlias / /home/user/site/django.wsgi

        <Directory /home/user/site/>
                Options FollowSymLinks
                AllowOverride None 
                Order allow,deny
                allow from all
        </Directory>
         ... etc etc etc.

I think you need the <directory> to allow the server to access the .wsgi.
I'm really not an apache guru though so don't take this example as perfect. (I think all that is needed is the order Allow, deny and allow from all)

a good site to check out: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

Upvotes: 0

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

Trying getting a hello world program working first and not Django. Watch:

http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations

and read:

http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide

At a guess though, are you perhaps loading mod_python into the same Apache. An incompatible mod_python will cause exactly that symptom with merely a segmentation fault message in main Apache error log.


UPDATE 1

Are you loading mod_php into same Apache? It can sometimes have conflicting shared library requirements and will cause a crash. If you are also loading it, disable it from Apache configuration.

Also try setting:

WSGIApplicationGroup %{GLOBAL}

This will force use of main interpreter which will avoid problems with third party extensions that aren't written properly to work in sub interpreters.

You really though need to look more closely at the main Apache error log, not the virtual host one. Run a 'tail -f' on it when you make a request and check for sure you are seeing messages there, specifically a segmentation fault or similar message. Such a message about process crashing and causing empty page will not show in virtual host error log.

Upvotes: 7

fahhem
fahhem

Reputation: 466

Is it possible the template file your root url/view is empty or evaluates to empty?

For instance, if you have a template like so:

{% extends "base.html" %}
{% block content %}blah blah{% endblock %}

and base.html doesn't use a block "content", then the content block from your template won't be used and your template will evaluate to empty despite having content.

Upvotes: 1

Related Questions