Initial commit.
This commit is contained in:
commit
189f73b7c2
34 changed files with 1064 additions and 0 deletions
37
__init__.py
Normal file
37
__init__.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from urllib.parse import quote_plus
|
||||
import logging
|
||||
|
||||
db = SQLAlchemy()
|
||||
|
||||
logger = logging.getLogger('sqlalchemy.engine')
|
||||
logger.setLevel(logging.INFO)
|
||||
handler = logging.StreamHandler()
|
||||
handler.setFormatter(logging.Formatter('%(asctime)s [%(levelname)s] %(message)s'))
|
||||
logger.addHandler(handler)
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
|
||||
params = quote_plus(
|
||||
"DRIVER=ODBC Driver 17 for SQL Server;"
|
||||
"SERVER=NDVASQLCR01;"
|
||||
"DATABASE=conradTest;"
|
||||
"Trusted_Connection=yes;"
|
||||
)
|
||||
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = f"mssql+pyodbc:///?odbc_connect={params}"
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
|
||||
db.init_app(app)
|
||||
|
||||
from .routes import main
|
||||
app.register_blueprint(main)
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return "Hello, you've reached the terrible but functional root of the site."
|
||||
|
||||
|
||||
return app
|
Loading…
Add table
Add a link
Reference in a new issue