runobservers.py 文件源码

python
阅读 15 收藏 0 点赞 0 评论 0

项目:django-rest-framework-reactive 作者: genialis 项目源码 文件源码
def inner_run(self, *args, **options):
        # Check if we are using the correct database engine configuration.
        if db.connection.settings_dict['ENGINE'] != 'django_db_geventpool.backends.postgresql_psycopg2':
            raise exceptions.ImproperlyConfigured("Django REST Framework Reactive requires the geventpool database engine.")

        # Make the pool gevent-ready.
        pool.set_backend(GeventBackend())

        # Register the event handler for receiving model updates from the Django ORM.
        event_handler = rpc.RedisObserverEventHandler()
        gevent.spawn(event_handler)

        # Prepare the RPC server.
        info = connection.get_queryobserver_settings()
        rpc_server = pywsgi.WSGIServer((info['host'], info['port']), application=rpc.WSGIObserverCommandHandler())
        rpc_server.serve_forever()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号