Quote:But then after a couple more hours playing and learning, found a few more limitations of flask that I couldn't live with. So today I am starting to tackle at starting again with django.
The limitations is not on Flask,it's on your side
It's the same in Django,so that wont help.
Flask is also a better choice for Raspberry Pi.
Can take the basic of this.
Look at this
Pen with you css code.
So here use url link for images,
If want to use images from disk has to load them from server.
Here the same in Flask.
Folder setup:
button_img\
app.py
templates\
index.html
static\
css\
style.css
images\
owl.jpg
round.gif
app.py:
from flask import Flask, render_template
app = Flask(__name__, static_url_path='')
@app.route("/")
def bak_image():
return render_template("index.html")
if __name__ == '__main__':
app.run()
index.html:
<html>
<head>
<link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/style.css') }}" />
</head>
<body>
<p>Does button work?</p>
<button id=submit type="submit" value="Submit"></button>
</body>
</html>
style.css:
#submit {
color: #fff;
font-size: 0;
width: 80px;
height: 80px;
border: none;
margin: 0;
padding: 0;
background-image: url('../images/owl.jpg');
background-repeat: no-repeat;
}
#submit:hover {
background-image: url('../images/round.gif');
background-repeat: no-repeat;
}