mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-11 08:32:26 +03:00
Add use cases miniapp to docs
This commit is contained in:
parent
1f409982b9
commit
ce6267f6f8
|
@ -18,3 +18,4 @@ and powered by *Dependency Injector* framework.
|
||||||
movie_lister
|
movie_lister
|
||||||
services_miniapp
|
services_miniapp
|
||||||
bundles_miniapp
|
bundles_miniapp
|
||||||
|
use_cases_miniapp
|
||||||
|
|
57
docs/examples/use_cases_miniapp.rst
Normal file
57
docs/examples/use_cases_miniapp.rst
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
Use cases mini application example
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
.. currentmodule:: dependency_injector.providers
|
||||||
|
|
||||||
|
"Use cases" miniapp demonstrate usage of :py:class:`DependenciesContainer`
|
||||||
|
provider.
|
||||||
|
|
||||||
|
Example application
|
||||||
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
"Use cases" mini application has next structure:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
use_cases/
|
||||||
|
example/ <-- Example package
|
||||||
|
__init__.py
|
||||||
|
adapters.py
|
||||||
|
use_cases.py
|
||||||
|
containers.py <-- Dependency injection containers
|
||||||
|
run.py <-- Entrypoint
|
||||||
|
|
||||||
|
|
||||||
|
IoC containers
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Listing of ``use_cases/containers.py``:
|
||||||
|
|
||||||
|
.. literalinclude:: ../../examples/miniapps/use_cases/containers.py
|
||||||
|
:language: python
|
||||||
|
:linenos:
|
||||||
|
|
||||||
|
Run application
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Listing of ``run.py``:
|
||||||
|
|
||||||
|
.. literalinclude:: ../../examples/miniapps/use_cases/run.py
|
||||||
|
:language: python
|
||||||
|
:linenos:
|
||||||
|
|
||||||
|
Instructions for running:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
python run.py prod example@example.com # Running in "production" environment
|
||||||
|
python run.py test example@example.com # Running in "testing" environment
|
||||||
|
|
||||||
|
Links
|
||||||
|
~~~~~
|
||||||
|
|
||||||
|
+ `Dependency Injector <https://github.com/ets-labs/python-dependency-injector/>`_
|
||||||
|
+ `Full example sources <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/use_cases>`_
|
||||||
|
|
||||||
|
|
||||||
|
.. disqus::
|
|
@ -5,5 +5,5 @@ Instructions for running
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
python run.py prod example@example.com
|
python run.py prod example@example.com # Running in "production" environment
|
||||||
python run.py test example@example.com
|
python run.py test example@example.com # Running in "testing" environment
|
||||||
|
|
Loading…
Reference in New Issue
Block a user