-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
26 lines (21 loc) · 1.14 KB
/
config.py
File metadata and controls
26 lines (21 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#Configures the database information for the website
import os
basedir = os.path.abspath(os.path.dirname(__file__))
#Change 'eb.db' if using a different filename
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'eb.db')
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
SQLALCHEMY_TRACK_MODIFICATIONS = False
WTF_CSRF_ENABLED = True
SECRET_KEY = 'my_secret'
#This accounts for if the static images and audio need to be saved somewhere besides the directory where the code is stored.
#It checks the parent directory of the code directory for a folder that matches alternate_path. If it exists, it uses
#it. Otherwise it uses the basedir
alternate_path = "public_html/eb"
if os.path.exists(os.path.join(os.path.split(basedir)[0],alternate_path)):
static_basedir = os.path.join(os.path.split(basedir)[0],alternate_path)
else:
static_basedir = basedir
AUDIO_UPLOAD_FOLDER = os.path.join(static_basedir,'static','audio')
ALLOWED_AUDIO_EXTENSIONS = set(['mp3','mp4','aac','wav','flac'])
IMAGE_UPLOAD_FOLDER = os.path.join(static_basedir,'static','img','post_images')
ALLOWED_IMAGE_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif', 'svg'])