Annotation Database Website: Difference between revisions

From MediaWiki
Jump to navigation Jump to search
(Created page with "= Background = The annotation database Website runs on a [https://www.djangoproject.com/ Django] (Python) backend with a [https://vuejs.org/ Vue 3] (JavaScript, CSS, HTML) frontend. == Django == The backend runs on Django with some small modifications to the structure. === Configuration === Rather than a single settings file (the default), the server uses one of four configuration files stored in the <code>settings</code> folder, each of which inherits from a base...")
 
No edit summary
Line 17: Line 17:


The base file contains two custom functions:
The base file contains two custom functions:
* <code>load_config</code> -- loads database configuration files, as described on the [[Annotation Database Information]] page: each site uses a different database with unique credentials.
* <code>load_config</code> -- loads database configuration files, as described on the [[Annotation Database]] page: each site uses a different database with unique credentials.
* <code>init_dirs<code> -- creates directories necessary to the operation of the server and logs any failures.
* <code>init_dirs<code> -- creates directories necessary to the operation of the server and logs any failures.



Revision as of 17:54, 27 November 2023

Background

The annotation database Website runs on a Django (Python) backend with a Vue 3 (JavaScript, CSS, HTML) frontend.

Django

The backend runs on Django with some small modifications to the structure.

Configuration

Rather than a single settings file (the default), the server uses one of four configuration files stored in the settings folder, each of which inherits from a base file called base.py, which provides configurations common to all other configurations. The four configurations are:

  • prod.py -- The production database configuration.
  • stage.py -- The staging site configuration.
  • dev.py -- A configuration for use on development machines.
  • test.py -- A configuration for use by the unit testing framework.

The base file contains two custom functions:

  • load_config -- loads database configuration files, as described on the Annotation Database page: each site uses a different database with unique credentials.
  • init_dirs -- creates directories necessary to the operation of the server and logs any failures.

TODO: More.

Vue 3

TODO: Add this.

Model Framework

The Model framework is a JavaScript library that provides persistable client-side representations of Django models. The framework manages the object graph so that when an instance is loaded from the server, it is looked up in the graph by its ID. If it exists, the existing instance is updated and duplication is avoided.

The Model class has three main configuration features available to subclasses:

  • path generation -- a function or variable that provides one or more ReST paths for managing object state.
  • property declaration -- an Object that provides property names and default values.
  • class map -- an Object that provides a mapping between property names and class names of properties that inherit from Model.

TODO: More.