[英]How can I integrate a wordpress front-end on top of my existing Django web application
I have built a new website using wordpress which looks great and has required blogging functionality. 我使用wordpress构建了一个新网站,它看起来很棒并且需要博客功能。
Our old site was built using Django and looked awful but had required backend functionality built into it thanks to Django. 我们的旧网站是使用Django构建的,看起来非常糟糕,但由于Django,它需要内置后端功能。 For example on one page it has a drop down box and you select options from it and it returns data, which works fine on the Django website.
例如,在一个页面上它有一个下拉框,你从中选择选项并返回数据,这在Django网站上运行正常。
I want to integrate this functionality into the wordpress front-end somehow. 我想以某种方式将此功能集成到wordpress前端。 Is this possible?
这可能吗? If so can you suggest how I might do this?
如果是这样,你能建议我怎么做吗?
I understand that wordpress is a PHP CMS, and Django is a Python framework so you can't simply click them together. 我知道wordpress是一个PHP CMS,而Django是一个Python框架,所以你不能简单地将它们一起点击。 But does anyone have any suggestions on how I might integrate the functionality from my existing Django website inside my wordpress front end.
但是有没有人对如何在我的wordpress前端集成现有Django网站的功能有任何建议。
I have found this question: Wordpress on Django 我发现了这个问题: Django上的Wordpress
Which asked how to connect to wordpress from Django. 其中提到了如何从Django连接到wordpress。 But I would like to connect to Django from wordpress.
但我想从wordpress连接到Django。
In essence I want to replicate some of the Django pages on my wordpress site, utilising the existing Django backend functionality. 本质上我想利用现有的Django后端功能在我的wordpress网站上复制一些Django页面。
Can this be done? 可以这样做吗? Any suggestions as to how?
有关如何的任何建议?
Thanks. 谢谢。
I will share my experience in creating a hybrid solution and although for me it was two different PHP frameworks the approach could be the same. 我将分享我在创建混合解决方案方面的经验,虽然对我来说这是两种不同的PHP框架,但这种方法可能是相同的。 It's not a ready-to-go solution, but maybe it will help.
它不是一个随时可用的解决方案,但它可能会有所帮助。 I will list key points.
我将列出关键点。
localhost/wordpress
and localhost/django
so that rewrite rules do not interfere. localhost/wordpress
和localhost/django
这样重写规则就不会干扰。 session_set_save_handler()
to register them) session_set_save_handler()
进行注册) localhost/django/oldfunction
localhost/django/oldfunction
PHPSESSID
from cookies, and use it to read additional session data from the database (user_id for instance) and create a session. PHPSESSID
,并使用它从数据库中读取其他会话数据(例如user_id)并创建会话。 That way you implement "Single Signon" between two apps. This is a complicated approach and it's not fast but it's clean (you have two independent apps) and potentially allows slowly migrating and refactoring the old app functions into new one. 这是一个复杂的方法,它并不快,但它很干净(你有两个独立的应用程序),并可能允许慢慢迁移和重构旧的应用程序功能到新的。 The main thing here to have the access to the same database from both apps and to have them hosted on the same webserver.
这里的主要任务是从两个应用程序访问相同的数据库,并将它们托管在同一个Web服务器上。
Have you tried, https://github.com/agiliq/django-wordpress ? 你试过吗, https://github.com/agiliq/django-wordpress ?
I haven't used it yet. 我还没用过它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.