DULMANDAKH Sukhbaatar wrote:
>> when i use my hosting provider (mediatemple) which i believe is
>> running django via a fast cgi container setup. overall, the setup
>> seems to work, no errors, definately calling php.py, and detects the
>> php:file.php tags, but no php is converted into the template output.
>> blank text, not even the original php..so, it seems to run the php,
>> but never updates the templates with the output.
>>     
>
> As I understand, you want to run php script or template inside Django.
> Am I right? It's impossible, because Django is, as you may know,
> written in python. Python and PHP are completely separate languages
> with completely different syntax and so on.
>   
You didn't follow the link that was provided. Ticket #2440 includes a
patch that does just that. A php script may not be Python, but it
definitely isn't hard to run a PHP script, and that's exactly what this
does. Craic is having difficulty with this particular patch.

As for using this patch, it was in fact marked as 'wontfix'. Any time I
need to use the same template in two places, I just make a copy and
maintain it in two different spots. Things like CSS can be common, but
storing the HTML in two different spots really shouldn't be too
cumbersome. If set up properly, you'll only need to change two files;
one for your PHP template, and one for your Django template. Anything
else that needs to be changed would be CSS, which can be shared (unless
your template engine generates CSS on the fly), or you'd be changing
some piece of functionality that should be only in your PHP app, or only
in your Django app.

It'd also speed things up a bit, because you won't be using os.open or
subprocess to run PHP each time your cache runs dry and need to
re-generate the template. One of the reasons to move to Django from PHP
is to get away from PHP's faults, but you're suggesting to re-introduce
them by putting them underneath your Django app. I'm sure this isn't
what you wanted to hear, but I disagree with the concept of running PHP
to get an html template into Django, though I think it's kind of cool
that someone has done it. :p


Take care!

Jeff Anderson

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to