Installation of pylons (ckan) Mod_wsgi does not work

I install CKAN, the pylon application according to these instructions: http://packages.python.org/ckan/deployment.html

But when I point to the server (DNS is not yet configured) using IP or hostname, I see only the apache welcome page, and the ckan application does not load.

here is my mod_wsgi script:

import os instance_dir = '/home/flavio/var/srvc/ckan.emap.fgv.br' config_file = 'ckan.emap.fgv.br.ini' pyenv_bin_dir = os.path.join(instance_dir, 'pyenv', 'bin') activate_this = os.path.join(pyenv_bin_dir, 'activate_this.py') execfile(activate_this, dict(__file__=activate_this)) from paste.deploy import loadapp config_filepath = os.path.join(instance_dir, config_file) from paste.script.util.logging_config import fileConfig fileConfig(config_filepath) application = loadapp('config:%s' % config_filepath) 

here is my virtual host configuration:

 <VirtualHost *:80> ServerName dck093 ServerAlias dck093 WSGIScriptAlias / /home/flavio/var/srvc/ckan.emap.fgv.br/pyenv/bin/ckan.emap.fgv.br.py # pass authorization info on (needed for rest api) WSGIPassAuthorization On ErrorLog /var/log/apache2/ckan.emap.fgv.br.error.log CustomLog /var/log/apache2/ckan.emap.fgv.br.custom.log combined <Directory /home/flavio/var/srvc/ckan.emap.fgv.br/pyenv/bin> Order deny,allow Allow from all </Directory> </VirtualHost> 

I am trying to disable the 000-default site (with a2dissite), but that will not help. After that, I get a page with an internal server error. After fixing some permissions, I managed to get this Pylons error log:

 sudo tail /var/log/apache2/ckan.emap.fgv.br.error.log [Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110] app_iter = self.application(environ, start_response) [Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110] File "/usr/lib/pymodules/python2.6/repoze/who/middleware.py", line 107, in __call__ [Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110] app_iter = app(environ, wrapper.wrap_start_response) [Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110] File "/home/flavio/var/srvc/ckan.emap.fgv.br/pyenv/lib/python2.6/site-packages/pylons/middleware.py", line 201, in __call__ [Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110] self.app, environ, catch_exc_info=True) [Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110] File "/home/flavio/var/srvc/ckan.emap.fgv.br/pyenv/lib/python2.6/site-packages/pylons/util.py", line 94, in call_wsgi_application [Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110] app_iter = application(environ, start_response) [Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110] File "/usr/lib/pymodules/python2.6/weberror/evalexception.py", line 226, in __call__ [Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110] "The EvalException middleware is not usable in a " [Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110] AssertionError: The EvalException middleware is not usable in a multi-process environment 

Can anyone point out what I am missing?

+6
python apache apache2 mod-wsgi pylons
source share
4 answers

Since you are deploying to apache, make sure you are not in interactive debugging mode that uses an EvalException. In your Pylons configuration file (ckan.emap.fgv.br.ini), make sure you have this:

 [app:main] set debug = false 
+14
source share

Your first problem is that you cannot use name-based virtual hosts in Apache without a host name in DNS or local / etc / hosts, which resolves the IP address of the Apache server.

The second problem is that an EvalException cannot be used in a multiprocessor server configuration. Read:

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Browser_Based_Debugger

Either throw an EvalException or configure mod_wsgi so that you use the daemon mode with "default" for a single process (do not use processes = 1).

For the background for the various process / thread configurations available for Apache / mod_wsgi, read:

http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

You want to use the one where wsgi.multiprocess is False.

+3
source share

Not an expert in the "paste" environment, but should not be:

 from paste.deploy.loadwsgi import loadapp 
+1
source share

I agree that debugging should be disabled during production, but I would really like to see stacktraces of exceptions.

Right now, if I get 500 server errors inside CKAN (a good CKAN page with error information is displayed) in the logs, I can only find the error description without stacktrace:

[Thu Feb 12 17:04:55.037785 2015] [:error] [pid 15293:tid 139979468994304] [remote 89.71.231.138:5513] Error - <type 'exceptions.TypeError'>: 'NoneType' object is not iterable

Is there a way to enable full stacktrace with debug = false.

0
source share

All Articles