Skip to content

Commit

Permalink
docs: remove duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
waketzheng committed Jun 1, 2023
1 parent 14024c7 commit aa5d090
Showing 1 changed file with 3 additions and 54 deletions.
57 changes: 3 additions & 54 deletions tortoise/contrib/fastapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,60 +155,9 @@ def register_tortoise(
Parameters
----------
app:
FastAPI app.
config:
Dict containing config:
Example
-------
.. code-block:: python3
{
'connections': {
# Dict format for connection
'default': {
'engine': 'tortoise.backends.asyncpg',
'credentials': {
'host': 'localhost',
'port': '5432',
'user': 'tortoise',
'password': 'qwerty123',
'database': 'test',
}
},
# Using a DB_URL string
'default': 'postgres://postgres:qwerty123@localhost:5432/events'
},
'apps': {
'models': {
'models': ['__main__'],
# If no default_connection specified, defaults to 'default'
'default_connection': 'default',
}
}
}
config_file:
Path to .json or .yml (if PyYAML installed) file containing config with
same format as above.
db_url:
Use a DB_URL string. See :ref:`db_url`
modules:
Dictionary of ``key``: [``list_of_modules``] that defined "apps" and modules that
should be discovered for models.
generate_schemas:
True to generate schema immediately. Only useful for dev environments
or SQLite ``:memory:`` databases
add_exception_handlers:
True to add some automatic exception handlers for ``DoesNotExist`` & ``IntegrityError``.
This is not recommended for production systems as it may leak data.
Raises
------
ConfigurationError
For any configuration error
See ``tortoise.contrib.fastapi.RegisterTortoise``
> Note: it's recommended to use ``RegisterTortoise`` in lifespan instead of this function for ``fastapi>=0.93.0``
"""
orm = RegisterTortoise(app, config, config_file, db_url, modules, generate_schemas)

Expand Down

0 comments on commit aa5d090

Please sign in to comment.