def create_app(): app = Flask(__name__) app.config.from_object(selected_config) create_api(app) register_error_handlers(app) log_configurator = LogConfigurator(current_config) file_handler = log_configurator.create_file_handler() console_handler = log_configurator.create_console_handler() level = log_configurator.get_current_log_level() logging.basicConfig(handlers=[file_handler, console_handler], level=level) return app
from flask_socketio import SocketIO, send, emit, join_room, leave_room, close_room from form import * from time import localtime, strftime from errors import register_error_handlers from login import login_manager from model.user import User from model.question import Question from model.tag import Tag from model.question_tag import Question_tag import uuid app = Flask(__name__) app.secret_key = 'shushumushu' socketio = SocketIO(app) register_error_handlers(app) login_manager.init_app(app) @app.route("/", methods=["GET", "POST"]) def home(): return render_template("home.html") @app.route("/register", methods=["GET", "POST"]) def register(): register_form = RegistrationForm() if register_form.validate_on_submit(): username = register_form.username.data password = register_form.password.data sid = str(uuid.uuid1())
import os from flask import Flask from errors import register_error_handlers pythonotes = Flask(__name__) pythonotes.config.from_pyfile('config.py') register_error_handlers(pythonotes) from pythonotes import Notes, Notes_REST