def create_app(test_config=None): """Construct the core application.""" # Create the Flask app object. app = Flask(__name__) app.config.from_object('config.Config') data_path = os.path.join('movies', 'adapters', 'data') if test_config is not None: app.config.from_mapping(test_config) data_path = app.config['TEST_DATA_PATH'] repo.repo_instance = MemoryRepository() populate(data_path, repo.repo_instance) with app.app_context(): # Register blueprints. from .home import home app.register_blueprint(home.home_blueprint) from .movie_library import movie_library app.register_blueprint(movie_library.movie_library_blueprint) from .authentication import authentication app.register_blueprint(authentication.authentication_blueprint) from .utilities import utilities app.register_blueprint(utilities.utilities_blueprint) from .search import search app.register_blueprint(search.search_blueprint) return app
def create_app(test_config=None): """Construct the core application.""" app = Flask(__name__) app.config.from_object('config.Config') data_path = os.path.join('movies', 'adapters', 'data') if test_config is not None: app.config.from_mapping(test_config) data_path = app.config['TEST_DATA_PATH'] repo.repo_instance = MemoryRepository() populate(data_path, repo.repo_instance) with app.app_context(): from .home import home app.register_blueprint(home.home_blueprint) from .movie import movie app.register_blueprint(movie.movie_blueprint) from .authentication import authentication app.register_blueprint(authentication.authentication_blueprint) return app
def create_app(test_config=None): """Construct the core application.""" # Create the Flask app object. app = Flask(__name__) # Configure the app from configuration-file settings. app.config.from_object('config.Config') data_path = os.path.join('movies', 'adapters', 'data') if test_config is not None: # Load test configuration, and override any configuration settings. app.config.from_mapping(test_config) data_path = app.config['TEST_DATA_PATH'] # Create the MemoryRepository implementation for a memory-based repository. repo.repo_instance = MemoryRepository() populate(data_path, repo.repo_instance) # Build the application - these steps require an application context. with app.app_context(): # Register blueprints. from .home import home app.register_blueprint(home.home_blueprint) from .news import news app.register_blueprint(news.news_blueprint) from .authentication import authentication app.register_blueprint(authentication.authentication_blueprint) from .utilities import utilities app.register_blueprint(utilities.utilities_blueprint) return app
def create_app(test_config=None): app = Flask(__name__) app.config.from_object('config.Config') data_path = os.path.join("movies", 'adapters', 'data') csrf.init_app(app) if test_config: app.config.from_mapping(test_config) data_path = app.config["TEST_DATA_PATH"] repo.repo_instance = MemoryRepository() populate(data_path, repo.repo_instance) with app.app_context(): from .home import home app.register_blueprint(home.home_blueprint) from .movies import movies app.register_blueprint(movies.movies_blueprint) from .authentication import authentication app.register_blueprint(authentication.authentication_blueprint) return app
def create_app(test_config=None): # Create the Flask app object. app = Flask(__name__) # Configure the app from configuration-file settings. app.config.from_object('config.Config') data_path = os.path.join('movies', 'adapters', 'data', 'Data1000Movies.csv') if test_config is not None: # Load test configuration, and overrride any configuration settings. app.config.from_mapping(test_config) data_path = app.config['TEST_DATA_PATH'] repo.repo_instance = MemoryRepository() populate(data_path, repo.repo_instance) # Build the application - these steps require an application context. with app.app_context(): # Register blueprints. from .home import home app.register_blueprint(home.home_blueprint) from .movie import movie app.register_blueprint(movie.movies_blueprint) from .utilities import utilities app.register_blueprint(utilities.utilities_blueprint) return app
def in_memory_repo(): repo = MemoryRepository() memory_repository.populate(TEST_DATA_PATH_MEMORY, repo) return repo
def in_memory_repo(): repo = MemoryRepository() memory_repository.populate(data_path, repo) return repo