|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
import os
|
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
|
|
from flask import Flask
|
|
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
@ -16,19 +15,9 @@ def create_app():
|
|
|
|
|
app = Flask(__name__, instance_relative_config=True)
|
|
|
|
|
|
|
|
|
|
app.config.from_mapping(POST_UPLOADS=os.path.join(app.instance_path, 'post'), SQLALCHEMY_TRACK_MODIFICATIONS=False)
|
|
|
|
|
# try:
|
|
|
|
|
# os.makedirs(app.instance_path)
|
|
|
|
|
|
|
|
|
|
# # os.makedirs(app.config.get('POST_UPLOADS'))
|
|
|
|
|
# for d in ['img', 'jpeg', 'sample', 'thumb']:
|
|
|
|
|
# os.makedirs(os.path.join(app.config.get('POST_UPLOADS'), d))
|
|
|
|
|
|
|
|
|
|
# # shutil.copyfile(os.path.join(app.root_path, 'config.def.py'), os.path.join(app.instance_path, 'config.py'))
|
|
|
|
|
# except OSError:
|
|
|
|
|
# pass
|
|
|
|
|
|
|
|
|
|
## TO REDO
|
|
|
|
|
|
|
|
|
|
if not os.path.isfile(os.path.join(app.instance_path, 'config.py')):
|
|
|
|
|
raise OSError('Before starting application, please initialize environment using \'manage.sh\' script in the root directory.')
|
|
|
|
|
app.config.from_pyfile('config.py')
|
|
|
|
|
|
|
|
|
|
app.jinja_env.trim_blocks = True
|
|
|
|
|