mirror of
https://github.com/Xevion/runnerspace.git
synced 2025-12-06 03:16:21 -06:00
Fix circular imports issue by separating SQLAlchemy db instance into database.py
This commit is contained in:
5
app.py
5
app.py
@@ -9,8 +9,7 @@ from flask import Flask, render_template, request
|
||||
from flask_login import LoginManager, current_user
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from werkzeug.security import generate_password_hash
|
||||
|
||||
db = SQLAlchemy()
|
||||
from database import db
|
||||
|
||||
|
||||
def create_app():
|
||||
@@ -25,7 +24,7 @@ def create_app():
|
||||
# Heroku deployment
|
||||
if app.config['ENV'] == 'production':
|
||||
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY')
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL').replace('postgres://', 'postgresql://', 1)
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL', '').replace('postgres://', 'postgresql://', 1)
|
||||
|
||||
db.init_app(app)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user