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
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
15 changed files with 6 additions and 8 deletions

1
.gitignore vendored

@ -5,6 +5,7 @@ main.css
tmp tmp
log.txt log.txt
*.rdb *.rdb
uploads
# Created by https://www.gitignore.io/api/linux,macos,python,windows # Created by https://www.gitignore.io/api/linux,macos,python,windows

Before

Width:  |  Height:  |  Size: 771 KiB

After

Width:  |  Height:  |  Size: 771 KiB

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

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

@ -47,7 +47,7 @@ def doFileUpload(file, allowedExtensions, fileTypeName):
return None return None
filename = randomString(10) + "." + ext 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 return "/uploads/" + filename

@ -34,12 +34,11 @@ def domain(url):
# Use nginx to serve files on production instead # Use nginx to serve files on production instead
@app.route("/static/<path:path>") @app.route("/static/<path:path>")
def send_static(path): def send_static(path):
return send_from_directory("static", path) return send_from_directory("public/static", path)
@app.route("/uploads/<path:path>") @app.route("/uploads/<path:path>")
def send_upload(path): def send_upload(path):
import os return send_from_directory("public/uploads", path)
return send_from_directory(os.path.abspath(app.config["UPLOAD_FOLDER"]), path)
@app.route("/") @app.route("/")
@menu.register_menu(app, ".", "Home") @menu.register_menu(app, ".", "Home")

@ -13,11 +13,9 @@ GITHUB_CLIENT_SECRET = ""
CELERY_BROKER_URL='redis://localhost:6379' CELERY_BROKER_URL='redis://localhost:6379'
CELERY_RESULT_BACKEND='redis://localhost:6379' CELERY_RESULT_BACKEND='redis://localhost:6379'
UPLOAD_FOLDER="tmp"
USER_ENABLE_REGISTER = False USER_ENABLE_REGISTER = False
USER_ENABLE_CHANGE_USERNAME = False USER_ENABLE_CHANGE_USERNAME = False
s
MAIL_USERNAME="" MAIL_USERNAME=""
MAIL_PASSWORD="" MAIL_PASSWORD=""
MAIL_DEFAULT_SENDER="" MAIL_DEFAULT_SENDER=""