Giter Club home page Giter Club logo

diana-backend's Introduction

DIANA

Diana is a portal for digital humanities projects, developed by the Gothenburg Research Infrastructure in Digital Humanities (GRIDH) at the University of Gothenburg. It is a database coordination solution, interface for data input, and a service for making data accessible through generated REST APIs.

Structure

Diana is a solution for coordinating multiple potentially interacting databases. It has the following structure:

├── apps
│   ├── __init__ .py
│   ├── litteraturlabbet
│   ├── norfam
│   ├── rwanda
│   ├── saga
│   ├── shfa
│   └── ...
├── diana
│   ├── __init__.py
│   ├── abstract
│   ├── asgi.py
│   ├── routers.py
│   ├── settings.py
│   ├── storages.py
│   ├── urls.py
│   ├── utils.py
│   └── wsgi.py
├── locale
│   ├── en
│   └── sv
├── static
│   ├── admin-interface
│   ├── rwanda
│   └── shfa
├── templates
│   ├── redoc.html
│   └── swagger-ui.html
├── README.md
├── requirements.txt
├── environment.yml
└── manage.py

In apps, Diana stores a number of so-called applications, or projects, as git submodules. These all have a corresponding GitHub repository where development is done independently.

Another folder, diana technically also qualifies as an app. It coordinates the rest of the applications, and contains utility functions and common, abstract classes, in abstract. This is also where the global settings are located.

The locale folder contains files for internationalization of text in the admin interface of Diana. In the static and templates folders you will find static files, such as images and html templates (for customized frontends handled by Django itself) respectively.

Local installation

To install the Digital Humanities Portal, we advise using a Conda distribution, such as Anaconda or Miniconda. This allows simultaneous installation of necessary binaries.

Operative system support

Diana and its dependencies have been tested on Linux, e.g. Ubuntu 16.04+ and RedHat OS. Problems have been documented due to geographical dependencies on Windows and MacOS.

Instructions

Clone the repository and change directory.

git clone https://github.com/CDH-DevTeam/diana-backend.git
cd diana-backend

Create a new conda environment from the environment.yml file using

conda env create -n diana -f environment.yml

This will also install the required GDAL dependency for geographical databases.

Activate the conda environment:

conda activate diana

Before installing Diana, it is advised to first look through the Django tutorial and documentation.

For a local installation, a configs folder with database credentials for your local database is needed. Your local database needs the postgis extension which can be added as postgres user with:

\connect <databasename>
CREATE EXTENSION postgis;

Also, a settings_local.py with local settings is needed. The description of it can be found in deployment instructions.

Launch Django by migrating all the initial settings,

python manage.py migrate 

and create a suitable superuser.

python manage.py createsuperuser 

Run it locally via:

python manage.py runserver

Installation and deployment

To also fetch the submodules of a specific branch and for more detailed instructions, please follow the instructions in the deployment instructions.

Localization

Localization is done by using the gettext_lazy translation utility, e.g.

from django.utils.translation import gettext_lazy as _

admin.site.site_header = _('admin.site.site_header')

where admin.site.site_header is an identifier to be translated into the local languages. By running

python manage.py makemessages -l <language-code>

a .po translation file is generated, with the format

#: directory/file.py:line
msgid "admin.site.site_header"
msgstr ""

where msgstr is the corresponding translation to be added, e.g. "Admin site" in English and "Adminsajt" in Swedish. When the .po file is complete, the translations need to be compiled with

django-admin compilemessages

which generates a binary .mo file.

Current URLs

diana-backend's People

Contributors

aramkarimi avatar waahlstrand avatar mtomasini avatar daalft avatar ashely-ra avatar majsan avatar j4lib avatar

Watchers

 avatar

Forkers

j4lib gu-gridh

diana-backend's Issues

Tags always default to lowercase

We should allow the users to decide by themselves if they want tags to be case sensitive. As it stands, whatever text is entered in a Tag Abstract Model, it gets defaulted to lower case.

Automated generation of translation files

Translation files sometimes need to be updated along with code changes. This is easy to forget. It's not critical, but it will cause incoherent translations. With a GitHub workflow, we could probably have this task automated, so that it's done automatically after code changes. After that, we still need to add the actual translations, but at least we can get notified about that.

Maybe we should also employ a git commit hook?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.