Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flask Issues
#12
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 Wink 
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;
}
Reply


Messages In This Thread
Flask Issues - by iainstott - Oct-27-2016, 06:02 PM
RE: Flask Issues - by micseydel - Oct-27-2016, 06:58 PM
RE: Flask Issues - by iainstott - Oct-27-2016, 07:13 PM
RE: Flask Issues - by micseydel - Oct-27-2016, 07:26 PM
RE: Flask Issues - by iainstott - Oct-27-2016, 07:50 PM
RE: Flask Issues - by iainstott - Oct-28-2016, 11:54 AM
RE: Flask Issues - by iainstott - Oct-28-2016, 02:05 PM
RE: Flask Issues - by snippsat - Oct-28-2016, 02:52 PM
RE: Flask Issues - by iainstott - Oct-28-2016, 04:01 PM
RE: Flask Issues - by snippsat - Oct-28-2016, 05:17 PM
RE: Flask Issues - by iainstott - Oct-29-2016, 02:38 PM
RE: Flask Issues - by snippsat - Oct-29-2016, 04:09 PM
RE: Flask Issues - by iainstott - Oct-29-2016, 06:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  flask issues with app structuring sidk23396 1 1,764 Feb-12-2020, 11:41 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020