Flask-Project-Template/src/core/__init__.py

32 lines
689 B
Python
Raw Normal View History

2020-03-14 22:17:50 +00:00
# Python imports
import secrets
# Lib imports
2019-12-22 19:09:36 +00:00
from flask import Flask
2020-03-14 08:43:04 +00:00
from flask_bcrypt import Bcrypt
from flask_login import current_user, login_user, logout_user, LoginManager
2019-12-22 19:09:36 +00:00
2020-03-14 22:17:50 +00:00
# Apoplication imports
# Configs and 'init'
2019-12-22 19:09:36 +00:00
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///static/db/database.db"
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['TITLE'] = ':::APP TITLE:::'
2020-03-14 22:17:50 +00:00
# For csrf and some other stuff...
app.config['SECRET_KEY'] = secrets.token_hex(32)
2019-12-22 19:09:36 +00:00
2020-03-14 08:43:04 +00:00
login_manager = LoginManager(app)
bcrypt = Bcrypt(app)
from core.models import db, User
db.init_app(app)
from core.forms import RegisterForm, LoginForm
2020-03-06 07:27:02 +00:00
from core import routes