Skip to content

Jazyki-Mira/langworld_db_pyramid

Repository files navigation

GitHub Actions pre-commit.ci status codecov

Jazyki Mira (Languages of the World) online database

Jazyki Mira (Languages of the World) Database as a Pyramid web app with interactive UI components created in React.js.

The data is pulled with git subtree from a data repository into langworld_db_data. The actual data files are in data subdirectory of that package. See the Entity Relationship Diagram of the relational database that was generated from the data for the web app.

The langworld_db_pyramid package contains the actual Pyramid web app. The tests for this package are stored in a separate directory.

Installation

Prerequisites

Clone repository (and cd into package directory)

git clone https://github.com/Jazyki-Mira/langworld_db_pyramid/; cd langworld_db_pyramid

Copy default PasteDeploy .ini files and edit them if necessary

Copy .ini files from /config/default/ to /config/. Edit if necessary (e.g. sqlalchemy.url for the database).

One thing that is missing there and must be entered is a MapBox token (mapbox_access_token key in [app:main] section).

No .ini files in /config/ directory will be checked into VCS (as per .gitignore).

Create a virtual environment and install dependencies (from Pipfile)

pipenv install

Note #1: This will also automatically install langworld_db_pyramid and langworld_db_data packages locally as they are mentioned in Pipfile. There is no need to manually run pip install -e . (from Pyramid docs) separately.

Note #2: These two packages will be installed in editable mode, which conforms to upcoming pip behavior that will install all local packages without copying them to the directory of the virtual environment.

To install with development dependencies (testing, linting):

pipenv install --dev

Activate or use the virtual environment

Activate virtual environment...

pipenv shell

...or run all commands with pipenv run.

All commands below must be run under virtual environment.

Run initialization script (after making it executable)

bash_scripts/init_compile.sh

This bash script applies alembic migrations to the database, runs the initialize_db script that populates the database with data from langworld_db_data and compiles Babel message catalogs for the English version.

Serve locally ...

pserve config/production.ini

... or setup your WSGI server.

Example WSGI config file for PythonAnywhere:

import sys

# replace <username> with valid one
path = '/home/<username>/langworld_db_pyramid'

if path not in sys.path:
    sys.path.append(path)

from pyramid.paster import get_app
ini_path = path + '/config/production.ini'
application = get_app(ini_path, 'main')

Update web app on remote server if the package has changed

Use this bash script:

bash_scripts/update.sh

Re-install package locally if its dependencies have changed.

Use development.ini file in for development

For development, use development.ini instead of production.ini.

Serve locally with --reload flag for waitress to reflect changes in views and templates instantly:

pserve config/development.ini --reload

Run tests

pytest --cov

(works only if the project was installed in development mode)