Question

I've been trying to build a simple prototype application in Django, and am reaching the point of giving up, sadly, as it's just too complicated (I know it would be worth it in the long-run, but I really just don't have enough time available -- I need something up and running in a few days). So, I'm now thinking of going with PHP instead, as it's the method for creating dynamic web content I'm most familiar with, and I know I can get something working quickly.

My application, while simple, is probably going to be doing some reasonably complex AI stuff, and it may be that libraries don't exist for what I need in PHP. So I'm wondering how easy / possible it is for a PHP script to "call" a Java program or Python script or a program or script in another language. It's not entirely clear to me what exactly I mean by "call" in this context, but I guess I probably mean that ideally I'd like to define a function in, let's say Java, and then be able to call it from PHP. If that's not possible, then I guess my best bet (assuming I do go with PHP) will be to pass control directly to the external program explicitly through a POST or GET to a CGI program or similar.

Feel free to convince me I should stick with Django, although I'm really at the point where I just can't figure out what model I need to produce the HTML form I want, which seems such a basic thing that I fear for my chances of doing anything more complex...

Alternatively, anyone who can offer any advice on linking PHP and other languages, that'll be grateful received.

Was it helpful?

Solution

"where I just can't figure out what model I need to produce the HTML form I want, which seems such a basic thing that I fear for my chances of doing anything more complex"

Common problem.

Root cause: Too much programming.

Solution. Do less programming. Seriously.

Define the Django model. Use the default admin pages to see if it's right. Fix the model. Regenerate the database. Look at the default admin pages. Repeat until the default admin pages work correctly and simply.

Once it's right in the default admin pages, you have a model that works. It's testable. And the automatic stuff is hooked up correctly. Choices are defined correctly. Computations are in the model mmethods. Queries work. Now you can start working on other presentations of the data.

Django generally starts (and ends) with the model. The forms, view and templates are derived from the model.

OTHER TIPS

For an easy access of Java classes from PHP scripts you can use a php-java bridge.

There is a open source solution: http://php-java-bridge.sourceforge.net/pjb/
or a solution from Zend (http://www.zend.com/en/products/platform/product-comparison/java-bridge).

I'm more familiar with the later, and it's very easy and intuitive to use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top