import os, json from werkzeug.contrib.fixers import ProxyFix from flask import Flask, redirect, url_for, send_from_directory from flask_dance.contrib.github import make_github_blueprint, github from os.path import join, isfile, isdir # helpful: # https://tinyurl.com/yddsw4pg PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) STATIC_PATH = 'content' app = Flask(__name__) # this worked locally, but not on heroku app.wsgi_app = ProxyFix(app.wsgi_app) app.secret_key = os.environ.get("FLASK_SECRET_KEY", "9502861d41e8729c5cae3225920b1b46") app.config["RESULT_STATIC_PATH"] = STATIC_PATH #os.path.join(PROJECT_ROOT,STATIC_PATH) app.config["GITHUB_OAUTH_CLIENT_ID"] = os.environ.get("GITHUB_OAUTH_CLIENT_ID") app.config["GITHUB_OAUTH_CLIENT_SECRET"] = os.environ.get("GITHUB_OAUTH_CLIENT_SECRET") github_bp = make_github_blueprint( client_id = os.environ.get('GITHUB_OAUTH_CLIENT_ID'), client_secret = os.environ.get('GITHUB_OAUTH_CLIENT_SECRET'), scope='read:org') app.register_blueprint(github_bp, url_prefix="/login") contents200 = """
You found a public page, so you're safe for now. Run away while you still can.
Otherwise... the attack rabbits may find you yet.
Access Denied!
Attack rabbits, attack! Prepare to meet your fate, sneaky unauthorized intruder, at the hands of one of the nastiest, most horrible, gnashing teeth, and fangs, and little claws like daggers -
The resource you requested could not be found.
The attack rabbits are circling, eyeing you suspiciously.