mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 01:47:36 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			474 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			474 B
		
	
	
	
		
			Python
		
	
	
	
	
	
"""Application module."""
 | 
						|
 | 
						|
from sanic import Sanic
 | 
						|
 | 
						|
from .containers import Container
 | 
						|
from . import handlers
 | 
						|
 | 
						|
 | 
						|
def create_app():
 | 
						|
    """Create and return aiohttp application."""
 | 
						|
    container = Container()
 | 
						|
    container.config.from_yaml('config.yml')
 | 
						|
    container.config.giphy.api_key.from_env('GIPHY_API_KEY')
 | 
						|
 | 
						|
    container.wire(modules=[handlers])
 | 
						|
 | 
						|
    app = Sanic('Giphy Navigator')
 | 
						|
    app.container = container
 | 
						|
 | 
						|
    app.add_route(handlers.index, '/')
 | 
						|
 | 
						|
    return app
 |