You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			36 lines
		
	
	
		
			761 B
		
	
	
	
		
			Python
		
	
			
		
		
	
	
			36 lines
		
	
	
		
			761 B
		
	
	
	
		
			Python
		
	
try:
 | 
						|
    import psycopg2
 | 
						|
except ImportError:
 | 
						|
    # Fall back to psycopg2cffi
 | 
						|
    from psycopg2cffi import compat
 | 
						|
 | 
						|
    compat.register()
 | 
						|
 | 
						|
from apistar_jwt import JWT
 | 
						|
from apistar_mail import MailComponent
 | 
						|
from sqlalchemy import create_engine
 | 
						|
 | 
						|
from cookie_api import application_factory
 | 
						|
from cookie_api.util import SQLAlchemySession, SQLAlchemyHook
 | 
						|
from config import db_config, jwt_config, mail_config, logging_config
 | 
						|
 | 
						|
components = [
 | 
						|
    SQLAlchemySession(create_engine(db_config)),
 | 
						|
    JWT(jwt_config),
 | 
						|
    MailComponent(**mail_config)
 | 
						|
]
 | 
						|
 | 
						|
hooks = [
 | 
						|
    SQLAlchemyHook()
 | 
						|
]
 | 
						|
 | 
						|
app = application_factory(components=components, hooks=hooks, settings={**logging_config})
 | 
						|
 | 
						|
 | 
						|
def main():
 | 
						|
    app.serve('0.0.0.0', 5000, debug=True)
 | 
						|
 | 
						|
 | 
						|
if __name__ == '__main__':
 | 
						|
    main()
 |