开发者

PHP website with RESTful API using Django. Possible? Good Idea?

开发者 https://www.devze.com 2023-01-13 05:59 出处:网络
I have an existing website written in PHP. I would like to add a REST API.I like how easy creating a RESTful API was using Django.Are there any CONS for usi开发者_C百科ng Django for the sole purpose o

I have an existing website written in PHP. I would like to add a REST API. I like how easy creating a RESTful API was using Django. Are there any CONS for usi开发者_C百科ng Django for the sole purpose of creating an API on a PHP powered website? Thanks in advance.


There are a couple of cons:

  • your codebase will be larger
  • every change in the data model on one side must be done on the other side aswell
  • it will require more resources from your server
  • you have 2 systems to maintain

But for the rest, I can see why it would be easier to do this with Django than it would be to do with a plain PHP API. I have my doubts that there are no PHP libraries available to do something similar though.


I love Django, but I'm not sure that it would benefit you here. Maybe I don't completely understand how you plan to use it, but it seems like if you already have your data access and logic done in PHP then you would have to re-code that in Python in order to leverage Django.

If what you really want is clean urls and simple url mapping then you could probably use CodeIgniter or CakePHP. That way you don't need to rewrite your existing code in Python or having the same code in 2 different languages.

0

精彩评论

暂无评论...
验证码 换一张
取 消