Jump to content

Recommended Posts

Posted

 

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/'

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Posted

 

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/'

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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