def create_engine(self): """ this function creates the engine and applies all the metadata of classes which inherit the base class and applies it to the database to create tables. :arg """ engine = create_engine( DatabaseConfiguration().DataBaseConnectionString, echo=False) if engine.dialect.has_table(engine, 'SystemUser') == False: Base.metadata.create_all(engine) tempsession = sessionmaker(bind=engine)() tempsession.add( FreeTAKServer.model.SQLAlchemy.system_user.SystemUser( uid="1", name="admin", password="******", token="token")) tempsession.commit() tempsession.close() return engine else: Base.metadata.create_all(engine) return engine
functionNames.function_names() jsonVars = vars() jsonVars.json_vars() restMethods = vars() restMethods.rest_methods() defaultValues = vars() defaultValues.default_values() app = Flask(__name__) login_manager = LoginManager() login_manager.init_app(app) auth = HTTPTokenAuth(scheme='Bearer') app.config['SQLALCHEMY_DATABASE_URI'] = DatabaseConfiguration( ).DataBaseConnectionString app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(app) dbController.session = db.session CORS(app) socketio = SocketIO(app, async_handlers=True, async_mode="eventlet") socketio.init_app(app, cors_allowed_origins="*") APIPipe = None CommandPipe = None app.config["SECRET_KEY"] = 'vnkdjnfjknfl1232#' @app.errorhandler(404) def page_not_found(e): return 'this endpoint does not exist'