| Total Complexity | 6 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from flask import Flask, render_template |
||
| 2 | from flask_sqlalchemy import SQLAlchemy |
||
| 3 | |||
| 4 | app = Flask(__name__) |
||
| 5 | app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///bday.db' |
||
| 6 | app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False |
||
| 7 | db = SQLAlchemy(app) |
||
| 8 | |||
| 9 | |||
| 10 | # DB Model |
||
| 11 | class User(db.Model): |
||
| 12 | id = db.Column(db.Integer, primary_key=True, autoincrement=True) |
||
| 13 | pseudo = db.Column(db.String(32)) |
||
| 14 | password = db.Column(db.String(128)) |
||
| 15 | birthday = db.Column(db.Date, default=None) |
||
| 16 | |||
| 17 | |||
| 18 | class Birthday(db.Model): |
||
| 19 | id = db.Column(db.Integer, primary_key=True) |
||
| 20 | user_id = db.Column(db.Integer, primary_key=True) |
||
| 21 | person_name = db.Column(db.String(32)) |
||
| 22 | person_birthday = db.Column(db.Date) |
||
| 23 | |||
| 24 | |||
| 25 | @app.route('/') |
||
| 26 | def index_page(): |
||
| 27 | return render_template('index.html') |
||
| 28 | |||
| 29 | |||
| 30 | @app.route('/auth/login') |
||
| 31 | def login_page(): |
||
| 32 | return render_template('auth/login.html') |
||
| 33 | |||
| 34 | |||
| 35 | @app.route('/auth/register') |
||
| 36 | def register_page(): |
||
| 37 | return render_template('auth/register.html') |
||
| 38 | |||
| 39 | |||
| 40 | @app.route('/dashboard') |
||
| 41 | def dashboard_page(): |
||
| 42 | return render_template('dashboard.html') |
||
| 43 | |||
| 44 | |||
| 45 | @app.route('/auth/delete') |
||
| 46 | def delete_account_page(): |
||
| 47 | return render_template('auth/delete.html') |
||
| 48 | |||
| 49 | |||
| 50 | @app.route('/legal') |
||
| 51 | def legal_page(): |
||
| 52 | return render_template('legal.html') |
||
| 53 | |||
| 54 | |||
| 55 | if __name__ == '__main__': |
||
| 56 | db.create_all() |
||
| 57 | app.run(debug=True) |
||
| 58 |