Build API for Django with Foxx or use ArangoDB Python driver?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 13:12:12

问题


I would like to use ArangoDB in Django, but I don't know which of the following options is better: using the ArangoDB Python driver or building a new API with Foxx. I think that the ArangoDB Python driver is not based on Foxx and I don't know the pros and cons of building a new API from scratch, even if it is made easier by Foxx. In addition, I'm afraid that using javascript in the interface between Foxx and the backend could make things slower. Would it be faster if I used Guacamole ODM together with Ruby on Rails?


回答1:


Better option for your case is to use ArangoDB Python driver.

Here is couple of reasons:

  • easy-to-start - just install driver and move on with development
  • some similarity to Django ORM API
  • have some documentation
  • all your business logic will be in place and in Python which should be great advantage

And here is why Foxx is not the best option for your case:

  • you have to build your own API which means:
    • bunch of code in JavaScript
    • some documentation to describe API
  • additional logic level (in Foxx and in Django project) which increase tangling in your project
  • it probably not increase performance because you still retrieve your data using HTTP

Foxx is good option when you build Single page APP using ArangoDB as data layer. Also probably Foxx will be great for building hight-level API's with Foxx as preprocessed/aggregated data provider.




回答2:


I made a python ArangoDB driver (https://github.com/saeschdivara/ArangoPy) and I created on top of that kind of a bridge for Django (https://github.com/saeschdivara/ArangoDjango). So you can use kind of an orm for ArangoDB and still use the Django Restframework to create your API.



来源:https://stackoverflow.com/questions/23894545/build-api-for-django-with-foxx-or-use-arangodb-python-driver

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!