add code
This commit is contained in:
parent
f1da01193b
commit
b0a4567169
20 changed files with 1734 additions and 0 deletions
15
config.py
Normal file
15
config.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import os
|
||||
|
||||
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
class Config:
|
||||
SECRET_KEY = os.environ.get('SECRET_KEY', 'your-secret-key')
|
||||
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', 'sqlite:///' + os.path.join(BASE_DIR, 'instance', 'app.db'))
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
UPLOAD_FOLDER = os.path.join(BASE_DIR, 'static', 'uploads')
|
||||
|
||||
@staticmethod
|
||||
def init_app(app):
|
||||
# Create necessary directories
|
||||
os.makedirs(os.path.dirname(app.config['SQLALCHEMY_DATABASE_URI'].replace('sqlite:///', '')), exist_ok=True)
|
||||
os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)
|
Loading…
Add table
Add a link
Reference in a new issue