diff --git a/bootstrap/config.py b/bootstrap/config.py index b3aa46a..a343a9b 100644 --- a/bootstrap/config.py +++ b/bootstrap/config.py @@ -3,9 +3,17 @@ import os basepath = os.path.dirname(os.path.realpath(__file__)) DATA_DIR = os.path.join(basepath, "data") + +TASKS_DIR = os.path.join(DATA_DIR, "tasks") +TASKS_IN_DIR = os.path.join(TASKS_DIR, "in") +TASKS_BUF_DIR = os.path.join(TASKS_DIR, "buf") +TASKS_PROC_DIR = os.path.join(TASKS_DIR, "proc") + DATABASE_FILE = os.path.join(DATA_DIR, "db.sqlite") SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format(DATABASE_FILE) + TEMPLATES_FOLDER = os.path.join(basepath, "webapp", "templates") + MAKEDIRS = [ - DATA_DIR, -] \ No newline at end of file + DATA_DIR, TASKS_DIR, TASKS_IN_DIR, TASKS_PROC_DIR, TASKS_BUF_DIR, +] diff --git a/bootstrap/run.py b/bootstrap/run.py index a0225fa..3a1b730 100644 --- a/bootstrap/run.py +++ b/bootstrap/run.py @@ -4,10 +4,10 @@ from oshipka import init_db from populate import populate_db from webapp.app import app +if init_db(app): + populate_db(app) + +app.template_folder = TEMPLATES_FOLDER + if __name__ == "__main__": - if init_db(app): - populate_db(app) - - app.template_folder = TEMPLATES_FOLDER - app.run(debug=True) diff --git a/bootstrap/webapp/app.py b/bootstrap/webapp/app.py index 2c0be8b..0b2192c 100644 --- a/bootstrap/webapp/app.py +++ b/bootstrap/webapp/app.py @@ -1,7 +1,8 @@ -from flask import render_template, request, jsonify +from flask import render_template from oshipka.webapp import app + @app.route('/') def home(): - return render_template("home.html") \ No newline at end of file + return render_template("home.html") diff --git a/bootstrap/worker.py b/bootstrap/worker.py new file mode 100644 index 0000000..97420bf --- /dev/null +++ b/bootstrap/worker.py @@ -0,0 +1,11 @@ +from oshipka import worker, init_db + +from populate import populate_db +from webapp.app import app + +if init_db(app): + populate_db(app) + + +if __name__ == "__main__": + worker.main() diff --git a/oshipka/webapp/__init__.py b/oshipka/webapp/__init__.py index 36bb164..1c3de1c 100644 --- a/oshipka/webapp/__init__.py +++ b/oshipka/webapp/__init__.py @@ -1,14 +1,8 @@ from flask import Flask, Blueprint -from flask_socketio import SocketIO app = Flask(__name__) app.config["SECRET_KEY"] = "UNSECRET_KEY....478932fjkdsl" -socketio = SocketIO( - app, - cors_allowed_origins=["http://localhost:5000"], -) - test_bp = Blueprint('test_bp', __name__, url_prefix="/test", template_folder='templates', diff --git a/requirements.txt b/requirements.txt index 8a09746..f2ef029 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ click==7.1.1 filelock==3.0.12 Flask==1.1.1 Flask-SQLAlchemy==2.4.1 +Flask-Table==0.5.0 itsdangerous==1.1.0 Jinja2==2.11.1 MarkupSafe==1.1.1