[ckan-dev] mod_wsgi error and mako templates

McDonaldR McDonaldR at angus.gov.uk
Thu Feb 14 09:20:24 UTC 2019


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] 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20190214/703022c6/attachment-0002.html>


More information about the ckan-dev mailing list