Skip to main content

CKAN templates base verses location of themed

Location of the base templates

cd /usr/lib/ckan/default/src/ckan/ckan/templates

Whereas as the location of the plugin that displays the new template

cd /usr/lib/ckan/default/src/ckanext-{project}/ckanext/{project}/templates

To alter the home main page, edit the 

ckan.ini issues

Focusing on the ckan.ini file (/etc/ckan/default/ckan.ini).  When I run the commands to recreate the database tables for CKAN:

cd /usr/lib/ckan/default/src/ckan
ckan -c /etc/ckan/default/ckan.ini db init

The response I'm getting is:

server 500 error - 'Internal server error' on Nginx

Finding the issue with a server 500 error

The Nginx error logs are showing too much detail.

 

Nginx logs and test

There are no errors in the nginx log and sudo nginx -t looks fine

sudo nginx -t

Response

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

 

Setting DataStore with CKAN on Nginx

Following the instructions on CKAN DataStore with a little information.

 

Enable the plugin

In your CKAN config file (/etc/ckan/default/ckan.ini), update the datastore plugin

ckan.plugins = datastore

 

Installing CKAN from source on Ubuntu 20.04

If you're planning to create extensions, generating CKAN from source is the preferred option.  However, even if you have installed from package, you can make adjustments to creating extensions.

 

Set up your server

Begin by cleaning up your server environment.  Do this by updating Ubuntu’s package index:

CKAN extensions

Reviewing CKAN extensions and listing the extensions that have been created / modified in the past three years/

CKAN adding an extension

CKAN extensions - adding to your installation

 

Following the information on the CKAN site

Use the CKAN create command to create an empty extension:

Activate your CKAN virtual environment, for example:

. /usr/lib/ckan/default/bin/activate

Then check your location is

cd /usr/lib/ckan/default/src

So you can execute the create command

CKAN managing your database - initialise, clean and export/import

Before you can run CKAN for the first time, you need to run db init to initialise your database:

ckan -c /etc/ckan/default/ckan.ini db init

If this fails due to a permission issue, then the user and group assigned are incorrect.  Or if you are a root user, you can use sudo

sudo ckan -c /etc/ckan/default/ckan.ini db init

If you forget this step you'll see a 500 server error:

Installing CKAN from package on Ubuntu 20.04

 

Install the CKAN package

Begin by cleaning up your server environment.  Do this by updating Ubuntu’s package index:

sudo apt update

Now you can install the packages that CKAN requires (including ‘git’, which will allow you to install CKAN extensions):

sudo apt install -y libpq5 redis-server nginx supervisor

Response

Subscribe to CKAN