Core is the server side for NoPatience. It handles database migrations and connections as well as exposing a RESTful API for interacting with any stored data.
Python 3.6 - currently 3.7 is not supported as it introduces breaking changes to some of the libraries this application depends on.
There are two entry points to the Core server.
The first is main.py which is capable of being the entry point to uWSGI, and it is also capable of running a development server without uWSGI.
The second entry point is Migrator.py which is used for DB migration management. Migrations are explained in more detail below.
To run NoPatience/Core in development mode, uncomment the last line found in main.py and run it using a python interpreter. It is highly suggested to use a Python VENV to do this as to not pollute your global python interpreter.
Recommend to use a venv to run these commands as installing flask on your global python interpreter is not advised.
The migrations will be run each time the server is started. If you are deploying this. you should not need to manually run the migrations
More details: https://flask-migrate.readthedocs.io/en/latest/#command-reference
export FLASK_APP=migrator.pyset FLASK_APP=migrator.pyYou also require a running DB server which can be connected to.
Run all of these commands from the repository root.
flask db init --directory src/db/migrationsAnytime you create new tables, or change tables a new migration must be created.
Creating new migrations requires a DB connection unless you run them offline.
** Note: Anytime you create a new model, it MUST be imported in the __init__.py file found in src.db.models **
flask db migrate --directory src/db/migrations --message "message here"https://alembic.zzzcomputing.com/en/latest/offline.html
Taken from the Flask-Migrate docs which was taken from the Alembic docs: https://flask-migrate.readthedocs.io/en/latest/
The migration script needs to be reviewed and edited, as Alembic currently does not detect every change you make to your models. In particular, Alembic is currently unable to detect table name changes, column name changes, or anonymously named constraints. A detailed summary of limitations can be found in the Alembic autogenerate documentation. Once finalized, the migration script also needs to be added to version control.
flask db upgrade --directory src/db/migrationsContent type
Image
Digest
Size
390.2 MB
Last updated
over 7 years ago
docker pull nopatience/core