You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/structure.rst
+25-37
Original file line number
Diff line number
Diff line change
@@ -5,21 +5,17 @@ You have a project with this structure:
5
5
6
6
.. code-block:: bash
7
7
8
-
manager.py
8
+
Dockerfile
9
+
LICENSE
10
+
manage.py
11
+
README.md
9
12
requirements.txt
10
13
requirements-tests.txt
11
14
requirements-docker.txt
15
+
service.yaml
12
16
setup.py
17
+
tests.sh
13
18
tox.ini
14
-
myms
15
-
├ healthcheck
16
-
│ └ healthcheck.py
17
-
├ logger
18
-
│ └ logger.py
19
-
├ models
20
-
│ └ __init__.py
21
-
└ tracer
22
-
└ main.py
23
19
project
24
20
├ __init__.py
25
21
├ config.py
@@ -33,7 +29,8 @@ You have a project with this structure:
33
29
└views
34
30
├ __init__.py
35
31
└ views.py
36
-
32
+
docs/
33
+
tests/
37
34
38
35
39
36
manager.py
@@ -51,43 +48,34 @@ You can set the host and the port with:
51
48
52
49
python manage.py runserver -h 0.0.0.0 -p 8080
53
50
54
-
Common Structure
51
+
Common Libraries
55
52
----------------
56
53
57
-
myms/healthcheck/healthcheck.py
58
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
-
This views is usually used by Kubernetes, Eureka and other systems to check if our application is up and running
54
+
py-ms is a library that contains a set of common features for microservices.
60
55
61
-
myms/logger/logger.py
62
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63
-
Print logger in JSON format to send to server like Elasticsearch. Inject span traces in logger
56
+
Structure of a project
57
+
----------------------
64
58
65
-
myms/models/__init__.py
66
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67
-
Initizalize `flask_sqlalchemy.SQLAlchemy object`
59
+
For project configuration see :doc:`configuration </configuration>` section.
68
60
69
-
myms/tracer/main.py
61
+
project/models/init_db.py
70
62
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71
-
Create an injector `flask_opentracing.FlaskTracer` to use in our projects
72
-
73
-
Structure of a project
74
-
----------------------
63
+
Initialize `flask_sqlalchemy.SQLAlchemy object`.
75
64
76
-
project/__init__.py
77
-
~~~~~~~~~~~~~~~~~~~
78
-
This file init the project with the funcion `create_app`. Initialize the Flask app, register `blueprints <http://flask.pocoo.org/docs/0.12/blueprints/>`_
79
-
and intialize all libraries like Swagger, database, the trace system...
65
+
project/models/models.py
66
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67
+
Project specific models.
80
68
81
-
project/config.py
82
-
~~~~~~~~~~~~~~~~~
83
-
See :doc:`configuration </configuration>` section
69
+
project/swagger/swagger.yaml
70
+
~~~~~~~~~~~~~
71
+
Use to define your rest behaviour, endpoints and routes. See `connexion <http://connexion.readthedocs.io>`_ docs to how add new views.
84
72
85
73
project/views
86
74
~~~~~~~~~~~~~
87
75
use views.py or create your file.
88
76
89
-
swagger/swagger.yaml
90
-
~~~~~~~~~~~~~
91
-
Use to define your rest behaviour, endpoints and routes. See `connexion<http://connexion.readthedocs.io>`_ docs to how add new views
92
-
77
+
project/__init__.py
78
+
~~~~~~~~~~~~~~~~~~~
79
+
This file init the project calling `create_app` method. Initialize the Flask app, register `blueprints<http://flask.pocoo.org/docs/0.12/blueprints/>`_
80
+
and initialize all libraries like Swagger, database, trace system, custom logger format, etc.
0 commit comments