Flask app.py
==================
@app.route( '/' )
@app.route( '/<page>' )
def index( page ):
# use the variable form template for displaying
counter = '''<center>
<table bgcolor=black bordercolor=orangered>
td><font size=3 color=lime> Αριθμός Επισκεπτών: </font></td>
<td><a href="{{ url_for( '/log', page='%s' ) }}"><font size=3 color=plum> %d </font></a></td>
</table>
''' % (page, pagehit)
if page != 'index.html':
pdata = redirect( '
http://superhost.gr/cgi-bin/' + page )
return pdata
Template ndex.html
==================
<div align=right>
<a href="{{ url_for( '/', page='some_value' ) }}"> <img src="/static/images/π.gif"> </a>
</div>
<a href="{{ url_for( '/', page='another_value' ) }}"> <img src="/static/images/download.gif"></a>
1. All i want ro do is when the user clicks on the images within the html tamplate, to pass those variables value to '/' route so to perfrom then asome action with those values
The error iam receiving is this:
===============================
builtins.TypeError
TypeError: index() missing 1 required positional argument: 'page'
I mean i do have <page> declared in route and also do have 'page' as variable to the callback fucntion, why cant it see it?
2. Also about the redirect funtion iam using... is there a way to get back the HTML response of running that cgi-scrit and then add another HTML value to that response? I used subprocess and Response but they weren able to deliver the content back the pdata variable for display.
What i actually want to do among other things is from within my flask app script to try to run and get theresponse back of a cgi-script