small fixes and organization stuff
This commit is contained in:
parent
b4f3fa5cdb
commit
27935604fe
2 changed files with 4 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
data
|
||||
venv
|
||||
src/static/uploads
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue