You've already forked bthlabs-jsonrpc
Initial public releases
* `bthlabs-jsonrpc-aiohttp` v1.0.0 * `bthlabs-jsonrpc-core` v1.0.0 * `bthlabs-jsonrpc-django` v1.0.0
This commit is contained in:
20
packages/bthlabs-jsonrpc-django/docs/Makefile
Normal file
20
packages/bthlabs-jsonrpc-django/docs/Makefile
Normal file
@@ -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 = source
|
||||
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)
|
||||
21
packages/bthlabs-jsonrpc-django/docs/source/api.rst
Normal file
21
packages/bthlabs-jsonrpc-django/docs/source/api.rst
Normal file
@@ -0,0 +1,21 @@
|
||||
API Documentation
|
||||
=================
|
||||
|
||||
.. module:: bthlabs_jsonrpc_django
|
||||
|
||||
This section provides the API documentation for BTHLabs JSONRPC - Core.
|
||||
|
||||
Auth checks
|
||||
-----------
|
||||
|
||||
.. autofunction:: has_perms
|
||||
|
||||
.. autofunction:: is_authenticated
|
||||
|
||||
.. autofunction:: is_staff
|
||||
|
||||
Views
|
||||
-----
|
||||
|
||||
.. autoclass:: JSONRPCView
|
||||
:members: as_view, auth_checks, can_call, namespace
|
||||
57
packages/bthlabs-jsonrpc-django/docs/source/conf.py
Normal file
57
packages/bthlabs-jsonrpc-django/docs/source/conf.py
Normal file
@@ -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
|
||||
sys.path.insert(0, os.path.abspath('../../'))
|
||||
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = 'BTHLabs JSONRPC - Django'
|
||||
copyright = '2022-present Tomek Wójcik'
|
||||
author = 'Tomek Wójcik'
|
||||
version = '1.0.0'
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = '1.0.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 = []
|
||||
|
||||
|
||||
# -- 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 = 'sphinx_rtd_theme'
|
||||
|
||||
# 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']
|
||||
17
packages/bthlabs-jsonrpc-django/docs/source/index.rst
Normal file
17
packages/bthlabs-jsonrpc-django/docs/source/index.rst
Normal file
@@ -0,0 +1,17 @@
|
||||
BTHLabs JSONRPC - Django
|
||||
========================
|
||||
|
||||
BTHLabs JSONRPC is a set of Python libraries that provide extensible framework
|
||||
for adding JSONRPC interfaces to existing Python Web applications.
|
||||
|
||||
The *django* package provides Django integration.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
overview
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
api
|
||||
57
packages/bthlabs-jsonrpc-django/docs/source/overview.rst
Normal file
57
packages/bthlabs-jsonrpc-django/docs/source/overview.rst
Normal file
@@ -0,0 +1,57 @@
|
||||
Overview
|
||||
========
|
||||
|
||||
This section provides the general overview of the integration.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
$ pip install bthlabs_jsonrpc_django
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
First, you'll need to enable the application by adding it to
|
||||
``INSTALLED_APPS``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# settings.py
|
||||
INSTALLED_APPS = [
|
||||
# ...
|
||||
'bthlabs_jsonrpc_django',
|
||||
]
|
||||
|
||||
Then, you'll need to add your RPC method modules to ``JSONRPC_METHOD_MODULES``
|
||||
setting:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# settings.py
|
||||
JSONRPC_METHOD_MODULES = [
|
||||
# ...
|
||||
'your_app.rpc_methods',
|
||||
]
|
||||
|
||||
After that, you'll need to add a JSONRPC view to your project's URLs:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# urls.py
|
||||
urlpatterns = [
|
||||
# ...
|
||||
path('rpc', JSONRPCView.as_view()),
|
||||
]
|
||||
|
||||
Last but not least, you'll need to implement the RPC method modules:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# your_app/rpc_methods.py
|
||||
from bthlabs_jsonrpc_core import register_method
|
||||
|
||||
@register_method(name='hello')
|
||||
def hello(request, who='World'):
|
||||
return f'Hello, {who}!'
|
||||
Reference in New Issue
Block a user