config

Application configuration, including database and file upload settings.

 1"""Application configuration, including database and file upload settings."""
 2import os
 3
 4basedir = os.path.abspath(os.path.dirname(__file__))
 5
 6class Config:
 7    SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
 8    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
 9        'sqlite:///' + os.path.join(basedir, 'app.db')
10
11    # Where to save profile photos
12    PROFILE_PHOTO_FOLDER = os.path.join(
13        basedir,
14        'app',
15        'static',
16        'images',
17        'profilePhoto'
18    )
19
20    MAX_CONTENT_LENGTH = 2 * 1024 * 1024
21    ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'}
22
23    @staticmethod
24    def allowed_file(filename: str) -> bool:
25        """Return True if `filename` has an allowed extension."""
26        if '.' not in filename:
27            return False
28        ext = filename.rsplit('.', 1)[1].lower()
29        return ext in Config.ALLOWED_EXTENSIONS
basedir = $PWD
class Config:
 7class Config:
 8    SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
 9    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
10        'sqlite:///' + os.path.join(basedir, 'app.db')
11
12    # Where to save profile photos
13    PROFILE_PHOTO_FOLDER = os.path.join(
14        basedir,
15        'app',
16        'static',
17        'images',
18        'profilePhoto'
19    )
20
21    MAX_CONTENT_LENGTH = 2 * 1024 * 1024
22    ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'}
23
24    @staticmethod
25    def allowed_file(filename: str) -> bool:
26        """Return True if `filename` has an allowed extension."""
27        if '.' not in filename:
28            return False
29        ext = filename.rsplit('.', 1)[1].lower()
30        return ext in Config.ALLOWED_EXTENSIONS
SECRET_KEY = 'you-will-never-guess'
SQLALCHEMY_DATABASE_URI = 'sqlite:////Users/alanna/napier/3rd Year/webDev/project/visionHub/app.db'
PROFILE_PHOTO_FOLDER = '/Users/alanna/napier/3rd Year/webDev/project/visionHub/app/static/images/profilePhoto'
MAX_CONTENT_LENGTH = 2097152
ALLOWED_EXTENSIONS = {'jpg', 'png', 'jpeg'}
@staticmethod
def allowed_file(filename: str) -> bool:
24    @staticmethod
25    def allowed_file(filename: str) -> bool:
26        """Return True if `filename` has an allowed extension."""
27        if '.' not in filename:
28            return False
29        ext = filename.rsplit('.', 1)[1].lower()
30        return ext in Config.ALLOWED_EXTENSIONS

Return True if filename has an allowed extension.