Sign inSign up

sangerpathogens/monocle-api

By sangerpathogens

•Updated almost 6 years ago

Image
0

1.0K

sangerpathogens/monocle-api repository overview

⁠GraphQL API (Django)

This is experimental.

⁠Stack background

If you've not used Django and/or GraphQL before, it would be worth running through the following tutorials and documentation.

⁠Development

This API was bootstrapped with Django⁠. See their documentation for options.

⁠Quickstart

Ensure you have python3 installed.

Load the environment defined by the Pipfile and Pipfile.lock (note: you should not need to update these files manually):

pipenv install
pipenv shell

Create the database and load some sample data (locally, the default is SQLite3, but you can uncomment some lines in juno/settings/dev.py to use MySQL instead, in order to mirror the production environment):

python manage.py migrate
python manage.py loaddev
python manage.py collectstatic

Run the development server:

python manage.py runserver

You should be able to view the graphiql interactive schema at localhost:8000.

⁠Testing

You can run the tests with:

python manage.py test
⁠Migrations

You can create any necessary migrations with:

python manage.py makemigrations api

Note: The above takes account of the existing migrations in the juno/api/migrations directory. Early on, while the database can be easily destroyed, it may easier to remove the directory entirely before running, to squash them.

To apply the migrations, run:

python manage.py migrate
⁠Schemas
⁠Database

You can regenerate the database schema diagram with:

python manage.py graph_models -a -g -X Permission,ContentType,Group -o schema-db.png

Note: You might need to brew install graphviz. Also, Permission,ContentType,Group are Django built-in classes, excluded for clarity.

⁠GraphQL API

You can regenerate the GraphQL API schema file with:

python manage.py generateschemagraphql

Tag summary

Content type

Image

Digest

Size

373.5 MB

Last updated

almost 6 years ago

docker pull sangerpathogens/monocle-api:0.1.34