Jump to content

Recommended Posts

Posted

Hello!

I host django project on heliohost (server Johny) and get strange behavior of .htaccess

 

.htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^(static/.*)$ - [L]
RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(admin_media/.*)$ - [L]
RewriteRule ^(dispatch\.wsgi/.*)$ - [L]
RewriteRule ^(.*)$ lkd_site/dispatch.wsgi/$1 [QSA,PT,L]

 

thith this config I had 500 Internal server error (and no error message in logs)

If I change last line to

RewriteRule ^(.*)$ lkd_site/dispatch.wsgi [QSA,PT,L]

then I can see django message that there is no rule for lkd_site/dispatch.wsgi in me urls.py (ofcourse its true)

 

and dispatch.wgsi file


#!/usr/local/bin/python2.7
import os
import sys
sys.path.insert(0, "/home/vkudak/public_html/lkd_site")
sys.path.insert(0, "/home/vkudak/public_html")
sys.path.insert(0, "/home/vkudak/public_html/django")   # this is path to django 1.6

os.environ['DJANGO_SETTINGS_MODULE'] = 'lkd_site.settings'
os.environ['PYTHON_EGG_CACHE'] = '/home/vkudak/.python_egg_cache'

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


def application(environ, start_response):
 environ['PATH_INFO'] = environ['SCRIPT_NAME'] + environ['PATH_INFO']
 return _application(environ, start_response)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...