• bilicale

    (@bilicale)


    Hi,

    I have an existing web application written in the Python web framework Flask (http://flask.pocoo.org/).
    I am considering using WordPress as a front end for this application. I.e.: I want to use WordPress on the main site: http://www.example.com. WordPress will then function as a normal CMS. Some of the pages in WordPress will be “special” in that they contain a form that submits data (either directly or through some client side AJAX) to app.example.com on which the existing Flask web application resides. WordPress should then handle the results and display the results in a proper template.

    The web application is a shop-like application that allows the user to search for various products using very specific criteria. It includes HTML forms as well as presents search results/products using HTML and images.
    I imagine that I will have to rewrite the existing Flask application so that it functions as a RESTful service and instead of returning HTML/pictures for search results, it instead returns a JSON response with all the necessary data that WordPress can then display nicely in a template.

    So my question is: What is the best way of using WordPress as a front end to an existing web application?

    Is this even possible (or advisable)?

    Where do I start? Should this be made as a plugin for WordPress? Or can it be done entirely by making special templates and jQuery?

    I have considered using WordPress Services because it sounded like it was an API for this, however, it turned out that Services solves the reverse problem: Makes it possible to use an external app as front end for a WordPress site.

    I do not know much about WordPress. The reason I am considering WordPress is that the users are already familiar with using WordPress as a CMS. I do have several years experience with PHP.

    Some extra info about the web app:

    * Web app is written in Python/Flask
    * It is a web shop like application that allows users to search for products based on various criteria.
    * Web app is highly modular and cleanly split into views, forms, model, so it would be fairly straight forward to change the web app in order to present data via another protocol/API. I figure it would be possible to create new views that present the data in JSON or something like that and I hope that WordPress can somehow pick that up and display it in its templates.
    * Database is PostgreSQL
    * Frameworks used: Flask, SQLAlchemy, WTForms

Viewing 1 replies (of 1 total)
  • Evan Herman

    (@eherman24)

    I would recommend posting this in the advanced forums, doing ton’s of research and possibly hiring someone as this is a monstrous task, especially for someone not familiar with WordPress.

    I would recommend waiting for the REST API to hit core, or you can start using the plugin right now.
    https://wordpress.org/plugins/json-rest-api/

    In short, Yes this is possible.

    Evan

Viewing 1 replies (of 1 total)

The topic ‘WordPress as front end to existing web application’ is closed to new replies.