[ckan-dev] mod_wsgi error and mako templates

McDonaldR McDonaldR at angus.gov.uk
Thu Feb 14 11:06:14 UTC 2019


Hello both and thanks for the response

I installed using the .deb package and verified that it was indeed the 2.7.5 package I was installing.

I restarted both nginx and apache2.

I activate my virtualenv with “. /usr/lib/ckan/default/bin/activate”

“pip freeze” returns:

amqp==1.4.9
amqplib==1.0.2
anyjson==0.3.3
Babel==2.3.4
Beaker==1.9.0
billiard==3.3.0.23
bleach==2.1.3
celery==3.1.25
certifi==2018.4.16
chardet==3.0.4
-e git+https://github.com/ckan/ckan@2287b2ac0ca20938529cd3ab17215cd8bf6e6fe5#egg=ckan
# Editable install with no version control (ckanext-angus-theme==0.0.1)
-e /usr/lib/ckan/default/src/ckanext-angus_theme
-e git+http://github.com/ckan/ckanext-archiver.git@bfb970dd169f6a6045329c12f23769b65141d9d8#egg=ckanext_archiver
ckanext-geoview==0.0.12
-e git+http://github.com/ckan/ckanext-qa.git@9ad45ef00bdf8108265f814be4e5a6d1740b8647#egg=ckanext_qa
-e git+http://github.com/datagovuk/ckanext-report.git@b67875b2a5b4c9b9ab2cf255f074226255ca9398#egg=ckanext_report
-e git+https://github.com/okfn/ckanext-spatial.git@adb712b1c2fc7e7969f864cdae6c1810a3ed8a68#egg=ckanext_spatial
click==6.7
decorator==4.2.1
fanstatic==0.12
Flask==0.12.4
Flask-Babel==0.11.2
FormEncode==1.3.1
funcsigs==1.0.2
GeoAlchemy==0.7.2
GeoAlchemy2==0.3.0
html5lib==1.0.1
idna==2.6
itsdangerous==0.24
Jinja2==2.8
json-table-schema==0.2.1
kombu==3.0.37
kombu-sqlalchemy==1.1.0
lxml==4.2.1
Mako==1.0.7
Markdown==2.6.7
MarkupSafe==1.0
messytables==0.15.2
nose==1.3.7
ofs==0.4.2
ordereddict==1.1
OWSLib==0.8.6
Pairtree===0.7.1-T
passlib==1.6.5
Paste==1.7.5.1
PasteDeploy==1.5.2
PasteScript==2.0.2
pbr==1.10.0
polib==1.0.7
progressbar==2.3
psycopg2==2.7.3.2
Pygments==2.2.0
Pylons==0.9.7
pyparsing==2.2.0
pysolr==3.6.0
python-dateutil==1.5
python-magic==0.4.15
pytz==2016.7
pyutilib.component.core==4.6.4
redis==2.10.6
repoze.lru==0.7
repoze.who==2.3
repoze.who-friendlyform==1.0.8
requests==2.11.1
Routes==1.13
rq==0.6.0
Shapely==1.5.16
simplejson==3.10.0
six==1.11.0
SQLAlchemy==1.1.11
sqlalchemy-migrate==0.10.0
sqlparse==0.2.2
Tempita==0.5.2
tzlocal==1.3
unicodecsv==0.14.1
urllib3==1.22
vdm==0.14
vine==1.1.4
webencodings==0.5.1
WebError==0.13.1
WebHelpers==1.3
WebOb==1.0.8
WebTest==1.4.3
Werkzeug==0.14.1
xlrd==1.1.0
zope.interface==4.3.2

Thanks in advance

Ross


From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of Adrià Mercader
Sent: 14 February 2019 10:34
To: CKAN Development Discussions
Subject: Re: [ckan-dev] mod_wsgi error and mako templates

Hi Ross,
Sorry to hear you are having troubles with an update. Would be good to know as Stefan mentions if you used a package or source install. Did you restart both nginx and apache?

Mako is definitely not used by CKAN, but it's used as default by Pylons
I wonder if there was an issue during the installation of the requirements or the activation of the virtualenv.

I generally have my virtualenv requirements created in "/usr/lib/ckan/default/lib/" but your stacktrace shows ""/usr/lib/ckan/default/local/lib/"


Adrià





On Thu, 14 Feb 2019 at 10:58, Stefan Oderbolz <stefan.oderbolz at liip.ch<mailto:stefan.oderbolz at liip.ch>> wrote:
Hi Ross

is this an installation from source? Did you follow these steps: https://docs.ckan.org/en/2.7/maintaining/upgrading/upgrade-source.html ?
Especially the part with the virtualenv and "pip install --upgrade -r requirements.txt"?

Activate your virtualenv and check which pip packages are installed (run "pip freeze" to find out), check if Mako is installed.

- Stefan

On Thu, Feb 14, 2019 at 10:20 AM McDonaldR <McDonaldR at angus.gov.uk<mailto:McDonaldR at angus.gov.uk>> wrote:
Should have edited the subject line to keep the thread.

I can’t find any reference to “mako” anywhere and a web search turns up nothing related to plugins required for a “mako” template.  What am I missing?

I also don’t understand how a simple patch release upgrade from 2.7.3 to 2.7.5 can completely break my site.

Ross


From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org<mailto:ckan-dev-bounces at lists.okfn.org>] On Behalf Of McDonaldR
Sent: 13 February 2019 09:31
To: CKAN Development Discussions
Subject: Re: [ckan-dev] ckan-dev Digest, Vol 100, Issue 4

Production.ini file

#
# CKAN - Pylons configuration
#
# These are some of the configuration options available for your CKAN
# instance. Check the documentation in 'doc/configuration.rst' or at the
# following URL for a description of what they do and the full list of
# available options:
#
# http://docs.ckan.org/en/latest/maintaining/configuration.html
#
# The %(here)s variable will be replaced with the parent directory of this file
#

[DEFAULT]

# WARNING: *THIS SETTING MUST BE SET TO FALSE ON A PRODUCTION ENVIRONMENT*
debug = false

[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 5000

[app:celery]
#BROKER_BACKEND = redis
#BROKER_HOST = redis://localhost/1
#CELERY_RESULT_BACKEND = redis
#REDIS_HOST = 127.0.0.1
#REDIS_PORT = 6379
#REDIS_DB = 0
#REDIS_CONNECT_RETRY = True

ckan.redis.url = redis://localhost:6379/1

[app:main]
use = egg:ckan
full_stack = true
cache_dir = /tmp/%(ckan.site_id)s/
beaker.session.key = ckan

# This is the secret token that the beaker library uses to hash the cookie sent
# to the client. `paster make-config` generates a unique value for this each
# time it generates a config file.
beaker.session.secret = mnbvcxzlkjhgfdsapoiuytrewq

# `paster make-config` generates a unique value for this each time it generates
# a config file.
app_instance_uuid = qwertyuiopasdfghjkl

# repoze.who config
who.config_file = %(here)s/who.ini
who.log_level = warning
who.log_file = %(cache_dir)s/who_log.ini
# Session timeout (user logged out after period of inactivity, in seconds).
# Inactive by default, so the session doesn't expire.
# who.timeout = 86400

## Database Settings
sqlalchemy.url = postgresql://aaa:bbb@cccc/ckan_default

ckan.datastore.write_url = postgresql://aaa:bbb@cccc/datastore_default
ckan.datastore.read_url = postgresql://eee:fff@gggg/datastore_default

# PostgreSQL' full-text search parameters
ckan.datastore.default_fts_lang = english
ckan.datastore.default_fts_index_method = gist

## Site Settings

ckan.site_url = http://opendata.angus.gov.uk
#ckan.use_pylons_response_cleanup_middleware = true

## Authorization Settings

ckan.auth.anon_create_dataset = false
ckan.auth.create_unowned_dataset = false
ckan.auth.create_dataset_if_not_in_organization = false
ckan.auth.user_create_groups = true
ckan.auth.user_create_organizations = true
ckan.auth.user_delete_groups = true
ckan.auth.user_delete_organizations = true
ckan.auth.create_user_via_api = false
ckan.auth.create_user_via_web = false
ckan.auth.roles_that_cascade_to_sub_groups = admin editor


## Search Settings

ckan.site_id = default
solr_url = http://aaa.bbb.ccc.ddd:8983/solr

#ckan.simple_search = 1

## CORS Settings

# If cors.origin_allow_all is true, all origins are allowed.
# If false, the cors.origin_whitelist is used.
# ckan.cors.origin_allow_all = true
# cors.origin_whitelist is a space separated list of allowed domains.
# ckan.cors.origin_whitelist = http://example1.com http://example2.com


## Plugins Settings

# Note: Add ``datastore`` to enable the CKAN DataStore
#       Add ``datapusher`` to enable DataPusher
#               Add ``resource_proxy`` to enable resource proxying and get around the
#               same origin policy
ckan.plugins = stats datastore resource_proxy text_view image_view recline_view recline_grid_view recline_graph_view$

# Define which views should be created by default
# (plugins must be loaded in ckan.plugins)
ckan.views.default_views = image_view text_view recline_view geojson_view geo_view

## Spatial / Geoview Settings
ckanext.geoview.ol_viewer.formats = wms wfs kml gml geojson
#ckanext.geoview.ol_viewer.default_feature_hoveron = true
ckanext.spatial.common_map.type = custom
ckanext.spatial.common_map.custom.url = http://tile.stamen.com/terrain/{z}/{x}/{y}.png<http://tile.stamen.com/terrain/%7bz%7d/%7bx%7d/%7by%7d.png>
ckanext.spatial.common_map.attribution = Map tiles by Stamen Design, under CC BY 3.0 Data by OpenStreetMap contribut$

## Archiver Settings
ckanext-archiver.archive_dir = /usr/share/nginx/html/resource_cache
ckanext-archiver.cache_url_root = http://opendata.angus.gov.uk/resource_cache/

## Front-End Settings
ckan.site_title = Angus Open Data
ckan.site_logo = /base/images/angus-logo-header-s5.png
ckan.site_description = Angus Council Open Data
ckan.site_intro_text = Access all of Angus Council's open datasets here.
ckan.favicon = /images/icons/ckan.ico
ckan.gravatar_default = identicon
ckan.preview.direct = png jpg gif
ckan.preview.loadable = html htm rdf+xml owl+xml xml n3 n-triples turtle plain atom csv tsv rss txt json
ckan.preview.text_formats = text plain
ckan.display_timezone = server

# package_hide_extras = for_search_index_only
#package_edit_return_url = http://another.frontend/dataset/<NAME<http://another.frontend/dataset/%3cNAME>>
#package_new_return_url = http://another.frontend/dataset/<NAME<http://another.frontend/dataset/%3cNAME>>
#ckan.recaptcha.version = 1
#ckan.recaptcha.publickey =
#ckan.recaptcha.privatekey =
#licenses_group_url = http://licenses.opendefinition.org/licenses/groups/ckan.json
# ckan.template_footer_end =


## Internationalisation Settings
ckan.locale_default = en_GB
ckan.locale_order = en pt_BR ja it cs_CZ ca es fr el sv sr sr at latin no sk fi ru de pl nl bg ko_KR hu sa sl lv
ckan.locales_offered =
ckan.locales_filtered_out = en_GB

## Feeds Settings

ckan.feeds.authority_name =
ckan.feeds.date =
ckan.feeds.author_name =
ckan.feeds.author_link =

## Storage Settings

ckan.storage_path = /var/lib/ckan/default
#ckan.max_resource_size = 10
#ckan.max_image_size = 2

## Datapusher settings

# Make sure you have set up the DataStore

ckan.datapusher.formats = csv xls xlsx tsv application/csv application/vnd.ms-excel application/vnd.openxmlformats-o$
ckan.datapusher.url = http://xx.yy.rr.ww:8800/
# Resource Proxy setting# Preview size limit, default: 1MB
ckan.resource_proxy.maxfile_size = 10485760# Size of chunks to read/write.
#ckan.resource_proxy.chunk_size = 4096

## Activity Streams Settings

ckan.activity_streams_enabled = true
ckan.activity_list_limit = 31
#ckan.activity_streams_email_notifications = true
#ckan.email_notifications_since = 2 days
ckan.hide_activity_from_users = %(ckan.site_id)s


## Email settings

email_to = xxxxxxx at xxxxxxxx
error_email_from = xxxxx at xxxxxxxxxx
smtp.server = xxxxxxxxxxxxx
smtp.starttls = False
smtp.user =
smtp.password =
smtp.mail_from = xxxxxxxxxxx at xxxxx

## Logging configuration
[loggers]
keys = root, ckan, ckanext

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = WARNING
handlers = console

[logger_ckan]
level = INFO
handlers = console
qualname = ckan
propagate = 0

[logger_ckanext]
level = DEBUG
handlers = console
qualname = ckanext
propagate = 0

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s] %(message)s



Ross McDonald | Geo-evangelist | Angus Council, People, IT | Angus House, Orchardbank Business Park, Sylvie Way, Forfar DD8 1AT | t: 01307 476419

From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of Luke Tully
Sent: 12 February 2019 19:03
To: ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
Subject: Re: [ckan-dev] ckan-dev Digest, Vol 100, Issue 4

Could you post an obfuscated production.ini?
Luke
(204) 981-4494

________________________________
From: ckan-dev <ckan-dev-bounces at lists.okfn.org<mailto:ckan-dev-bounces at lists.okfn.org>> on behalf of ckan-dev-request at lists.okfn.org<mailto:ckan-dev-request at lists.okfn.org> <ckan-dev-request at lists.okfn.org<mailto:ckan-dev-request at lists.okfn.org>>
Sent: Tuesday, February 12, 2019 6:00:02 AM
To: ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
Subject: ckan-dev Digest, Vol 100, Issue 4

Send ckan-dev mailing list submissions to
        ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.okfn.org/mailman/listinfo/ckan-dev
or, via email, send a message with subject or body 'help' to
        ckan-dev-request at lists.okfn.org<mailto:ckan-dev-request at lists.okfn.org>

You can reach the person managing the list at
        ckan-dev-owner at lists.okfn.org<mailto:ckan-dev-owner at lists.okfn.org>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ckan-dev digest..."


Today's Topics:

   1. Re: mod_wsgi error and mako templates (McDonaldR)


----------------------------------------------------------------------

Message: 1
Date: Mon, 11 Feb 2019 12:34:32 +0000
From: McDonaldR <McDonaldR at angus.gov.uk<mailto:McDonaldR at angus.gov.uk>>
To: CKAN Development Discussions <ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>>
Subject: Re: [ckan-dev] mod_wsgi error and mako templates
Message-ID:
        <7CCEF44D1C42854999B19B1EB27281F6016045B5D8 at SR2ORBHQ2K803.angus.gov.uk<mailto:7CCEF44D1C42854999B19B1EB27281F6016045B5D8 at SR2ORBHQ2K803.angus.gov.uk>>

Content-Type: text/plain; charset="us-ascii"

I've thought a bit more about this and searched the web for CKAN/mako template solutions with limited results.

Is mako a templating engine like Jinja2?  Both Jinja2 and mako are installed in my CKAN.

What plugin should I be installing for mako to use?  If nothing is installed should it not fall back to the default templating engine?

Ross


From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of McDonaldR
Sent: 11 February 2019 11:35
To: ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
Subject: [ckan-dev] mod_wsgi error and mako templates

Hi List

I've just upgraded to the latest 2.7.5 patch release (it's never as easy as the docs make out!) and I'm getting a 500 error in the apache2 logs:

mod_wsgi (pid=5269): Target WSGI script '/etc/ckan/default/apache.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=5269): Exception occurred processing WSGI script '/etc/ckan/default/apache.wsgi'.
Traceback (most recent call last):
  File "/etc/ckan/default/apache.wsgi", line 10, in <module>
    application = loadapp('config:%s' % config_filepath)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware/__init__.py", line 49, in make_app
    **app_conf)
  File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware/pylons_app.py", line 55, in make_pylons_stack
    app = pylons_app = CKANPylonsApp()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/wsgiapp.py", line 80, in __init__
    **def_eng['template_options'])
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/templating.py", line 393, in __init__
    self.prepare(default_engine, template_root, **config)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/templating.py", line 409, in prepare
    '"%s" to use its functionality' % engine_name)
TemplateEngineMissing: Please install a plugin for "mako" to use its functionality

I'm running CKAN 2.7.5 on Ubuntu 14.04 with Apache2 and Nginx.

Permissions on apache.wsgi are

-rw-r--r-- 1 www-data root  405 Dec 12 12:25 apache.wsgi

Contents of apache.wsgi are

import os
activate_this = os.path.join('/usr/lib/ckan/default/bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))

from paste.deploy import loadapp

config_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'production.ini')
from paste.script.util.logging_config import fileConfig
fileConfig(config_filepath)
application = loadapp('config:%s' % config_filepath)

Any pointers gratefully received

Ross



Ross McDonald | Geo-evangelist | Angus Council, People, IT | Angus House, Orchardbank Business Park, Sylvie Way, Forfar DD8 1AT | t: 01307 476419


This message is strictly confidential. If you have received this in error, please inform the sender and remove it from your system. If received in error you may not copy, print, forward or use it or any attachment in any way. This message is not capable of creating a legal contract or a binding representation and does not represent the views of Angus Council. Emails may be monitored for security and network management reasons. Messages containing inappropriate content may be intercepted. Angus Council does not accept any liability for any harm that may be caused to the recipient system or data on it by this message or any attachment.

This message is strictly confidential. If you have received this in error, please inform the sender and remove it from your system. If received in error you may not copy, print, forward or use it or any attachment in any way. This message is not capable of creating a legal contract or a binding representation and does not represent the views of Angus Council. Emails may be monitored for security and network management reasons. Messages containing inappropriate content may be intercepted. Angus Council does not accept any liability for any harm that may be caused to the recipient system or data on it by this message or any attachment.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20190211/1b800654/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev


------------------------------

End of ckan-dev Digest, Vol 100, Issue 4
****************************************

This message is strictly confidential. If you have received this in error, please inform the sender and remove it from your system. If received in error you may not copy, print, forward or use it or any attachment in any way. This message is not capable of creating a legal contract or a binding representation and does not represent the views of Angus Council. Emails may be monitored for security and network management reasons. Messages containing inappropriate content may be intercepted. Angus Council does not accept any liability for any harm that may be caused to the recipient system or data on it by this message or any attachment.

This message is strictly confidential. If you have received this in error, please inform the sender and remove it from your system. If received in error you may not copy, print, forward or use it or any attachment in any way. This message is not capable of creating a legal contract or a binding representation and does not represent the views of Angus Council. Emails may be monitored for security and network management reasons. Messages containing inappropriate content may be intercepted. Angus Council does not accept any liability for any harm that may be caused to the recipient system or data on it by this message or any attachment.
_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev


--
Liip AG  // Limmatstrasse 183 //  CH-8005 Zürich
Tel +41 43 500 39 80 // GnuPG 0x7B588C67 // www.liip.ch<http://www.liip.ch>
_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev

This message is strictly confidential. If you have received this in error, please inform the sender and remove it from your system. If received in error you may not copy, print, forward or use it or any attachment in any way. This message is not capable of creating a legal contract or a binding representation and does not represent the views of Angus Council. Emails may be monitored for security and network management reasons. Messages containing inappropriate content may be intercepted. Angus Council does not accept any liability for any harm that may be caused to the recipient system or data on it by this message or any attachment.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20190214/28bf3f26/attachment-0002.html>


More information about the ckan-dev mailing list