Skip to content

The source code for the next generation of the PriyomDB API server code, dubbed Purple Unicorn.

Notifications You must be signed in to change notification settings

priyom/priyomdb2

Repository files navigation

priyom.org Database Backend

This is the source code of the next generation of the priyom.org database backend server.

The code is still in development and not deployed live. Note that it also contains parts which are inherently and intendedly unsafe (such as the default login of root:admin). These things will change with deployment, but are handy for local development.

Dependencies

Configuring

Adapt the path in app.wsgi to point to your check out. Add a priyom_config.py file with the following settings:

from priyom.paths import *
import sys
sys.path.insert(0, PATH_TO_TEAPOT)
set_paths(paths(PATH_TO_CHECKOUT))
database_url = VALID_DATABASE_URL

Where the placeholders need to be replaced according to the following rules:

  • PATH_TO_TEAPOT must be a string pointing to the folder of the teapot checkout, that is, where the teapot and xsltea directories are found.
  • PATH_TO_CHECKOUT must point to the path of the priyomdb2 checkout.
  • VALID_DATABASE_URL must be a database URL understood by sqlalchemy pointing to a database which can be used by priyomdb2.

Setting up a database

To set up a fresh database, run ./utils/create_db.py. This will use the configuration to create a fresh database. Note that an existing database is not deleted, you have to do that yourself. Conflicts between an existing database and the attempt to create a new database can lead to funny things, don’t beat me for that.

Upgrading a database

Database versioning is handled by alembic. To upgrade the database to the most recent version, run:

python3-alembic upgrade head

Note that on your system, the command may be simply alembic or something like that—this depends on how your system handles python3 vs. python2 namespacing. Make sure you run the python3 version of alembic.

Running

To spawn a local webserver serving the API, just call ./serve.py. Don’t do that for production.

About

The source code for the next generation of the PriyomDB API server code, dubbed Purple Unicorn.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published