[ckan-dev] Cannot find /api/i18n/ when loading pages

Richard Didier didier.richard at ign.fr
Thu Oct 10 07:42:05 UTC 2013


Le mardi 8 octobre 2013 10:34:58 Richard Didier a écrit :
Hi all,

> I have just installed CKAN from sources following step by step the tutorial
> and wherething goes well (using parser and pointing at localhost:5000).
> 
> I am now testing "deploying source install" chapter.
> 
> As I have other services running on the 80 port, I changed the Apache
> configuration to the following :
> 
>     <IfModule mod_wsgi.c>
>         WSGIScriptAlias /ckan /etc/ckan/default/apache.wsgi
>         # Pass authorization info on (needed for rest api).
>         WSGIPassAuthorization On
>         # Deploy as a daemon (avoids conflicts between CKAN instances).
>         WSGIDaemonProcess ckan_default display-name=ckan_default processes=2
> threads=15
>         WSGIProcessGroup ckan_default
>         ErrorLog /var/log/apache2/ckan_default.error.log
>         CustomLog /var/log/apache2/ckan_default.custom.log combined
>         <Location /ckan/>
>             Order deny,allow
>             Allow from all
>         </Location>
>     </IfModule>
> 
> The front pages load perfectly (http://localhost/ckan/) except that I have
> 404 errors with http://localhost/api/i18n/fr leaving some functionalities
> of the web pages broken (like changing language).
> 
> Digging in the documentation, I found that I could set ckan.site_url. So, I
> set to http://localhost/ckan ... and nothing improved !?
> 
> Browsing the scripts, it seems that the url is computed by
> public/base/javascript/client.js, méthode url() based on the end_point
> option given to the constructor. And when debugging, I never find the
> site_url value appearing in the JS.
> 
> Did I miss some configuration options somewhere ?
> 

The problem seems to be related to the Client creation by passing a wrong API 
URL : new Client({endpoint: ckan.API_ROOT}).

According to the doc http://docs.ckan.org/en/latest/configuration.html#ckan-
api-url, API_ROOT should not be used for configuration ...

When searching the Javascript code (2.2a release) for API_ROOT, one can find 
two places where API_ROOT is still in use :

1/ ckan/public/base/javascript/main.js : ckan.API_ROOT    = 
getRootFromData('apiRoot');
2/ ckan/public/base/javascript/client.js: instance.client = new 
Client({endpoint: ckan.API_ROOT});

I guess that :

1/ changing main.js according to the doc by :
ckan.API_ROOT    = getRootFromData(siteRoot');
or
ckan.API_ROOT    = ckan.SITE_ROOT;

I guess ckan.API_ROOT is preserved for backward compatibility issues ...
This modification makes my site working!

2/ changing client.js with :

instance.client = new Client({endpoint: ckan.SITE_ROOT});

Should also be made to avoid having two places for a deprecated configuration 
options.

regards,
-- 
RICHARD Didier - Chef du pôle technique du Géoportail
2/4, avenue Pasteur - 94165 Saint Mandé Cedex
Tél : +33 (0) 1 43 98 83 23





More information about the ckan-dev mailing list