-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
108 lines (84 loc) · 3.22 KB
/
Copy pathapp.py
File metadata and controls
108 lines (84 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
from flask import Flask, render_template, session, redirect, url_for
from models import Challenge, Alchemy, Hacker, Team, Event
from dotenv import load_dotenv
from flask_wtf.csrf import CSRFProtect
from sqlmodel import create_engine, Session
import redis
import os
import uuid
from pyfiglet import Figlet
load_dotenv('.env')
app = Flask(__name__)
app.config['REDIS_URL='] = os.environ.get('REDIS_URL')
app.config['REDIS_PORT'] = os.environ.get('REDIS_PORT')
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY')
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('SQLALCHEMY_DATABASE_URI')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
csrf = CSRFProtect(app)
db_engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'], echo=True)
redis_cl = redis.Redis(host='localhost', port=6380, db=0, decode_responses=True)
def ascii_art_text():
hackerboard_text = 'H a c k e r b o a r d'
figlet_font = Figlet(font="banner3-D", width=400)
return figlet_font.renderText(hackerboard_text)
@app.route('/')
def home():
return render_template('index.html', ascii_art_text=ascii_art_text())
@app.route('/hello', methods=['GET', 'POST'])
def hello():
#sign in
return render_template('hello.html', ascii_art_text=ascii_art_text())
@app.route('/hello-again')
def hello_again():
return render_template('hello-again.html', ascii_art_text=ascii_art_text())
@app.route('/goodbye')
def goodbye():
pass
@app.route('/dashboard')
def dashboard():
return render_template('dashboard.html', ascii_art_text=ascii_art_text())
@app.route('/teams')
def teams():
return render_template('teams.html', ascii_art_text=ascii_art_text())
@app.route('/team/<team_name>')
def team(team_name):
return render_template('team.html', ascii_art_text=ascii_art_text())
@app.route('/join/team/<team_name>')
def join_team():
pass
@app.route('/team/<team_name>/invite', methods=['GET', 'POST'])
def team_invitation(team_name):
return render_template('team_invitation.html', ascii_art_text=ascii_art_text(), team_name=team_name.capitalize())
@app.route('/events')
def events():
return render_template('events.html', ascii_art_text=ascii_art_text())
@app.route('/event/<event_name>')
@app.route('/event/<event_name>/')
def event(event_name):
return render_template('event.html', ascii_art_text=ascii_art_text())
@app.route('/join/event/<event_id>')
def join_event(event_id):
pass
@app.route('/hackers')
def hackers():
return render_template('hackers.html', ascii_art_text=ascii_art_text())
@app.route('/hacker/<handle>')
def hacker(handle):
return render_template('hacker.html', ascii_art_text=ascii_art_text())
@app.route('/challenges')
def challenges():
return render_template('challenges.html', ascii_art_text=ascii_art_text())
@app.route('/challenge/<challenge_number>')
def challenge():
pass
@app.route('/submit/challenge/<challenge_number>', methods=['POST'])
def submit_challenge(challenge_number):
pass
@app.route('/change/challenge/<challenge_number>', methods=['GET', 'POST'])
def change_challenge(challenge_number):
pass
@app.route('/profile', methods=['GET', 'POST'])
def profile():
return render_template('profile.html', ascii_art_text=ascii_art_text())
if __name__ == '__main__':
app.run(debug=True)