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
+43-8Lines changed: 43 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,26 @@ You have a project with this structure:
6
6
.. code-block:: bash
7
7
8
8
manager.py
9
+
requirements.txt
10
+
requirements-tests.txt
11
+
requirements-docker.txt
12
+
setup.py
13
+
tox.ini
14
+
myms
15
+
├ healthcheck
16
+
│ └ healthcheck.py
17
+
├ logger
18
+
│ └ logger.py
19
+
├ models
20
+
│ └ __init__.py
21
+
└ tracer
22
+
└ main.py
9
23
project
10
24
├ __init__.py
11
25
├ config.py
12
26
├ views
13
27
│ ├ __init__.py
14
-
│ ├ views.py
15
-
│ └ healthcheck.py
28
+
│ └ views.py
16
29
├ models
17
30
│ ├ __init__.py
18
31
│ └ models.py
@@ -25,26 +38,48 @@ manager.py
25
38
A Django style command line. Use this to start the application like:
26
39
27
40
.. code-block:: bash
41
+
28
42
python manage.py runserver
29
43
30
44
You can set the host and the port with:
31
45
32
46
.. code-block:: bash
47
+
33
48
python manage.py runserver -h 0.0.0.0 -p 8080
34
49
50
+
Common Structure
51
+
----------------
52
+
53
+
myms/healthcheck/healthcheck.py
54
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55
+
This views is usually used by Kubernetes, Eureka and other systems to check if our application is up and running
56
+
57
+
myms/logger/logger.py
58
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
+
Print logger in JSON format to send to server like Elasticsearch. Inject span traces in logger
60
+
61
+
myms/models/__init__.py
62
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63
+
Initizalize `flask_sqlalchemy.SQLAlchemy object`
64
+
65
+
myms/tracer/main.py
66
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67
+
Create an injector `flask_opentracing.FlaskTracer` to use in our projects
68
+
69
+
Structure of a project
70
+
----------------------
71
+
35
72
project/__init__.py
36
-
-------------------
73
+
~~~~~~~~~~~~~~~~~~~
37
74
This file init the project with the funcion `create_app`. Initialize the Flask app, register `blueprints <http://flask.pocoo.org/docs/0.12/blueprints/>`_
38
75
and intialize all libraries like Swagger, database, the trace system...
39
76
40
77
project/config.py
41
-
-----------------
78
+
~~~~~~~~~~~~~~~~~
42
79
See :doc:`configuration </configuration>` section
43
80
44
81
project/views
45
-
-------------
82
+
~~~~~~~~~~~~~
46
83
use views.py or create your file. You must add after register the view blueprint in `project/views/__init__.py`.
47
84
48
-
project/views/healthcheck.py
49
-
----------------------------
50
-
This views is usually used by Kubernetes, Eureka and other systems to check if our application is up and running
0 commit comments