aboutsummaryrefslogtreecommitdiff
path: root/app/views/__init__.py
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-03-23 17:05:07 +0000
committerrubenwardy <rw@rubenwardy.com>2018-03-23 17:05:07 +0000
commit73a79d5eefdc02a942edfdb0c48cefc507f81427 (patch)
tree04c0b05964e018e6c5f4b7b8545981293bde6c24 /app/views/__init__.py
parent5a9fc51ffcc4744179687540df50b5a778275099 (diff)
downloadcheatdb-73a79d5eefdc02a942edfdb0c48cefc507f81427.tar.xz
Add file upload for releases
Diffstat (limited to 'app/views/__init__.py')
-rw-r--r--app/views/__init__.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/views/__init__.py b/app/views/__init__.py
index 09ce16f..3c8c009 100644
--- a/app/views/__init__.py
+++ b/app/views/__init__.py
@@ -12,13 +12,18 @@ cache = SimpleCache()
@app.template_filter()
def domain(url):
- return urlparse(url).netloc
+ return urlparse(url).netloc
-# TODO: remove on production!
+# Use nginx to serve files on production instead
@app.route("/static/<path:path>")
def send_static(path):
return send_from_directory("static", path)
+@app.route("/uploads/<path:path>")
+def send_upload(path):
+ import os
+ return send_from_directory(os.path.abspath(app.config["UPLOAD_FOLDER"]), path)
+
@app.route("/")
@menu.register_menu(app, ".", "Home")
def home_page():