-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
36 lines (29 loc) · 958 Bytes
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from decouple import config
from flask import Flask
from flask_cors import CORS
from flask_migrate import Migrate
from flask_restful import Api
from db import db
from resources.routes import routes
class DevApplicationConfiguration:
DEBUG = True
TESTING = True
SQLALCHEMY_DATABASE_URI = (
f"postgresql://{config('DB_USER')}:{config('DB_PASSWORD')}"
f"@{config('DB_HOST')}/{config('DB_NAME')}"
)
# class TestApplicationConfiguration:
# DEBUG = True
# TESTING = True
# SQLALCHEMY_DATABASE_URI = (
# f"postgresql://{config('DB_USER')}:{config('DB_PASSWORD')}"
# f"@localhost:{config('DB_PORT')}/{config('TEST_DB_NAME')}"
# )
def create_app(config="config.DevApplicationConfiguration"):
app = Flask(__name__)
app.config.from_object(DevApplicationConfiguration)
migrate = Migrate(app, db)
CORS(app)
api = Api(app)
[api.add_resource(*r) for r in routes]
return app