Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Adrian Garcia Badaracco
    @adriangb
    I believe that if you are not doing blocking sync stuff (e.g. using a sync library that does IO), you're better off declaring async def even if you're not actually doing any async stuff, that way you don't push execution into a thread (which I think would introduce overhead)
    oXo
    @oXoi
    need some help.
    oXo
    @oXoi
    i am using django+nginx+uvicorn+supervisor to show my wesite. but I did not declare async def to my function in views.py
    Marcelo Trylesinski
    @Kludex
    continue
    oXo
    @oXoi
    I want to know that whether my project is running asyncronously, if it dont, can you guys show me how to change my code . I already searched a lot but found nothing useful,
    nix.pub
    oXo
    @oXoi
    i tried to add async to the get function in views.py .it throwed me a "AssertionError:Expected a Response,HttpResonse or HttpStreamingResponse to be returned from the view , but received a <classs coroutine>"
    does the "async "must be used with "await "? i am a little confused😥
    oXo
    @oXoi
    sorry to bother you so late. go get a good sleep then back to help me .good night everyone😊
    Marcelo Trylesinski
    @Kludex
    it's 11:10 here hahaha
    oXo
    @oXoi
    its 17:17 here😄
    so,Do I need to change the function in views.py or somewhere of the project?
    oXo
    @oXoi
    () class QuotesView(): def get(self,requests): quote=Quotes.objects.filter(hide=False).filter(pk=1).values("content") return JsonResponse({"quote": dict(quote[0])["content"]}) ()
    2 replies
    can you help me to rewrite it in "async " way?
    Marcelo Trylesinski
    @Kludex
    I cannot. Sorry. I'm not familiar with Django.
    It looks like this test is failing on Starlette "randomly"? https://github.com/encode/starlette/runs/3639931739?check_suite_focus=true
    I guess the PR from @florimondmanca fixes this as well?
    Marcelo Trylesinski
    @Kludex
    @tomchristie I want to tackle this: https://github.com/encode/starlette/discussions/1192#discussioncomment-810371
    I can't think of a way to use the same structure as you mention in that comment, if I got it right. Do you have any tips to help here?
    Marcelo Trylesinski
    @Kludex
    Help on encode/uvicorn#1191 is appreciated. :)
    Nate W
    @natew100
    Hi, are we not able to use custom h2 pseudo headers with httpx? i get illegal header name errors if i try, such as ':method': ''
    ohmeow
    @ohmeow
    Is there an example of integrating the ORM in a fastapi application?
    Adrian Garcia Badaracco
    @adriangb
    @oXoi check the FastAPI docs, they have examples with SQLAlchemy. Also I would posy in a FastAPI channel, this one is for Starlette
    (sorry wrong tag, meant @ohmeow )
    ohmeow
    @ohmeow
    yah saw those @adriangb ... just wondering what else needs to get included to make the ORM bits work. I'm playing with it right now
    ohmeow
    @ohmeow
    I create my Database (and connect to it) in a method that gets called at "startup", and then I store it in app.state. Wondering when I should create the ModelRegistry, associate that registry to the DB models, and then store everything for use in the application?
    2 replies
    ohmeow
    @ohmeow
    Ideally, I'd like to put all my models in a models.py and have each models registry assigned after the database is created.
    Hector
    @hjastenger
    Hi all, question regarding http/2 pipelining/multiplexing. Right now, unless I do something wrong ofcourse, if I send multiple requests over the same connection, and thus have multiple awaitables, it looks like the first awaitable is being blocked until the last awaitable is ready. So in this case im sending a (GET or POST) request using create_task and im spacing them out over 50ms.
    Tom Christie
    @tomchristie
    @hjastenger Shouldn't be, nope.
    Hector
    @hjastenger
    @tomchristie Thanks for the reponse! Ill dive a bit deeper to see what I'm doing wrong.
    Lucas M.R.
    @mrlucasrib

    Hi all, I saw that the GraphQL starlette module is deprecated and has some suggestions for replacement. Which one works best with FasAPI?

    GraphQL support in Starlette is deprecated as of version 0.15 and will be removed in a future release. It is also incompatible with Python 3.10+. Please consider using a third-party library to provide GraphQL support. This is usually done by mounting a GraphQL ASGI application. See #619. Some example libraries are:
    Ariadne
    tartiflette-asgi
    Strawberry
    starlette-graphene3
    https://www.starlette.io/graphql/

    Marcelo Trylesinski
    @Kludex
    strawberry
    Dylan Richardson
    @dylrich

    Hi there! We're trying to understand a bug we are hitting in our FastAPI app that uses uvicorn, uvloop and httptools that sometimes happens when we are parsing many url params. We've spent a long time digging through source and discovered that our issue seems to be that the entire url is sent in chunks to HTTPToolsProtocol's data_received method, leading to the on_url callback getting called with incomplete data multiple times.

    I am unfamiliar with how these event loops are supposed to work, is it expected that data_received is called with the url still streaming in? Should the on_url callback be protecting against data still streaming in? I'd be happy to open an issue after I understand the problem a bit better. We are on a year-old version (0.11.8), it's possible this was a known bug that has already been fixed.

    Dylan Richardson
    @dylrich
    We've discovered that this bug only happens with httptools, not H11
    Marcelo Trylesinski
    @Kludex
    upgrade the package versions and check if it's solved, if not, open an issue on uvicorn following the issue template, and I'll check tomorrow
    fessacchiotto
    @fessacchiotto
    hi! is this the right place to ask about encode/database? the link on the web site to the community doesn't work... thank you
    wrong link: Community: https://discuss.encode.io/c/databases
    Marcelo Trylesinski
    @Kludex
    it is
    Derry Livenski
    @hyperking
    Does starlette have a routing class for creating a non-async WSGI route?
    3 replies
    graingert
    @graingert:matrix.org
    [m]
    Thoughts on https://datatracker.ietf.org/doc/html/rfc7239 support in uvicorn (enabled with --proxy-headers)?
    Grégoire Roussel
    @Arpafaucon
    Hey :) Hoping to find someone with the answer here, my online searches led me nowhere.
    Does anyone know why my app launched with gunicorn server:app -k uvicorn.workers.UvicornWorker generates a core dump when I press Ctrl-C to make it exit ?
    Marcelo Trylesinski
    @Kludex
    yes
    because gunicorn wishes so
    I asked clarifications some time ago on that issue, still haven't received a reply
    in any case, the question is about gunicorn
    Grégoire Roussel
    @Arpafaucon
    thanks a lot ! I will read that in details :)
    samar1066
    @samar1066
    Hello, I am not able to install httpx[http2] with "pip3 install httpx[http2]", can anyone help? I just get "no matches found: httpx[http2]"
    1 reply
    Alex Grönholm
    @agronholm
    @samar1066 is your pip version very old?
    graingert
    @graingert:matrix.org
    [m]
    @samar1066 Try python3 -m pip install 'httpx[http2]'?
    1 reply
    fessacchiotto
    @fessacchiotto
    I’m planning a small cluster of microservices based on starlette to deliver data from a postgres managed db on digital ocean, behind an nginx api gateway. I’m thinking to dedicate one service to client suthentication (JWT). What solution do you recommend to use (package) by having in mind to do not reinvent the wheel ? Thank you
    2 replies
    Derry Livenski
    @hyperking
    does anyone have an example NGINX setup with starlette?