classTwitter(peewee.Model): user = peewee.ForeignKeyField(model=User, backref='tweets')
objects = Manager(PostgresqlDatabase('test')) objects.database.allow_sync = False# this will raise AssertionError on ANY sync call
asyncdefmy_async_func(): user0 = await objects.create(User, username='test') user1 = await objects.get(User, id=user0.id) user2 = await objects.get(User, username='test') # All should be the same print(user0.id, user1.id, user2.id) print(user0.tweets) # raise exception here
Takes one argument "app-path" which should be a path to either a directory containing a recognized default file ("app.py" or "main.py") or to a specific file. Defaults to the environment variable "AIO_APP_PATH" or ".".
The app path is run directly, see the "--app-factory" option for details on how an app is loaded from a python module.
Options: -s, --static DIRECTORY Path of static files to serve, if excluded static files aren't served. env variable: AIO_STATIC_STATIC --root DIRECTORY Root directory project used to qualify other paths. env variable: AIO_ROOT --static-url TEXT URL path to serve static files from, default "/static/". env variable: AIO_STATIC_URL --livereload / --no-livereload Whether to inject livereload.js into html page footers to autoreload on changes. env variable AIO_LIVERELOAD --host TEXT host used when referencing livereload and static files, if blank host is taken from the request header with default of localhost. env variable AIO_HOST --debug-toolbar / --no-debug-toolbar Whether to enable debug toolbar. env variable: AIO_DEBUG_TOOLBAR --app-factory TEXT name of the app factory to create an aiohttp.web.Application with, if missing default app-factory names are tried. This can be either a function with signature "def create_app(loop): -> Application" or "def create_app(): -> Application" or just an instance of aiohttp.Application. env variable AIO_APP_FACTORY -p, --port INTEGER Port to serve app from, default 8000. env variable: AIO_PORT --aux-port INTEGER Port to serve auxiliary app (reload and static) on, default port + 1. env variable: AIO_AUX_PORT -v, --verbose Enable verbose output. --help Show this message and exit.