|
1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
-
-
-
-
-
-
-
-
- from flask import Blueprint, render_template
- from flask_login import login_required, current_user
- from . import db
- from .models import Resource
- from sqlalchemy.sql import func
- import markdown
-
- main = Blueprint('main', __name__)
-
-
- @main.route('/')
- def index():
- tools = Resource.query.filter_by(type='tool').order_by(func.random()).limit(6).all()
- with open('content/home.md', 'r') as f:
- text = f.read()
- text = markdown.markdown(text)
- return render_template('index.html', text=text, tools=tools)
-
-
- @main.route('/profile')
- @login_required
- def profile():
- return render_template('profile.html', name=current_user.name)
-
-
- @main.route('/test')
- def test():
- return render_template('test.html')
-
-
- @main.route('/about')
- def about():
- with open('content/about.md', 'r') as f:
- text = f.read()
- text = markdown.markdown(text)
- return render_template('about.html', text=text)
|