Skip to content

Development

Luís Santos edited this page Jan 5, 2022 · 1 revision

Local Instantiation

To facilitate the instantiation of CKAN and all the needed external components, the following repository is used (https://github.com/okfn/docker-ckan).

From this point, there are two available options for the continuous development of this extension:

  • Pull the generic CKAN repository (referred above) and clone the extension inside the src/ folder. This folder is mounted on the ckan-dev service, so any extension located here will be installed when booting up Docker Compose in development mode (docker-compose -f docker-compose.dev.yml up). If running the CKAN container standalone you will need to mount the folder yourself. Have in mind that the chosen CKAN version is 2.8 which requires changes on the versions and imports used ;

  • Use our internal CKAN repository to pull the code and run it locally. Using this method, a separated editor must be used to modify the extension and then push the modifications again to the repository. After the push, re-run the CKAN to get the new version.

Extension Default Structure

CKAN 2.8 (version used internally) is built over Python 2.7 and the basics frontend languages (HTML, CSS, Javascript).

When a resource is created, CKAN generates all the needed folders and files. To focus on the development of new styling, the main folder for that is 'ckanext'. Inside of 'ckanext' folder, a list of folders are present:

  • fantastic: folder that has all the 'js' files used to define interactions and actions with CKAN pages;

  • i18n: folder that contains translation files;

  • public: folder with all the public information like images, json files, pdf, CSS, etc;

  • templates: where the default HTML pages can be redefined. For this, you need to have access to the default code in order to copy the exact path and file name and change what is needed. The base.html is already in the folder, which is the base page of CKAN. To get all the templates, you can pull or check the following link: https://github.com/ckan/ckan/tree/master/ckan/templates;

  • tests: for test purposes and not needed for styling ;

All the remaining files inside this folder are not relevant for this type of extension.

Requirements

In case you need to install new packages, add them in the requirements.txt. For local testing, use the dev-requirements. Pay special attention to the Dockerfiles when running locally to see if everything is well included.

Clone this wiki locally