-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from c3g/develop
Release v0.4.0
- Loading branch information
Showing
21 changed files
with
452 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,7 @@ env/ | |
# coverage | ||
.coverage | ||
htmlcov/ | ||
|
||
# docs build | ||
|
||
docs/_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 0.4.0 | ||
|
||
# Build documentation in the docs/ directory with Sphinx | ||
sphinx: | ||
configuration: docs/conf.py | ||
|
||
# Optionally build your docs in additional formats such as PDF and ePub | ||
formats: all | ||
|
||
# Optionally set the version of Python and requirements required to build your docs | ||
python: | ||
version: 3.7 | ||
install: | ||
- requirements: docs/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from django.conf import settings | ||
from rest_framework import pagination | ||
from urllib.parse import urljoin | ||
|
||
|
||
__all__ = [ | ||
"LargeResultsSetPagination", | ||
] | ||
|
||
|
||
class LargeResultsSetPagination(pagination.PageNumberPagination): | ||
page_size = 25 | ||
page_size_query_param = 'page_size' | ||
max_page_size = 10000 | ||
|
||
# Fix next/previous links inside sub-path-mounted reverse proxies in the CHORD context: | ||
|
||
def _get_chord_absolute_uri(self): | ||
full_path = self.request.get_full_path() | ||
# Strip first slash if necessary, to avoid urljoin removing reverse proxy sub-paths | ||
if len(full_path) > 0 and full_path[0] == "/": | ||
full_path = full_path[1:] | ||
return urljoin(settings.CHORD_URL, full_path) | ||
|
||
def get_next_link(self): | ||
if settings.CHORD_URL is not None: | ||
# Monkey-patch rewrite build_absolute_uri | ||
self.request.build_absolute_uri = self._get_chord_absolute_uri | ||
return super(LargeResultsSetPagination, self).get_next_link() | ||
|
||
def get_previous_link(self): | ||
if settings.CHORD_URL is not None: | ||
# Monkey-patch rewrite build_absolute_uri | ||
self.request.build_absolute_uri = self._get_chord_absolute_uri | ||
return super(LargeResultsSetPagination, self).get_previous_link() | ||
|
||
def get_html_context(self): | ||
if settings.CHORD_URL is not None: | ||
# Monkey-patch rewrite build_absolute_uri | ||
self.request.build_absolute_uri = self._get_chord_absolute_uri | ||
super(LargeResultsSetPagination, self).get_html_context() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
import os | ||
import sys | ||
import django | ||
sys.path.insert(0, os.path.abspath('..')) | ||
os.environ['DJANGO_SETTINGS_MODULE'] = 'chord_metadata_service.metadata.settings' | ||
django.setup() | ||
|
||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = 'Metadata service' | ||
copyright = '2020, Ksenia Zaytseva, David Lougheed, Simon Chenard' | ||
author = 'Ksenia Zaytseva, David Lougheed, Simon Chenard' | ||
|
||
# The full version, including alpha/beta/rc tags | ||
release = '0.3.0' | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = ['sphinx.ext.autodoc'] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ['_templates'] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = 'alabaster' | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ['_static'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.. metadata service documentation master file, created by | ||
sphinx-quickstart on Thu Feb 20 15:29:45 2020. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Welcome to metadata service's documentation! | ||
============================================ | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
modules/introduction | ||
modules/installation | ||
modules/models | ||
modules/views | ||
|
||
|
||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=. | ||
set BUILDDIR=_build | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.http://sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Installation | ||
============ | ||
|
||
1. Clone the project from github (use :code:`-r` to fetch submodules content) | ||
|
||
.. code-block:: | ||
git clone https://github.com/c3g/chord_metadata_service.git | ||
2. Install the git submodule for DATS JSON schemas (if you did not clone recursively): | ||
|
||
.. code-block:: | ||
git submodule update --init | ||
3. Create and activate virtual environment | ||
|
||
4. Cd to the main directory and install required packages: | ||
|
||
.. code-block:: | ||
pip install -r requirements.txt | ||
5. The service uses PostgreSQL database for data storage. Install PostgreSQL following `this tutorial <https://www.postgresql.org/docs/12/tutorial-install.html>`_. | ||
|
||
6. Configure database connection in settings.py | ||
|
||
e.g. settings if running database on localhost, default port for PostgreSQL is 5432: | ||
|
||
.. code-block:: python | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
'NAME': 'database_name', | ||
'USER': 'user', | ||
'PASSWORD': 'password', | ||
'HOST': 'localhost', | ||
'PORT': '5432', | ||
} | ||
} | ||
7. From the main directory run (where the manage.py file located): | ||
|
||
.. code-block:: | ||
python manage.py makemigrations | ||
python manage.py migrate | ||
python manage.py runserver | ||
8. Development server runs at :code:`localhost:8000` |
Oops, something went wrong.