Skip to content

Instantly share code, notes, and snippets.

@taiwotman
Last active April 30, 2020 16:24
Show Gist options
  • Save taiwotman/e0a0b17dd492d011e4a7e03a5de8dd64 to your computer and use it in GitHub Desktop.
Save taiwotman/e0a0b17dd492d011e4a7e03a5de8dd64 to your computer and use it in GitHub Desktop.
Flasklogin-Neo4j key files
"""Initialize app."""
from flask import Flask
from .flask_py2neo import Py2Neo
from flask_login import LoginManager
from . import routes
from . import auth
db = Py2Neo()
login_manager = LoginManager()
def create_app():
"""Construct the core application."""
app = Flask(__name__, instance_relative_config=False)
# Application Configuration
app.config.from_object('config.Config')
# Initialize Plugins
db.init_app(app)
login_manager.init_app(app)
with app.app_context():
from . import routes
from . import auth
# Register Blueprints
app.register_blueprint(routes.main_bp)
app.register_blueprint(auth.auth_bp)
# Create unique index constraint
try:
db.graph.schema.create_uniqueness_constraint("User", "email")
except:
pass
return app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment