contentdb/app/views/__init__.py

28 lines
685 B
Python
Raw Normal View History

2018-03-18 17:43:30 +00:00
from app import app
from flask import *
from flask_user import *
from flask_login import login_user, logout_user
from app.models import *
2018-03-18 18:05:53 +00:00
import flask_menu as menu
from flask.ext import markdown
2018-03-18 17:43:30 +00:00
from sqlalchemy import func
from werkzeug.contrib.cache import SimpleCache
2018-03-20 02:17:33 +00:00
from urllib.parse import urlparse
2018-03-18 17:43:30 +00:00
cache = SimpleCache()
2018-03-20 02:17:33 +00:00
@app.template_filter()
def domain(url):
return urlparse(url).netloc
2018-03-18 17:43:30 +00:00
# TODO: remove on production!
2018-03-21 22:03:37 +00:00
@app.route("/static/<path:path>")
2018-03-18 17:43:30 +00:00
def send_static(path):
2018-03-21 22:03:37 +00:00
return send_from_directory("static", path)
2018-03-18 17:43:30 +00:00
2018-03-21 22:03:37 +00:00
@app.route("/")
@menu.register_menu(app, ".", "Home")
2018-03-18 17:43:30 +00:00
def home_page():
2018-03-21 22:03:37 +00:00
return render_template("index.html")
2018-03-20 00:44:47 +00:00
from . import users, githublogin, packages