Add single container docs page

This commit is contained in:
Roman Mogylatov 2020-09-04 17:58:49 -04:00
parent 04f22e6152
commit 4c5a5192b0
13 changed files with 113 additions and 91 deletions

View File

@ -0,0 +1,22 @@
Other examples
==============
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control
:description: Current section of documentation is designed to provide
several example mini applications that are built on the top
of inversion of control principle and powered by
"Dependency Injector" framework.
Current section of documentation is designed to provide several example mini
applications that are built according to the inversion of control principle
and powered by *Dependency Injector* framework.
.. toctree::
:maxdepth: 2
bundles_miniapp
use_cases_miniapp
password_hashing_miniapp
chained_factories
factory_of_factories

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -2,23 +2,13 @@ Examples
========
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control
:description: Current section of documentation is designed to provide
several example mini applications that are built on the top
of inversion of control principle and powered by
"Dependency Injector" framework.
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Example
:description: Python dependency injection examples.
Current section of documentation is designed to provide several example mini
applications that are built according to the inversion of control principle
and powered by *Dependency Injector* framework.
Explore the examples to see the ``Dependency Injector`` in action.
.. toctree::
:maxdepth: 2
services_miniapp_v1
services_miniapp_v2
bundles_miniapp
use_cases_miniapp
password_hashing_miniapp
chained_factories
factory_of_factories
services-single-container
services-multiple-containers

View File

@ -1,5 +1,5 @@
Services mini application example (v2 - single container)
---------------------------------------------------------
Services mini application example (multiple containers)
=======================================================
.. meta::
:description: "Services miniapp" is an example mini application that

View File

@ -0,0 +1,82 @@
Services mini application example (single container)
====================================================
.. meta::
:description: "Services miniapp" is an example mini application that
consists from several services that have dependencies on
some standard and 3rd-party libraries for logging,
interaction with database and remote service via API.
"Services miniapp" example demonstrates usage of
Dependency Injector for creating several inversion of control /
dependency injection containers.
"Services" is an example mini application. It consists from several services that have
dependencies on database & AWS S3.
.. image:: images/services-miniapp.png
:width: 100%
:align: center
Start from the scratch or jump to the section:
.. contents::
:local:
:backlinks: none
Application structure
---------------------
Application consists from ``example`` package, several configuration files and ``requirements.txt``.
.. code-block:: bash
./
├── example/
│ ├── __init__.py
│ ├── __main__.py
│ ├── containers.py
│ └── services.py
├── config.ini
├── logging.ini
└── requirements.txt
Container
---------
Listing of ``example/containers.py``:
.. literalinclude:: ../../examples/miniapps/services-single-container/example/containers.py
:language: python
Listing of ``example/__main__.py``:
.. literalinclude:: ../../examples/miniapps/services-single-container/example/__main__.py
:language: python
Services
--------
Listing of ``example/services.py``:
.. literalinclude:: ../../examples/miniapps/services-single-container/example/services.py
:language: python
Configuration
-------------
Listing of ``config.ini``:
.. literalinclude:: ../../examples/miniapps/services-single-container/config.ini
:language: ini
Listing of ``logging.ini``:
.. literalinclude:: ../../examples/miniapps/services-single-container/logging.ini
:language: ini
Sources on Github
-----------------
To find the source code navigate to the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/services-single-container>`_.
.. disqus::

View File

@ -1,73 +0,0 @@
Services mini application example (v1 - multiple containers)
------------------------------------------------------------
.. meta::
:description: "Services miniapp" is an example mini application that
consists from several services that have dependencies on
some standard and 3rd-party libraries for logging,
interaction with database and remote service via API.
"Services miniapp" example demonstrates usage of
Dependency Injector for creating several inversion of control /
dependency injection containers.
"Services miniapp" is an example mini application that consists from several
services that have dependencies on some standard and 3rd-party libraries for
logging, interaction with database and remote service calls via API.
"Services miniapp" example demonstrates usage of
:doc:`Dependency Injector <../index>` for creating several IoC containers.
Instructions for running:
.. code-block:: bash
python run.py 1 secret photo.jpg
Example application
~~~~~~~~~~~~~~~~~~~
Classes diagram:
.. image:: /images/miniapps/services/classes.png
:width: 100%
:align: center
Example application structure:
.. code-block:: bash
/example
/__init__.py
/main.py
/services.py
Listing of ``example/services.py``:
.. literalinclude:: ../../examples/miniapps/services_v1/example/services.py
:language: python
Listing of ``example/main.py``:
.. literalinclude:: ../../examples/miniapps/services_v1/example/main.py
:language: python
IoC containers
~~~~~~~~~~~~~~
Listing of ``containers.py``:
.. literalinclude:: ../../examples/miniapps/services_v1/containers.py
:language: python
Run application
~~~~~~~~~~~~~~~
Listing of ``run.py``:
.. literalinclude:: ../../examples/miniapps/services_v1/run.py
:language: python
.. disqus::

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

View File

@ -131,9 +131,10 @@ Contents
introduction/index
main/installation
tutorials/index
examples/index
providers/index
containers/index
examples/index
examples-other/index
api/index
main/feedback
main/changelog