-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #240 from cubingusa/python3
Rewrite website with python3
- Loading branch information
Showing
345 changed files
with
5,792 additions
and
7,639 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ENV=DEV | ||
WCA_CLIENT_ID='example-application-id' | ||
WCA_CLIENT_SECRET='example-secret' | ||
WCA_HOST='https://staging.worldcubeassociation.org' | ||
SESSION_SECRET_KEY='12340987' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
^(.*/)?#.*#$ | ||
^(.*/)?.*~$ | ||
^(.*/)?.*\.py[co]$ | ||
^(.*/)?\..*$ | ||
external/bootstrap | ||
__pycache__/ | ||
/src/ | ||
/lib/ | ||
.git/ | ||
.gitignore | ||
env/ | ||
.env.dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,10 @@ | ||
runtime: python27 | ||
api_version: 1 | ||
threadsafe: true | ||
skip_files: | ||
- ^(.*/)?#.*#$ | ||
- ^(.*/)?.*~$ | ||
- ^(.*/)?.*\.py[co]$ | ||
- ^(.*/)?\..*$ | ||
- external/bootstrap | ||
- src/scss | ||
runtime: python39 | ||
entrypoint: gunicorn -b :$PORT app:app | ||
|
||
libraries: | ||
- name: webapp2 | ||
version: latest | ||
env_variables: | ||
ENV: "PROD" | ||
WCA_HOST: "https://www.worldcubeassociation.org" | ||
|
||
handlers: | ||
- url: /_ah/queue/deferred | ||
script: google.appengine.ext.deferred.deferred.application | ||
login: admin | ||
- url: /static | ||
static_dir: src/static | ||
secure: always | ||
- url: /scheduling | ||
script: scheduling.app | ||
secure: always | ||
- url: /scheduling/.* | ||
script: scheduling.app | ||
secure: always | ||
- url: /nationals/.* | ||
script: nationals.app | ||
secure: always | ||
- url: /nationals | ||
script: nationals.app | ||
secure: always | ||
- url: /.* | ||
script: cubingusa.app | ||
secure: always | ||
script: auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import datetime | ||
import logging | ||
import os | ||
import sys | ||
|
||
from authlib.integrations.flask_client import OAuth | ||
from dotenv import load_dotenv | ||
from flask import Flask | ||
import google.cloud.logging | ||
|
||
from app.lib.secrets import get_secret | ||
|
||
if os.path.exists('.env.dev'): | ||
load_dotenv('.env.dev') | ||
|
||
if os.environ.get('ENV') == 'PROD': | ||
client = google.cloud.logging.Client() | ||
client.setup_logging() | ||
elif os.environ.get('ENV') == 'DEV' and 'gunicorn' in sys.argv[0]: | ||
logger = logging.getLogger() | ||
logger.setLevel(logging.DEBUG) | ||
handler = logging.StreamHandler(sys.stdout) | ||
formatter = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s') | ||
handler.setFormatter(formatter) | ||
logger.addHandler(handler) | ||
|
||
|
||
app = Flask(__name__) | ||
app.secret_key = get_secret('SESSION_SECRET_KEY') | ||
app.permanent_session_lifetime = datetime.timedelta(days=7) | ||
|
||
wca_host = os.environ.get('WCA_HOST') | ||
oauth = OAuth(app) | ||
oauth.register( | ||
name='wca', | ||
client_id=get_secret('WCA_CLIENT_ID'), | ||
client_secret=get_secret('WCA_CLIENT_SECRET'), | ||
access_token_url=wca_host + '/oauth/token', | ||
access_token_params=None, | ||
authorize_url=wca_host + '/oauth/authorize', | ||
authorize_params=None, | ||
api_base_url=wca_host + '/api/v0/', | ||
client_kwargs={'scope': 'public email'}, | ||
) | ||
|
||
from app.handlers.admin import bp as admin_bp | ||
from app.handlers.auth import create_bp as create_auth_bp | ||
from app.handlers.champions_table import bp as champions_table_bp | ||
from app.handlers.nationals import bp as nationals_bp | ||
from app.handlers.regional import bp as regional_bp | ||
from app.handlers.state_rankings import bp as state_rankings_bp | ||
from app.handlers.static import bp as static_bp | ||
from app.handlers.user import bp as user_bp | ||
|
||
app.register_blueprint(admin_bp) | ||
app.register_blueprint(create_auth_bp(oauth)) | ||
app.register_blueprint(champions_table_bp) | ||
app.register_blueprint(nationals_bp) | ||
app.register_blueprint(regional_bp) | ||
app.register_blueprint(state_rankings_bp) | ||
app.register_blueprint(static_bp) | ||
app.register_blueprint(user_bp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from flask import Blueprint | ||
|
||
from app.handlers.admin.edit_championships import bp as edit_championships_bp | ||
from app.handlers.admin.edit_users import bp as edit_users_bp | ||
from app.handlers.admin.states import bp as states_bp | ||
|
||
bp = Blueprint('admin', __name__, url_prefix='/admin') | ||
bp.register_blueprint(edit_championships_bp) | ||
bp.register_blueprint(edit_users_bp) | ||
bp.register_blueprint(states_bp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.