Jump to content

[Solved] django problems


totocoto

Recommended Posts

Hi! Sorry for bothering. You're my last hope.

I deployed my django project (it works on django development server on my PC) following the instruction on heliohost. But it doesn't work. I was looking for solution but have no ideas.

 

My project (school) path is: /public_html/school

 

When I try http://sokiljnyky.heliohost.org/school/hello it raises: 500 internal server error

 

[sat Jun 12 16:50:07 2010] [error] [client 195.211.156.5] File "/home/pavlok31/public_html/school/dispatch.wsgi", line 13, in application

[sat Jun 12 16:50:07 2010] [error] [client 195.211.156.5] mod_wsgi (pid=26503): Exception occurred processing WSGI script '/home/pavlok31/public_html/school/dispatch.wsgi'.

 

 

Here are the code of files in /public_html/school:

 

.htaccess:

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

 

dispatch.wsgi

import os, sys

sys.path.append("/home/pavlok31/public_html/school");
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
os.environ['PYTHON_EGG_CACHE'] = '/home/pavlok31/.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)# - line 13

 

settings.py:

# Django settings for school project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = ()

MANAGERS = ADMINS}

TIME_ZONE = 'America/Chicago'

LANGUAGE_CODE = 'en-us'

SITE_ID = 1

USE_I18N = True

USE_L10N = True

MEDIA_ROOT = ''

MEDIA_URL = ''

ADMIN_MEDIA_PREFIX = '/media/'

TEMPLATE_LOADERS = (
   'django.template.loaders.filesystem.Loader',
   'django.template.loaders.app_directories.Loader',

)

MIDDLEWARE_CLASSES = (
   'django.middleware.common.CommonMiddleware',
   'django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'urls' # also tried school.urls and result is the same

TEMPLATE_DIRS = (
)

INSTALLED_APPS = (
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.sites',
   'django.contrib.messages',

)

 

urls.py:

from django.conf.urls.defaults import *
from views import hello

urlpatterns = patterns('',
   ('^hello/$', hello),  
)

 

views.py:

# Create your views here.
from django.http import HttpResponse

def hello(request):
   return HttpResponse("Hello world")

manage.py:

#!/usr/bin/env python
from django.core.management import execute_manager
try:
   import settings # Assumed to be in the same directory.
except ImportError:
   import sys
   sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
   sys.exit(1)

if __name__ == "__main__":
   execute_manager(settings)

Link to comment
Share on other sites

Here is more detailed debug information:

 

[Tue Jun 15 02:03:46 2010] [error] [client 5.5.5.5] mod_wsgi (pid=27673): Exception occurred processing WSGI script '/home/pavlok31/public_html/school/dispatch.wsgi'., referer: http://www.helionet.org/index/index.php?showtopic=6562
[Tue Jun 15 02:03:46 2010] [error] [client 5.5.5.5] Traceback (most recent call last):, referer: http://www.helionet.org/index/index.php?showtopic=6562
[Tue Jun 15 02:03:46 2010] [error] [client 5.5.5.5]   File "/home/pavlok31/public_html/school/dispatch.wsgi", line 13, in application, referer: http://www.helionet.org/index/index.php?showtopic=6562
[Tue Jun 15 02:03:46 2010] [error] [client 5.5.5.5]     return _application(environ, start_response), referer: http://www.helionet.org/index/index.php?showtopic=6562
[Tue Jun 15 02:03:46 2010] [error] [client 5.5.5.5]   File "/usr/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 230, in __call__, referer: http://www.helionet.org/index/index.php?showtopic=6562
[Tue Jun 15 02:03:46 2010] [error] [client 5.5.5.5]     self.load_middleware(), referer: http://www.helionet.org/index/index.php?showtopic=6562
[Tue Jun 15 02:03:46 2010] [error] [client 5.5.5.5]   File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py", line 42, in load_middleware, referer: http://www.helionet.org/index/index.php?showtopic=6562
[Tue Jun 15 02:03:46 2010] [error] [client 5.5.5.5]     raise exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"' % (mw_module, e), referer: http://www.helionet.org/index/index.php?showtopic=6562
[Tue Jun 15 02:03:46 2010] [error] [client 5.5.5.5] ImproperlyConfigured: Error importing middleware django.middleware.csrf: "No module named csrf", referer: http://www.helionet.org/index/index.php?showtopic=6562

Does that help?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...