Async Class Based Views in Django

Viewed 275

I am new to Django and I have been working on a Stripe based application and I found out that my class based views are quiet slow and I need to make them run as fast as possible. I discovered that in Django there is Asynchronous Support available but I am unable to figure how can I use it in class based views everywhere I find there are functional based example just.

Django documentation that I was looking into was: Django Asynchronous Support

I want to make my Stripe call faster. Any help will be appreciated I am new and learning Django.

1 Answers

Whenever you need to improve performance, start with a profiler. The slow part might not be what you expect.

I suspect, in particular, that calling the Stripe API as part of a routine JSON conversion could be slow. You may want to cache a copy of the Stripe API data in a Subscription model, so you don't have to hit an external API on every request. However ... again ... make sure you profile first.

Related