Fixed database connection issue
This commit is contained in:
parent
f903f9d060
commit
dd8685b103
@ -1,4 +1,8 @@
|
|||||||
from .modules import bootstrap, csrf, db, login_manager, mail
|
from .modules.bootstrap import bootstrap
|
||||||
|
from .modules.csrf import csrf
|
||||||
|
from .modules.db import db
|
||||||
|
from .modules.login_manager import login_manager
|
||||||
|
from .modules.mail import mail
|
||||||
from .config import DevelopmentConfig as Config
|
from .config import DevelopmentConfig as Config
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
@ -5,12 +5,12 @@ from pathlib import Path
|
|||||||
|
|
||||||
class Config(object):
|
class Config(object):
|
||||||
APP_HOST = '0.0.0.0'
|
APP_HOST = '0.0.0.0'
|
||||||
DATA_FILE_DIRECTORY = os.getenv('DATA_FILE_DIRECTORY')
|
DATA = os.getenv('DATA')
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
TESTING = False
|
TESTING = False
|
||||||
SECRET_KEY = os.getenv('SECRET_KEY')
|
SECRET_KEY = os.getenv('SECRET_KEY')
|
||||||
SESSION_COOKIE_SECURE = True
|
SESSION_COOKIE_SECURE = True
|
||||||
SQLALCHEMY_DATABASE_URI = f'sqlite:///{Path(DATA_FILE_DIRECTORY)}/database.db'
|
SQLALCHEMY_DATABASE_URI = f'sqlite:///{Path(DATA)}/database.db'
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
|
|
||||||
MAIL_SERVER = os.getenv('MAIL_SERVER')
|
MAIL_SERVER = os.getenv('MAIL_SERVER')
|
||||||
|
@ -2,4 +2,4 @@ from . import Config
|
|||||||
from os import path
|
from os import path
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
data = Path(Config.DATA_FILE_DIRECTORY)
|
data = Path(Config.DATA)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from main import app
|
from main import app
|
||||||
from . import Config
|
from . import Config
|
||||||
from .data import data
|
from .data import data
|
||||||
from .modules import db
|
from .modules.db import db
|
||||||
from .tools.data import save
|
from .tools.data import save
|
||||||
from .tools.logs import write
|
from .tools.logs import write
|
||||||
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
from flask_bootstrap import Bootstrap
|
|
||||||
bootstrap = Bootstrap()
|
|
||||||
from flask_wtf.csrf import CSRFProtect
|
|
||||||
csrf = CSRFProtect()
|
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
|
||||||
db = SQLAlchemy()
|
|
||||||
from flask_login import LoginManager
|
|
||||||
login_manager = LoginManager()
|
|
||||||
from flask_mail import Mail
|
|
||||||
mail = Mail()
|
|
0
ref-test/app/modules/__init__.py
Normal file
0
ref-test/app/modules/__init__.py
Normal file
2
ref-test/app/modules/bootstrap.py
Normal file
2
ref-test/app/modules/bootstrap.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
from flask_bootstrap import Bootstrap
|
||||||
|
bootstrap = Bootstrap()
|
2
ref-test/app/modules/csrf.py
Normal file
2
ref-test/app/modules/csrf.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
from flask_wtf.csrf import CSRFProtect
|
||||||
|
csrf = CSRFProtect()
|
2
ref-test/app/modules/db.py
Normal file
2
ref-test/app/modules/db.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
db = SQLAlchemy()
|
2
ref-test/app/modules/login_manager.py
Normal file
2
ref-test/app/modules/login_manager.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
from flask_login import LoginManager
|
||||||
|
login_manager = LoginManager()
|
2
ref-test/app/modules/mail.py
Normal file
2
ref-test/app/modules/mail.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
from flask_mail import Mail
|
||||||
|
mail = Mail()
|
Loading…
Reference in New Issue
Block a user