Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
"""This module creates the flask extensions that we will use."""
from flask_login import LoginManager
login_manager = LoginManager()
# -*- coding: utf-8 -*-
"""This module contains initialization code for the api package."""
from flask import Flask, redirect, url_for
from flask_dance.contrib.github import github
from api.helpers import set_flask_environment
from .blueprints.auth.views import auth
from .blueprints.default.views import default
from .blueprints.extensions import db
# -*- coding: utf-8 -*-
"""This module contains the routes associated with the auth Blueprint."""
import os
from flask_dance.contrib.github import make_github_blueprint, github
from flask_dance.consumer.storage.sqla import SQLAlchemyStorage
from flask_login import current_user
from .models import OAuth, User
from ..extensions import db
from flask_dance.consumer import oauth_authorized
# -*- coding: utf-8 -*-
"""This module contains the routes associated with the default Blueprint."""
from flask import Blueprint, jsonify
from flask_login import login_required, logout_user
default = Blueprint('default', __name__, template_folder='templates', static_folder='static')
@default.route('/')
def default_route():
# -*- coding: utf-8 -*-
"""This module contains the routes associated with the auth Blueprint."""
import os
from flask_dance.contrib.github import make_github_blueprint
from flask_dance.consumer.storage.sqla import SQLAlchemyStorage
from flask_login import current_user
from .models import OAuth
from ..extensions import db
# -*- coding: utf-8 -*-
"""This module contain the confuguration for the application."""
import os
class BaseConfig():
"""Base configuration."""
SECRET_KEY = os.environ['SECRET_KEY']
DEBUG = False
CLIENT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OAUTHLIB_INSECURE_TRANSPORT=1
FLASK_ENV=development
SECRET_KEY=supersecretkey
SQLALCHEMY_DATABASE_URI=sqlite:///users.db
# -*- coding: utf-8 -*-
"""This module creates the flask extensions that we will use."""
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
# -*- coding: utf-8 -*-
"""This module contains the database models used by the auth blueprint."""
from dataclasses import dataclass
from flask_dance.consumer.storage.sqla import OAuthConsumerMixin
from flask_login import UserMixin
from ..extensions import db
blinker==1.4
flask==2.0.3
flask-dance==6.0.0
flask-login==0.6.1
flask-sqlalchemy==2.5.1
gunicorn==20.1.0
python-dotenv==0.20.0
setuptools==62.1.0