Jump to content

500 Internal Server Error


hataltul

Recommended Posts

 

hi, im using django 1.7

 

i uploaded my website and it giving me a 500 server error,

 

i followed the guides at "http://www.thebrokendesk.com/post/deploying-a-django-site-to-heliohost/"

 

and "http://www.heliohost.org/home/features/languages/python"

 

but the site still doesn't working.

 

when i run the site on a local host it work just fine.

 

i think i may have been used a wrong settings or something but i can't find what is wrong

 

can someone help me figure it out?

 

.htaccess ( in public html folder permission 644)

 

RewriteEngine On

 

RewriteBase /

 

RewriteRule ^(media/.*)$ - [L]

 

RewriteRule ^(admin_media/.*)$ - [L]

 

RewriteRule ^(dispatch\.wsgi/.*)$ - [L]

 

RewriteRule ^(.*)$ <my proj name>/dispatch.wsgi/$1 [QSA,PT,L]

 

 

dispatch.wsgi (in <public htm/<my proj name> permission 755)

 

try:

import os, sys

sys.path.append("/home/hataltul/public_html/<my proj name>");

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

os.environ['PYTHON_EGG_CACHE'] = '/home/hataltul/.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)

except:

import traceback

 

trace = traceback.format_exc()

 

def application(environ, start_response):

 

status = '500 Internal Server Error'

output = trace

 

response_headers = [('Content-type', 'text/plain'),

('Content-Length', str(len(output)))]

start_response(status, response_headers)

 

return [output]

 

 

 

 

 

settings.py

 

 

 

import os

 

from django.conf.global_settings import LOGIN_URL

 

 

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

 

# SECURITY WARNING: don't run with debug turned on in production!

DEBUG = False

 

TEMPLATE_DEBUG = False

 

ALLOWED_HOSTS = ['.heliohost.org']

 

 

 

# Application definition

 

INSTALLED_APPS = (

'django.contrib.admin',

'django.contrib.auth',

'django.contrib.contenttypes',

'django.contrib.sessions',

'django.contrib.messages',

'django.contrib.staticfiles',

'myApp',

)

 

MIDDLEWARE_CLASSES = (

'django.contrib.sessions.middleware.SessionMiddleware',

'django.middleware.common.CommonMiddleware',

'django.middleware.csrf.CsrfViewMiddleware',

'django.contrib.auth.middleware.AuthenticationMiddleware',

'django.contrib.auth.middleware.SessionAuthenticationMiddleware',

'django.contrib.messages.middleware.MessageMiddleware',

'django.middleware.clickjacking.XFrameOptionsMiddleware',

)

 

ROOT_URLCONF = 'myProj.urls'

 

WSGI_APPLICATION = 'myProj.wsgi.application'

 

 

# Database

# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

 

DATABASES = {

'default': {

'ENGINE': 'django.db.backends.sqlite3',

'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),

}

}

 

# Internationalization

# https://docs.djangoproject.com/en/1.7/topics/i18n/

 

LANGUAGE_CODE = 'en-us'

 

TIME_ZONE = 'UTC'

 

USE_I18N = True

 

USE_L10N = True

 

USE_TZ = True

 

 

# Static files (CSS, JavaScript, Images)

# https://docs.djangoproject.com/en/1.7/howto/static-files/

 

 

TEMPLATE_DIR = (

"myApp/templates/",

 

)

STATIC_ROOT = 'myApp/static'

STATIC_URL = '/static/'

 

AUTH_USER_MODEL = 'myApp.User'

 

LOGIN_URL = "/login/"

 

 

# define the directory which all upload files will be saved

PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))

MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'myApp/static/myApp/files')

MEDIA_URL = 'myApp/files/'

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

 

hi, im using django 1.7

 

i uploaded my website and it giving me a 500 server error,

 

i followed the guides at "http://www.thebrokendesk.com/post/deploying-a-django-site-to-heliohost/"

 

and "http://www.heliohost.org/home/features/languages/python"

 

but the site still doesn't working.

 

when i run the site on a local host it work just fine.

 

i think i may have been used a wrong settings or something but i can't find what is wrong

 

can someone help me figure it out?

 

.htaccess ( in public html folder permission 644)

 

RewriteEngine On

 

RewriteBase /

 

RewriteRule ^(media/.*)$ - [L]

 

RewriteRule ^(admin_media/.*)$ - [L]

 

RewriteRule ^(dispatch\.wsgi/.*)$ - [L]

 

RewriteRule ^(.*)$ <my proj name>/dispatch.wsgi/$1 [QSA,PT,L]

 

 

dispatch.wsgi (in <public htm/<my proj name> permission 755)

 

try:

import os, sys

sys.path.append("/home/hataltul/public_html/<my proj name>");

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

os.environ['PYTHON_EGG_CACHE'] = '/home/hataltul/.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)

except:

import traceback

 

trace = traceback.format_exc()

 

def application(environ, start_response):

 

status = '500 Internal Server Error'

output = trace

 

response_headers = [('Content-type', 'text/plain'),

('Content-Length', str(len(output)))]

start_response(status, response_headers)

 

return [output]

 

 

 

 

 

settings.py

 

 

 

import os

 

from django.conf.global_settings import LOGIN_URL

 

 

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

 

# SECURITY WARNING: don't run with debug turned on in production!

DEBUG = False

 

TEMPLATE_DEBUG = False

 

ALLOWED_HOSTS = ['.heliohost.org']

 

 

 

# Application definition

 

INSTALLED_APPS = (

'django.contrib.admin',

'django.contrib.auth',

'django.contrib.contenttypes',

'django.contrib.sessions',

'django.contrib.messages',

'django.contrib.staticfiles',

'myApp',

)

 

MIDDLEWARE_CLASSES = (

'django.contrib.sessions.middleware.SessionMiddleware',

'django.middleware.common.CommonMiddleware',

'django.middleware.csrf.CsrfViewMiddleware',

'django.contrib.auth.middleware.AuthenticationMiddleware',

'django.contrib.auth.middleware.SessionAuthenticationMiddleware',

'django.contrib.messages.middleware.MessageMiddleware',

'django.middleware.clickjacking.XFrameOptionsMiddleware',

)

 

ROOT_URLCONF = 'myProj.urls'

 

WSGI_APPLICATION = 'myProj.wsgi.application'

 

 

# Database

# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

 

DATABASES = {

'default': {

'ENGINE': 'django.db.backends.sqlite3',

'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),

}

}

 

# Internationalization

# https://docs.djangoproject.com/en/1.7/topics/i18n/

 

LANGUAGE_CODE = 'en-us'

 

TIME_ZONE = 'UTC'

 

USE_I18N = True

 

USE_L10N = True

 

USE_TZ = True

 

 

# Static files (CSS, JavaScript, Images)

# https://docs.djangoproject.com/en/1.7/howto/static-files/

 

 

TEMPLATE_DIR = (

"myApp/templates/",

 

)

STATIC_ROOT = 'myApp/static'

STATIC_URL = '/static/'

 

AUTH_USER_MODEL = 'myApp.User'

 

LOGIN_URL = "/login/"

 

 

# define the directory which all upload files will be saved

PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))

MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'myApp/static/myApp/files')

MEDIA_URL = 'myApp/files/'

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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...