-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API's giving 404. #120
Comments
Hey, @rithin, I'll take a look and get back to you as soon as possible! |
Ok, found the issue. It's this bug: #117 which was fixed in #118. All you need to do is add this part: if isinstance(settings, EnvironmentSettings):
if settings.ENVIRONMENT != EnvironmentOption.PRODUCTION:
docs_router = APIRouter()
if settings.ENVIRONMENT != EnvironmentOption.LOCAL:
docs_router = APIRouter(dependencies=[Depends(get_current_superuser)])
...
...
application.include_router(docs_router)
# --------------- adding this line fixes the bug ---------------
application.include_router(router) Tell me if it works for you. |
@igorbenav Thanks for the quick reply. That was the issue and it's resolved. I'm getting one more issue like create_tier and create_superuser containers are creating and exiting
|
Weird. There are actually no logs indeed, but the tier should be created. I'm running it here and it's creating. Can you please share your docker-compose, Dockerfile and the relevant parts of your .env? |
@igorbenav you can find it here -> https://github.com/rithin/kappitrails_api/tree/development_v1 |
I think you forgot to uncomment this part in docker-compose: # # #-------- uncomment to create first tier --------
# create_tier:
# build:
# context: .
# dockerfile: Dockerfile
# env_file:
# - ./src/.env
# depends_on:
# - db
# - web
# command: python -m src.scripts.create_first_tier
# volumes:
# - ./src:/code/src If you want logging, the latest update I merged adds it to the scripts. Just replace the old scripts with the new ones |
@igorbenav sorry i didn't push the latest code to git. I enabled and the container got created. But its keep exiting |
Weird. Can you please replace the script with the new one and try again so we can see the logs? Run a |
I can't reproduce the error, so it might be something with your network setup. Something I see that you can fix is this: # app/core/setup.py
def create_application(
router: APIRouter,
settings: (
DatabaseSettings
| RedisCacheSettings
| AppSettings
| ClientSideCacheSettings
| RedisQueueSettings
| RedisRateLimiterSettings
| EnvironmentSettings
),
create_tables_on_start: bool = True,
**kwargs: Any,
) -> FastAPI:
...
application = FastAPI(lifespan=lifespan, **kwargs)
# --------- add the following line here ---------
application.include_router(router) This was fixed in #118 Edit: we went through this already, sorry |
Yeah, when I remove the kappitrails_api-development_v1-create_tier-1 | INFO:__main__:Tier 'free' created successfully.
kappitrails_api-development_v1-create_tier-1 exited with code 0 So there's something wrong with your docker-compose networks settings, when you let docker do it automatically it works. Not actually a boilerplate issue, but I'll leave it open for now to see if you can fix, then maybe convert into a discussion. |
@igorbenav , thanks for reply. When I remove the network setting from docker compose am get another error. File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 734, in lifespan
|
@rithin were you able to fix this? Sorry, I missed the last reply |
@igorbenav no, still create_superuser-1 and create_tier-1 not running and trhowing error. 2024-03-10 16:52:06 INFO:main:Admin user rithin already exists.
|
API's giving 404.
I build using docker-compose
My latest code can see here-> https://github.com/rithin/kappitrails_api/tree/development_v1
Description
only apis are working if i wrote in the main.py but what in api/v1/users.py or any other
Screenshots
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: