1

I have developed a Django e-commerce platform and then realized that I need to use FastAPI with it in order for my website to accept payments from the square payment system.

I have looked through their documentation about how to do it, and they use fast API. However, I have no experience using Fast API at all.

Is there a way for me to set up this fast API functionality without changing my Django project (so that it runs "together" with my Django app)? Or maybe there is another way which you would recommend me to use?

illymarev
  • 237
  • 2
  • 13
  • I was thinking about starting 2 docker containers together, where one will be for my website, and another will be for the FastAPI. Is it a good idea or not? – illymarev Sep 22 '21 at 21:44
  • yes this is possible. [just visit this link](https://stackoverflow.com/questions/63726203/is-it-possible-to-use-fastapi-with-django) – azhar Sep 22 '21 at 21:49
  • @azhar, but this way means that I will need to change all my code in the Django app so that it fits fast API, doesn't it? – illymarev Sep 22 '21 at 21:58

2 Answers2

0

Yes there is django ninja having a similar Interface like FastAPI.

It also uses the same concept of routes and model definition with pydantic.

So you should be able to adopt the given example easily to the ninja api which works well in django.

Kound
  • 1,835
  • 1
  • 17
  • 30
0

Try django-mini-fastapi.

This is a django adapter for FastAPI, you could get most of FastAPI function working without re-writing your whole legacy django project.

Disclaimer: I'm the author of that repo. Also I've used this library on a production grade EC site without any problem.

toki
  • 1
  • 1
  • 3