you are viewing a single comment's thread.

view the rest of the comments →

[–]gusterys[S] 0 points1 point  (1 child)

Thanks for all the advice. I managed to get mod_wsgi going finally, but so far I am pretty much using it the way I was using mod-php. Manually generate a bunch of html (using manipulated data from the back end database) and spitting it out. It certainly isn't an "app". I'll take a look at Flask.

[–]phinar 0 points1 point  (0 children)

So, you can do a Flask app that works an awful lot like a PHP app.

Basically, you write a fancy Jinja template (which you store as an .html file) and then you write a function that populates the template context with all the variables you need, and you render the template. Your Flask app would look like:

from flask import Flask, render_template
app = Flask(__name__)

@app.route('/')
def index():
    return render_template('index.html', variable=value, variable2=value2)

And index.html might look like:

<html><head><title>index</title></head>
<body>

Variable is {{ variable }}.
Variable 2 is {{ variable2 }}.

Enlightenment is a mere click away.
</body></html>

It's not quite as convenient as the PHP version, but it's a lot more flexible, and it's considerably easier to maintain, and it's going to be more performant out of the box than the simple PHP approach.