Jump to content

Htaccess Dont Start Django Project


vkudak

Recommended Posts

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)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...