This is the server-side component for the offline-first application I implemented for my thesis. The server is a very basic API for task management. It follows the JSON API specification.
-
Create a virtualenv for the project:
$ pipenv --python 3.6
-
Install the Python dependencies:
$ pipenv install --dev
-
Activate the virtualenv:
$ pipenv shell
-
Create the databases for development and testing:
$ createdb tasks_dev $ createdb tasks_test
-
Run the database migrations for the development database:
$ alembic upgrade head
-
Tell the Flask command-line client where the application can be found:
$ export FLASK_APP=autoapp.py
You might want to automate this using direnv or a similar tool.
-
Start the development server:
$ flask run
-
Open http://127.0.0.1:5000/ on your browser.
You can run the tests with py.test:
$ py.test