Quijost

Por favor ingresa o regístrate.

Ingresar con nombre de usuario, contraseña y duración de la sesión
Búsqueda Avanzada  

Noticias:

Quijost.com - Hosting Gratis al alcance de tus manos

Autor Tema: Problema con configuracion inicial con proyecto django  (Leído 7858 veces)

0 Usuarios y 1 Visitante están viendo este tema.

masajeet

  • Usuario nuevo
  • *
  • Karma: +0/-0
  • Desconectado Desconectado
  • Mensajes: 2
    • Ver Perfil
Problema con configuracion inicial con proyecto django
« en: Octubre 20, 2012, 00:55:21 am »

Buenas noches!
No soy capaz de echar a andar mi proyecto :( por mucho que miro los tutoriales
El esquema de mi proyecto es:
public_html
   .htaccess
   django.wsgi
   emotionaltraining/

Contenidos:
.htaccess
SetHandler wsgi-script

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !(django.wsgi)
RewriteRule ^(.*)$ django.wsgi/$1 [L]

django.wsgi

import os
import sys

sys.stdout = sys.stderr

path = '/home/masajeet/public_html/'
if path not in sys.path:
    sys.path.append(path)
path2 = '/home/masajeet/public_html/emotionaltraining'
if path2 not in sys.path:
    sys.path.append(path2)
sys.stdout = sys.stderr

os.environ['PYTHON_EGG_CACHE']       = '/home/masajeet/tmp/trac-eggs'
os.environ['DJANGO_SETTINGS_MODULE'] = 'emotionaltraining.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
# Create session directory if not present
if settings.SESSION_FILE_PATH:
    try:
     os.makedirs(settings.SESSION_FILE_PATH)
    except OSError:
        pass

def application(environ, start_response):

    import sys
    output = 'Python version: ' + str(sys.version) + '<br/>'

    import django
    output += 'Django version: ' + str(django.VERSION) + '<br/>'

    status = '200 OK'
    response_headers = [('Content-type', 'text/html;charset=UTF-8'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]


Además he visto el tutorial en donde ponen la variabla LOGGING

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler'
        },
   'console':{
            'level':'DEBUG',
            'class':'logging.StreamHandler',
        },
   'file':{
            'level': 'INFO',
            'class': 'logging.FileHandler',
            'filename': os.path.join(PROJECT_ROOT, 'debug.log'),
                },
        'file':{
            'level': 'ERROR',
            'class': 'logging.FileHandler',
             'filename': os.path.join(PROJECT_ROOT, 'error.log'),
        },

    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins', 'file'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}


Los archivos tienen ahora mismo permisos 777

¿Alguna idea?

En línea

shakaran

  • Soporte
  • Administrator
  • Usuario profesional
  • *****
  • Karma: +12/-0
  • Desconectado Desconectado
  • Sexo: Masculino
  • Mensajes: 487
  • Un buen soporte lo es todo
    • Ver Perfil
    • Shakaran
Re:Problema con configuracion inicial con proyecto django
« Respuesta #1 en: Octubre 20, 2012, 04:51:01 am »

Hola masajeet,

He separado el tema del inicial que posteaste ya cada problema debe tratarse separadamente.

En tu caso aunque has establecido inicialmente el LOGGING de django, estás teniendo un error antes de que pueda inicializarse.

Se declara un if de la variable settings que no ha sido previamente definida y ocasiona un error 500 del tipo:

Código: [Seleccionar]
mod_wsgi (pid=8873): Exception occurred processing WSGI script '/home/masajeet/public_html/django.wsgi'.
 Traceback (most recent call last):
   File "/home/masajeet/public_html/django.wsgi", line 24, in <module>
     if settings.SESSION_FILE_PATH:
 NameError: name 'settings' is not define

Puedes omitir esas lineas del settings o bien definirlas como:

Código: [Seleccionar]
import emotionaltraining.settings as settings
En línea
Ángel Guzmán Maeso
Quijost Founder - Backend Engineer & Main support
 

Página generada en 0.11 segundos con 36 consultas.