-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
29 lines (23 loc) · 849 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
import pathlib
import connexion
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
import urllib.parse
basedir = pathlib.Path(__file__).parent.resolve()
connex_app = connexion.App(__name__, specification_dir=basedir)
LOCAL = False
server = "localhost" if LOCAL else "dist-6-505.uopnet.plymouth.ac.uk"
database = "master" if LOCAL else 'COMP2001_BMannino'
username = "SA" if LOCAL else "BMannino"
driver = "ODBC+Driver+17+for+SQL+Server"
password = "C0mp2001!" if LOCAL else "SofP734+"
app = connex_app.app
app.config["SQLALCHEMY_DATABASE_URI"] = (
f"mssql+pyodbc://{username}:{urllib.parse.quote_plus(password)}@{server}/{database}"
f"?driver={driver}"
'&Encrypt=yes'
'&TrustServerCertificate=Yes'
)
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
db = SQLAlchemy(app)
ma = Marshmallow(app)