2018-03-18 18:43:30 +01: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 19:05:53 +01:00
|
|
|
import flask_menu as menu
|
|
|
|
from flask.ext import markdown
|
2018-03-18 18:43:30 +01:00
|
|
|
from sqlalchemy import func
|
|
|
|
from werkzeug.contrib.cache import SimpleCache
|
2018-03-20 03:17:33 +01:00
|
|
|
from urllib.parse import urlparse
|
2018-03-18 18:43:30 +01:00
|
|
|
cache = SimpleCache()
|
|
|
|
|
2018-03-20 03:17:33 +01:00
|
|
|
@app.template_filter()
|
|
|
|
def domain(url):
|
2018-03-23 18:05:07 +01:00
|
|
|
return urlparse(url).netloc
|
2018-03-20 03:17:33 +01:00
|
|
|
|
2018-03-23 18:05:07 +01:00
|
|
|
# Use nginx to serve files on production instead
|
2018-03-21 23:03:37 +01:00
|
|
|
@app.route("/static/<path:path>")
|
2018-03-18 18:43:30 +01:00
|
|
|
def send_static(path):
|
2018-03-21 23:03:37 +01:00
|
|
|
return send_from_directory("static", path)
|
2018-03-18 18:43:30 +01:00
|
|
|
|
2018-03-23 18:05:07 +01:00
|
|
|
@app.route("/uploads/<path:path>")
|
|
|
|
def send_upload(path):
|
|
|
|
import os
|
|
|
|
return send_from_directory(os.path.abspath(app.config["UPLOAD_FOLDER"]), path)
|
|
|
|
|
2018-03-21 23:03:37 +01:00
|
|
|
@app.route("/")
|
|
|
|
@menu.register_menu(app, ".", "Home")
|
2018-03-18 18:43:30 +01:00
|
|
|
def home_page():
|
2018-03-21 23:03:37 +01:00
|
|
|
return render_template("index.html")
|
2018-03-20 01:44:47 +01:00
|
|
|
|
|
|
|
from . import users, githublogin, packages
|