mirror of
https://github.com/Xevion/runnerspace.git
synced 2025-12-15 00:13:00 -06:00
basic main.py and routes added
This commit is contained in:
23
flash_auth_app/project/__init__.py
Normal file
23
flash_auth_app/project/__init__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
# init SQLAlchemy
|
||||
db = SQLAlchemy()
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
|
||||
app.config['SECRET_KEY'] = 'secret key goes here'
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite'
|
||||
|
||||
db.init_app(app)
|
||||
|
||||
# blueprint for auth routes in app
|
||||
from .auth import auth as auth_blueprint
|
||||
app.register_blueprint(auth_blueprint)
|
||||
|
||||
# blueprint for non-auth parts of app
|
||||
from .main import main as main_blueprint
|
||||
app.register_blueprint(main_blueprint)
|
||||
|
||||
return app
|
||||
23
flash_auth_app/project/auth.py
Normal file
23
flash_auth_app/project/auth.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from flask import Blueprint
|
||||
from . import db
|
||||
|
||||
auth = Blueprint('auth', __name__)
|
||||
|
||||
'''
|
||||
FIXME this will have to be revisited later with added funcitonality,
|
||||
as right now `login`, `signup`, and `logout` only return text
|
||||
|
||||
There will also be routes for handling POST requests from login and signup
|
||||
'''
|
||||
|
||||
@auth.route('/login')
|
||||
def login():
|
||||
return 'Login'
|
||||
|
||||
@auth.route('/signup')
|
||||
def signup():
|
||||
return 'Signup'
|
||||
|
||||
@auth.route('/logout')
|
||||
def logout():
|
||||
return 'Logout'
|
||||
12
flash_auth_app/project/main.py
Normal file
12
flash_auth_app/project/main.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from flask import Blueprint
|
||||
from . import db
|
||||
|
||||
main = Blueprint('main', __name__)
|
||||
|
||||
@main.route('/')
|
||||
def index():
|
||||
return 'Index'
|
||||
|
||||
@main.route('/profile')
|
||||
def profile():
|
||||
return 'Profile'
|
||||
Reference in New Issue
Block a user