Skip to content

Commit 038f1eb

Browse files
author
App Generator
committed
Phase 2 - Integrate SQLAlchemy (No tables Yet)
1 parent 545f21a commit 038f1eb

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

app/__init__.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,31 @@
33
Copyright (c) 2019 - present AppSeed.us
44
"""
55

6-
# import Flask
6+
# Import core packages
7+
import os
8+
9+
# Import Flask
710
from flask import Flask
11+
from flask_sqlalchemy import SQLAlchemy
12+
13+
# Grabs the folder where the script runs.
14+
basedir = os.path.abspath(os.path.dirname(__file__))
815

916
# Inject Flask magic
1017
app = Flask(__name__)
1118

1219
# App Config - the minimal footprint
13-
app.config['TESTING' ] = True
14-
app.config['SECRET_KEY'] = 'S#perS3crEt_JamesBond'
20+
app.config['TESTING'] = True
21+
22+
# Set up the App SECRET_KEY
23+
SECRET_KEY = 'S_U_perS3crEt_KEY#9999'
24+
25+
# SQLAlchemy Settings
26+
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'db.sqlite3')
27+
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
28+
29+
# Construct the DB Object (SQLAlchemy interface)
30+
db = SQLAlchemy (app)
1531

1632
# Import routing to render the pages
1733
from app import views

0 commit comments

Comments
 (0)