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.
cookie-api/wsgi.py

32 lines
724 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
components = [
SQLAlchemySession(create_engine(db_config)),
JWT(jwt_config),
MailComponent(**mail_config)
]
hooks = [
SQLAlchemyHook()
]
app = application_factory(components=components, hooks=hooks)
if __name__ == '__main__':
app = application_factory()
app.serve('127.0.0.1', 5000, debug=True)