1

I've got some problems with deploying Django application on Apache HTTP server with mod_wsgi. I've added information to httpd.conf (WSGIScriptAlias) which indicate file wsgi.py with test content:

def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World!'

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

and when I run it everything seems to be OK, bacause I can see 'Hello world!'. But when I change file wsgi.py to this:

import os
import sys

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

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

I've got:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

wsgi.py file is in the same directory as settings.py file... (and all my app is in the subdirectory: mydomain/public_html/hc/hc/hc/settings.py - hc is the name of my app)

What can be wrong? What should I do, to make my app work? how to find out which thing causes error?

5
  • 1
    Plus you should post the error from the Apache log (probably /var/httpd/error.log). Commented Jan 6, 2013 at 11:59
  • Definitely an Apache config issue. It may be a permissions problem. Also, take a look at this similar issue. Commented Jan 6, 2013 at 12:05
  • post your apache configuration file Commented Jan 6, 2013 at 14:16
  • anyone from my previous topic didn't help me, so i can't match anything Commented Jan 6, 2013 at 16:28
  • i've got no permission to access apache configuration file - i've got django hosting and i can only add alias to httpd.conf (which is added by admin) - so configuration of apache is probably good, any other ideas? Commented Jan 6, 2013 at 16:33

2 Answers 2

1
sys.path.append('path_to_python_dir')
sys.path.append('path_to_project')

add these lines to your wsgi.py file .

Issues in settings.py also causes 500 error.

Sign up to request clarification or add additional context in comments.

Comments

0

i've solve my problem on my own added this help me (after imports):

sys.path.append('path_to_project')
sys.path.append('path_to_wsgi_py_file')

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.