Crème[ok]_apache2_WSGI_Erreur 500 [résolu]
#1
L'objet de mon message : Problème pour servir crème avec Apache2

Bonjour,

Je ne réussi pas à servir crème avec Apache2 et le module WSGI.
Le serveur de dev de django me prouve que crème est bien installé, mais pas moyen de le faire servir par Apache.

Ci dessous mes fichiers :

- local_settings.py sous /creme_crm-1.2/creme/

Code :
(creme)creme@************$:~/creme_crm-1.2/creme$ more local_settings.py
from os.path import dirname, join, abspath
CREME_ROOT = dirname(abspath(__file__))
DEBUG = True
DATABASES = {
        'default': {
                'ENGINE': 'django.db.backends.mysql',
                'NAME': 'bdcremecrm',
                'USER': 'cremeuser',
                'PASSWORD': 'cremepasswd',
                'HOST': '',
                'PORT': '',
                'OPTIONS': {'init_command': 'SET storage_engine=INNODB' },
        }
}
MEDIA_URL = 'http://127.0.0.1/site_media/'

- Apache 2 : Ci dessous mon virtualhost :
J'ai conservé mon fichier d'origine pour les logs. Un probleme ?
Nous avons un user dédié pour apache qui est wwwroot. J'ai donc rajouté wwwroot dans le groupe creme, afin que le data user ai les droits de lectures et écritures necessaires en modifiant /etc/group
Rien de plus à signaler pour moi ici. Et vous ?

Code :
<VirtualHost *>
        DocumentRoot /home/creme/creme_crm-1.2
        ServerName MyServerName************* # grisé pour les besoins du topic


        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/creme/creme_crm-1.2>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog /var/log/apache2/error-karon.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

# Custom log pour karon classique
        CustomLog /var/log/apache2/access-karon.log combined

# Custom log pour creme
#       CustomeLog ${APACHE_LOG_DIR}/acces.log combined

# ci dessous les infos specifiques pour wsgi creme
WSGIScriptAlias / /home/creme/creme_crm-1.2/creme/django.wsgi
<Directory /home/creme/creme_crm-1.2>
        Order deny,allow
        Allow from all
</Directory>
# Fin de infos pour wsgi creme

#ci dessous : alias pour creme
Alias /site_media/ /home/creme/creme_crm/creme/media
Alias /static_media/ /home/creme/creme_crm/creme/media/static
#fin alias pour creme




</VirtualHost>

- Mon django.wsgi :

Code :
import os
import sys
import site
from os.path import dirname, join, abspath
osys = sys.path
new_sys = [ '/home/creme/Envs/creme/lib/python2.7/site-packages/', ]
new_sys.extend (sys.path)
sys.path = new_sys

site.addsitedir('/home/creme/Envs/creme/lib/python2.7/site-packages')
site.addsitedir('/home/creme/creme_crm-1.2')

from os.path import dirname, join, abspath

CREME_ROOT = dirname(abspath(__file__))


sys.path.append(CREME_ROOT)


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

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

- Le fichier urls.py :
Code :
# -*- coding: utf-8 -*-

from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin

admin.autodiscover()

import creme_core
creme_core.autodiscover()


handler500 = 'creme_core.views.exceptions.server_error'

urlpatterns = patterns('',
    url(r'^creme_login/$',  'django.contrib.auth.views.login', {'template_name': 'authent/c
reme_login.html'} , name="creme_login"),
    url(r'^creme_logout/$', 'django.contrib.auth.views.logout_then_login' , name="creme_log
out"),
    (r'^', include('creme_core.urls')),

    #(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.
MEDIA_ROOT}),
    #NB: in production, configure your web server to statically serve the files in the 'med
ia/static/' dir (and so comment the following line)
    #(r'^static_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': setting
s.GENERATED_MEDIA_DIR}),

    (r'^creme_config/',   include('creme_config.urls')),
    (r'^media_managers/', include('media_managers.urls')),
    (r'^documents/',      include('documents.urls')),
    (r'^assistants/',     include('assistants.urls')),
    (r'^activities/',     include('activities.urls')),
    (r'^persons/',        include('persons.urls')),

    (r'^graphs/',         include('graphs.urls')),
    (r'^reports/',        include('reports.urls')),
    (r'^products/',       include('products.urls')),
    (r'^recurrents/',     include('recurrents.urls')),
    (r'^billing/',        include('billing.urls')),
    (r'^opportunities/',  include('opportunities.urls')),
    (r'^commercial/',     include('commercial.urls')),
    (r'^events/',         include('events.urls')),
    (r'^crudity/',        include('crudity.urls')),
    (r'^emails/',         include('emails.urls')),
    (r'^sms/',            include('sms.urls')),
    (r'^projects/',       include('projects.urls')),
    (r'^tickets/',        include('tickets.urls')),
    (r'^activesync/',     include('activesync.urls')),
    (r'^cti/',            include('cti.urls')),
    (r'^vcfs/',           include('vcfs.urls')),

    (r'^admin/(.*)', include(admin.site.urls)),
)

- Pour finir, les infos résultant de l'option DEBUG=True dans local_settings.py :

Code :
Environment:


Request Method: GET
Request URL: http://karon.territoireweb.com/creme_login/?next=/

Django Version: 1.3.7
Python Version: 2.7.3
Installed Applications:
['django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.admindocs',
'mediagenerator',
'south',
'creme_core',
'creme_config',
'media_managers',
'documents',
'assistants',
'activities',
'persons',
'graphs',
'reports',
'products',
'recurrents',
'billing',
'opportunities',
'commercial',
'events',
'crudity',
'emails',
'projects',
'tickets',
'activesync',
'vcfs']
Installed Middleware:
('mediagenerator.middleware.MediaMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.locale.LocaleMiddleware',
'creme_core.middleware.global_info.GlobalInfoMiddleware',
'creme_core.middleware.exceptions.Beautiful403Middleware')


Traceback:
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  89.                     response = middleware_method(request)
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/middleware/locale.py" in process_request
  16.         language = translation.get_language_from_request(request)
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/utils/translation/__init__.py" in get_language_from_request
  124.     return _trans.get_language_from_request(request)
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/utils/translation/trans_real.py" in get_language_from_request
  372.         lang_code = request.session.get('django_language', None)
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py" in get
  64.         return self._session.get(key, default)
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py" in _get_session
  195.                 self._session_cache = self.load()
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py" in load
  20.                 expire_date__gt=datetime.datetime.now()
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/db/models/manager.py" in get
  132.         return self.get_query_set().get(*args, **kwargs)
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/db/models/query.py" in get
  344.         num = len(clone)
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/db/models/query.py" in __len__
  82.                 self._result_cache = list(self.iterator())
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/db/models/query.py" in iterator
  273.         for row in compiler.results_iter():
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in results_iter
  680.         for rows in self.execute_sql(MULTI):
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  735.         cursor.execute(sql, params)
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  34.             return self.cursor.execute(sql, params)
File "/home/creme/Envs/creme/lib/python2.7/site-packages/django/db/backends/mysql/base.py" in execute
  86.             return self.cursor.execute(query, args)
File "/home/creme/Envs/creme/lib/python2.7/site-packages/MySQLdb/cursors.py" in execute
  174.             self.errorhandler(self, exc, value)
File "/home/creme/Envs/creme/lib/python2.7/site-packages/MySQLdb/connections.py" in defaulterrorhandler
  36.     raise errorclass, errorvalue

Exception Type: InvalidOperation at /creme_login/
Exception Value: Invalid literal for Decimal: '2013-04-02 10:50:49'

J'ai entendu (lu) que ca pouvait venir soit d'un conflit avec le module php5, ou alors du module wsgi que je devrai compiler depuis les sources plutot que de passer par le paquet apt.... mouais
Ben je continu les tests.
Antoine
  Répondre


Messages dans ce sujet

Atteindre :


Utilisateur(s) parcourant ce sujet : 2 visiteur(s)