You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I wanted to use Django Ninja on my production server. While working locally I noticed that most of the requests were taking literally minutes to be processed by API and when doing GET requests nothing was displayed. Like server was processing info whole time. It was really confusing because I was searching bugs in my apps logic, but even trivial functions were having issues. Interesting thing. While making queries in Django shell I was getting immediate query results after made POST requests, but when doing GET requests which were using same functions nothing was present.
I thought this happened, because I exposed my server on 0.0.0.0:8000 (After I rewrote app to DRF I had similar issues when running locally) and server was taking some time to resolve IP's. I decided to make unfinished deploy on dev server but same thing was happening. Now, when app is rewritten to DRF everything works as expected. Same queries and same config for Gunicorn and Nginx.
I used PostgreSQL 100% of the time. When looking for issues I tried to use SQLite, but nothing changed. Also tried to drop Docker and use virtual env. Same thing.
Sadly this issue didn't raise any errors
Example:
## logic.py
def get_user_banks_qs(user: User) -> QuerySet[BankAlias]:
return BankAlias.objects.filter(user=user).values("id", "name").order_by("name")
def add_new_bank_alias(*, user: User, name: str) -> BankAlias:
"""Create new bank alias for user"""
bank_alias, _ = BankAlias.objects.get_or_create(user=user, name=name)
return bank_alias
well I do not think anyone can help you find the issue - you need to at least put some time prints to understand which part of you code does the bottleneck - maybe it's net, maybe database, may be something else
also would be good to know how many records are in your database (BankAlias model specifically) and if it has any indexes
Hi, I wanted to use Django Ninja on my production server. While working locally I noticed that most of the requests were taking literally minutes to be processed by API and when doing GET requests nothing was displayed. Like server was processing info whole time. It was really confusing because I was searching bugs in my apps logic, but even trivial functions were having issues. Interesting thing. While making queries in Django shell I was getting immediate query results after made POST requests, but when doing GET requests which were using same functions nothing was present.
I thought this happened, because I exposed my server on 0.0.0.0:8000 (After I rewrote app to DRF I had similar issues when running locally) and server was taking some time to resolve IP's. I decided to make unfinished deploy on dev server but same thing was happening. Now, when app is rewritten to DRF everything works as expected. Same queries and same config for Gunicorn and Nginx.
I used PostgreSQL 100% of the time. When looking for issues I tried to use SQLite, but nothing changed. Also tried to drop Docker and use virtual env. Same thing.
Sadly this issue didn't raise any errors
Example:
Dev:
Server:
The text was updated successfully, but these errors were encountered: