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