Exemple #1
0
from routers import auth
from routers import wallet
from app import app

app.include_router(auth.router)

app.include_router(
    wallet.router,
    prefix="/wallet",
    tags=["Wallet"]
)
Exemple #2
0
from app import  app
from app.api import master

app.include_router(
    master.router,
    prefix='/api'
)

async def test_conflict_router():
    router = AsyncRouter(url_prefix="/simple")
    router.add_route("/api", Simple())
    app.include_router(router)
    with raises(EndpointConflict):
        app.include_router(router)
Exemple #4
0
from tortoise.contrib.fastapi import register_tortoise

from app import app
from config import settings, TORTOISE_ORM
from app.route import api_router


register_tortoise(
    app,
    config=TORTOISE_ORM,
    generate_schemas=True,
    add_exception_handlers=True,
)

app.include_router(api_router, prefix=settings.API_PREFIX)

Exemple #5
0
from app.Users.router import user_router
from app import app

app.include_router(user_router, prefix="/users")
async def test_bad_router():
    router = AsyncRouter()
    router.add_route("/api", Simple())
    with raises(BadRouter):
        app.include_router(router)
Exemple #7
0
    )


cookie_authentication = CookieAuthentication(secret=SECRET,
                                             cookie_secure=not IS_DEVELOPMENT)

fastapi_users = FastAPIUsers(
    user_db,
    [cookie_authentication],
    User,
    UserCreate,
    UserUpdate,
    UserDB,
)
app.include_router(fastapi_users.get_auth_router(cookie_authentication),
                   prefix="/auth/cookie",
                   tags=["auth"])
"""
app.include_router(
    fastapi_users.get_register_router(on_after_register), prefix="/auth", tags=["auth"]
)
"""
app.include_router(
    fastapi_users.get_reset_password_router(
        SECRET, after_forgot_password=on_after_forgot_password),
    prefix="/auth",
    tags=["auth"],
)
app.include_router(
    fastapi_users.get_verify_router(
        SECRET, after_verification_request=after_verification_request),
Exemple #8
0
from app import app
from books.routes import books_router, ROUTE_PREFIX, TAGS

app.include_router(books_router, prefix=ROUTE_PREFIX, tags=TAGS)
# TODO: Add util to auto import routes


if __name__ == '__main__':
    import uvicorn

    uvicorn.run(app, host='127.0.0.1', port=8008)
Exemple #9
0
from app.Users.router import user_router
from app.TahuraEvent.router import eventRouter
from app import app

# app.include_router(user_router, prefix="/users")
app.include_router(eventRouter, prefix="/event")
Exemple #10
0
    except (InvalidFieldException, InvalidDimensionValueException) as e:
        error(str(e))
        return Response(str(e), status_code=400)
    except (UnsupportedGrainException, ZillionException) as e:
        error(str(e))
        return Response(str(e), status_code=500)
    except Exception as e:
        tb.print_exc()
        if settings.ROLLBAR_ENABLED:
            rollbar.report_exc_info()
        if settings.DEBUG:
            return Response(tb.format_exc(), status_code=500)
        return Response(f"Internal server error: {str(e)}", status_code=500)


app.middleware("http")(catch_exceptions_middleware)

# Set all CORS enabled origins
if settings.BACKEND_CORS_ORIGINS:
    app.add_middleware(
        CORSMiddleware,
        allow_origins=[
            str(origin) for origin in settings.BACKEND_CORS_ORIGINS
        ],
        allow_credentials=True,
        allow_methods=["*"],
        allow_headers=["*"],
    )

app.include_router(api_router, prefix=settings.API_V1_STR)
Exemple #11
0
from models.model import Settings
from schema.db import db
from app import app
from schema.db import db

import uvicorn

from routers import user, authentications, products, doctors

app.include_router(user.app)
app.include_router(doctors.app)
app.include_router(products.app)
app.include_router(authentications.app)

if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8000)
Exemple #12
0
import logging

from app import app
from routes.v1 import router as router_v1
from settings import settings

logging.basicConfig(level=settings.loglevel)

logging.debug(settings.dict())

app.include_router(router_v1, prefix='/v1')
Exemple #13
0
from app.Wisata.router import wisataRouter
from app import app

app.include_router(wisataRouter, prefix="/wisata")