Move static and uploads to public dir

This commit is contained in:
rubenwardy
2018-05-23 21:12:52 +01:00
parent 59f75bb71c
commit d5342d7096
15 changed files with 6 additions and 8 deletions

View File

Before

Width:  |  Height:  |  Size: 771 KiB

After

Width:  |  Height:  |  Size: 771 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -247,7 +247,7 @@ def importRepoScreenshot(id):
try:
filename = randomString(10) + ".png"
imagePath = os.path.join(app.config["UPLOAD_FOLDER"], filename)
imagePath = os.path.join("public/uploads", filename)
print(imagePath)
urllib.request.urlretrieve(urlmaker.getScreenshotURL(), imagePath)

View File

@@ -47,7 +47,7 @@ def doFileUpload(file, allowedExtensions, fileTypeName):
return None
filename = randomString(10) + "." + ext
file.save(os.path.join(app.config["UPLOAD_FOLDER"], filename))
file.save(os.path.join("public/uploads", filename))
return "/uploads/" + filename

View File

@@ -34,12 +34,11 @@ def domain(url):
# Use nginx to serve files on production instead
@app.route("/static/<path:path>")
def send_static(path):
return send_from_directory("static", path)
return send_from_directory("public/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)
return send_from_directory("public/uploads", path)
@app.route("/")
@menu.register_menu(app, ".", "Home")