Django可以为我的PHP应用程序的现有模式执行自动管理吗? [英] Can Django do auto-admin for my PHP app's existing schema?

查看:79
本文介绍了Django可以为我的PHP应用程序的现有模式执行自动管理吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个生产应用程序与一个子标准的管理界面。该应用程序是用PHP编写的,由PostgreSQL支持。



我已经对Django进行了简短的修改,并且非常深刻的感觉到管理界面的启动和运行十分简单



有人可以更有经验的Django请评论:




  • 有Django在我的现有架构周围构建一个管理应用程序类似的方式吗?如果是这样,

  • 你会推荐它/有什么问题吗?



我可以看到,我将保留两个模型:一个用Python编写,一个在PHP中。可以通过Django获得管理界面的速度,这使得它非常诱人。



感谢
Harry

解决方案

您可以使用manage.py的 inspectdb 命令,然后将管理功能添加到生成的模型中。


$ b $我没有尝试过,但是我使用inspectdb输出通过Django访问一些phpbb表,似乎工作正常。



你可以遇到问题,如果应用程序自己的管理界面不仅仅是简单的CRUD(比如更新其他表格中的非规范化字段等等)。改进当前管理界面可能不如在新版本中重现这些东西(更不用说如果您以后需要更改其逻辑会发生什么情况),那么可能不那么痛苦。


I have an application in production with a sub-standard admin interface. The app is written in PHP and is backed by PostgreSQL.

I have briefly tinkered with Django and am very impressed with how easy it is to get an admin interface up and running.

Can someone more experienced with Django please comment on:

  • Can I have Django build an admin app around my existing schema with similar ease? And if so,
  • Would you recommend it / are there any gotchas?

One gotcha I can see is that I'll be maintaining two models: one written in Python and one in PHP. The speed with which one can get an admin interface up-and-running with Django though, makes it very tempting.

Thanks Harry

解决方案

You can create django site that is linked to an existing database by using manage.py's inspectdb command, and then add admin functionality to the resulting models.

I haven't tried this, but I used inspectdb output to access some phpbb tables via Django and it seems to work fine.

You can encouncer problems if the app's own admin interface does more than simple CRUD (such as updating denormalized fields in other tables and so on). It may be less pain to improve current admin interface than to reproduce these things in the new one (not to mention what would happen if you needed to change their logic in the future).

这篇关于Django可以为我的PHP应用程序的现有模式执行自动管理吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆