()
| 295 | |
| 296 | |
| 297 | async def main(): |
| 298 | tornado.options.parse_command_line() |
| 299 | |
| 300 | # Create the global connection pool. |
| 301 | async with aiopg.create_pool( |
| 302 | host=options.db_host, |
| 303 | port=options.db_port, |
| 304 | user=options.db_user, |
| 305 | password=options.db_password, |
| 306 | dbname=options.db_database, |
| 307 | ) as db: |
| 308 | await maybe_create_tables(db) |
| 309 | app = Application(db) |
| 310 | app.listen(options.port) |
| 311 | |
| 312 | # In this demo the server will simply run until interrupted |
| 313 | # with Ctrl-C, but if you want to shut down more gracefully, |
| 314 | # call shutdown_event.set(). |
| 315 | shutdown_event = tornado.locks.Event() |
| 316 | await shutdown_event.wait() |
| 317 | |
| 318 | |
| 319 | if __name__ == "__main__": |
no test coverage detected