bootstrap new project fix

This commit is contained in:
Daniel Tsvetkov 2020-03-23 14:59:11 +01:00
parent 0e062ccb7f
commit a486cd7f66
6 changed files with 30 additions and 15 deletions

View File

@ -3,9 +3,17 @@ import os
basepath = os.path.dirname(os.path.realpath(__file__)) basepath = os.path.dirname(os.path.realpath(__file__))
DATA_DIR = os.path.join(basepath, "data") 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") DATABASE_FILE = os.path.join(DATA_DIR, "db.sqlite")
SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format(DATABASE_FILE) SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format(DATABASE_FILE)
TEMPLATES_FOLDER = os.path.join(basepath, "webapp", "templates") TEMPLATES_FOLDER = os.path.join(basepath, "webapp", "templates")
MAKEDIRS = [ MAKEDIRS = [
DATA_DIR, DATA_DIR, TASKS_DIR, TASKS_IN_DIR, TASKS_PROC_DIR, TASKS_BUF_DIR,
] ]

View File

@ -4,10 +4,10 @@ from oshipka import init_db
from populate import populate_db from populate import populate_db
from webapp.app import app from webapp.app import app
if __name__ == "__main__":
if init_db(app): if init_db(app):
populate_db(app) populate_db(app)
app.template_folder = TEMPLATES_FOLDER app.template_folder = TEMPLATES_FOLDER
if __name__ == "__main__":
app.run(debug=True) app.run(debug=True)

View File

@ -1,7 +1,8 @@
from flask import render_template, request, jsonify from flask import render_template
from oshipka.webapp import app from oshipka.webapp import app
@app.route('/') @app.route('/')
def home(): def home():
return render_template("home.html") return render_template("home.html")

11
bootstrap/worker.py Normal file
View File

@ -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()

View File

@ -1,14 +1,8 @@
from flask import Flask, Blueprint from flask import Flask, Blueprint
from flask_socketio import SocketIO
app = Flask(__name__) app = Flask(__name__)
app.config["SECRET_KEY"] = "UNSECRET_KEY....478932fjkdsl" app.config["SECRET_KEY"] = "UNSECRET_KEY....478932fjkdsl"
socketio = SocketIO(
app,
cors_allowed_origins=["http://localhost:5000"],
)
test_bp = Blueprint('test_bp', __name__, test_bp = Blueprint('test_bp', __name__,
url_prefix="/test", url_prefix="/test",
template_folder='templates', template_folder='templates',

View File

@ -2,6 +2,7 @@ click==7.1.1
filelock==3.0.12 filelock==3.0.12
Flask==1.1.1 Flask==1.1.1
Flask-SQLAlchemy==2.4.1 Flask-SQLAlchemy==2.4.1
Flask-Table==0.5.0
itsdangerous==1.1.0 itsdangerous==1.1.0
Jinja2==2.11.1 Jinja2==2.11.1
MarkupSafe==1.1.1 MarkupSafe==1.1.1