Frage

I've got a django application and a WordPress install on the same server. The public website is WordPress and the django app deals with some aspects of the website.

(The site is a theatre website, the django app deals with upcoming shows and ticket reservations)

The way I'm interfacing this at the moment is django outputting bare-bones HTML and WordPress pulling it in like this:

<?php
$data=file_get_contents('http://localhost:8000/list');
echo $data;
?>

While the ticket reservation requires an iframe-ed form.

My question is, is there a better way? Would using JSON be better? If the content was pulled in with javascript it would allow more caching on the WordPress side. Is SOAP something to use?


The django app is this: https://github.com/wjdp/nt-tickets

War es hilfreich?

Lösung

The best way would be to create an API that your public facing site can use. This way any site, app or program could use your API.

Take a look at TastyPie and API framework for Django, it's very simply to implement.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top