diff --git a/.gitignore b/.gitignore index 0516b64..0f0c103 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ data +venv src/static/uploads diff --git a/src/main.py b/src/main.py index f0bba3a..47f97ef 100644 --- a/src/main.py +++ b/src/main.py @@ -7,9 +7,9 @@ import secrets import os from werkzeug.utils import secure_filename -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) -UPLOAD_FOLDER = os.path.join(BASE_DIR, "static", "uploads") -os.makedirs(UPLOAD_FOLDER, exist_ok=True) +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) # sets the base dir as the diretory where the python file is +UPLOAD_FOLDER = os.path.join(BASE_DIR, "static", "uploads") # joins the directories +os.makedirs(UPLOAD_FOLDER, exist_ok=True) # creates the uploads directorie # configures the app app = Flask(__name__) # creates de app @@ -78,7 +78,6 @@ def calculate_age(dob: date) -> int: return today.year - dob.year - ((today.month, today.day) < (dob.month, dob.day)) # saves files to the upload folder and returns their URL - def save_files(username: str, profile_file, pictures_files): user_folder = os.path.join(app.config['UPLOAD_FOLDER'], username) os.makedirs(user_folder, exist_ok=True)