Skip to content

Commit 6c5e0a0

Browse files
authored
Merge pull request #23 from python-microservices/updated-scaffold-with-last-pyms-version
Updated Scaffold with last changes of pyms version
2 parents 0a2d920 + d85f955 commit 6c5e0a0

File tree

7 files changed

+36
-22
lines changed

7 files changed

+36
-22
lines changed

config-docker.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
pyms:
2+
requests: true
3+
swagger:
4+
path: "swagger"
5+
file: "swagger.yaml"
16
ms:
27
DEBUG: false
38
TESTING: false

config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
pyms:
2+
requests: true
3+
swagger:
4+
path: "swagger"
5+
file: "swagger.yaml"
16
ms:
27
DEBUG: false
38
TESTING: false

manage.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# encoding: utf-8
22
from flask_script import Manager
33

4-
from project import create_app
4+
from project.app import create_app
55

66
app = create_app()
77

project/__init__.py

-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
from pyms.flask.app import Microservice
2-
3-
from project.models.init_db import db
4-
51
__author__ = "Alberto Vara"
62
__email__ = "[email protected]"
73
__version__ = "0.3.1"
8-
9-
10-
class MyMicroservice(Microservice):
11-
def init_libs(self):
12-
db.init_app(self.application)
13-
with self.application.test_request_context():
14-
db.create_all()
15-
16-
17-
def create_app():
18-
"""Initialize the Flask app, register blueprints and intialize all libraries like Swagger, database, the trace system...
19-
return the app and the database objects.
20-
:return:
21-
"""
22-
ms = MyMicroservice(service="ms", path=__file__)
23-
return ms.create_app()

project/app.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from pyms.flask.app import Microservice
2+
3+
from project.models.init_db import db
4+
5+
6+
class MyMicroservice(Microservice):
7+
def init_libs(self):
8+
db.init_app(self.application)
9+
with self.application.test_request_context():
10+
db.create_all()
11+
12+
13+
def create_app():
14+
"""Initialize the Flask app, register blueprints and intialize all libraries like Swagger, database, the trace system...
15+
return the app and the database objects.
16+
:return:
17+
"""
18+
ms = MyMicroservice(service="ms", path=__file__)
19+
return ms.create_app()

tests/config-tests.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
pyms:
2+
requests: true
3+
swagger:
4+
path: "swagger"
5+
file: "swagger.yaml"
16
ms:
27
DEBUG: false
38
TESTING: true

tests/test_views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import unittest
44
from typing import Dict, List, Union, Text
55

6-
from project import MyMicroservice
6+
from project.app import MyMicroservice
77
from pyms.constants import CONFIGMAP_FILE_ENVIRONMENT
88

99

0 commit comments

Comments
 (0)