Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CSS not linking with CGI script
#4
Please sto using CGI in Python,it's dead after WSGI.

Use Flask
Eg.
pip install flask
Folder setup:
foo\
app.py
  templates\
  index.html
  static\
    css\
    style.css
app.py
from flask import Flask, render_template

app = Flask(__name__)
@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>
  <title>
    Wsgi trough Flask
  </title>  
  <body>
    <h1>My name is zzzzzz</h1>
  </body>
</html>
style.css
*{
  padding: 0px;
  margin: 0px;
  font-size: 20px;
}
 
h1{
  color: blue;
}
Run python app.py.
In browser http://127.0.0.1:5000/
Reply


Messages In This Thread
CSS not linking with CGI script - by x64 - Nov-11-2016, 01:17 PM
RE: CSS not linking with CGI script - by x64 - Nov-11-2016, 02:41 PM
RE: CSS not linking with CGI script - by snippsat - Nov-11-2016, 03:00 PM
RE: CSS not linking with CGI script - by metulburr - Nov-11-2016, 05:35 PM
RE: CSS not linking with CGI script - by nilamo - Nov-11-2016, 07:25 PM
RE: CSS not linking with CGI script - by x64 - Nov-12-2016, 06:41 AM
RE: CSS not linking with CGI script - by metulburr - Nov-12-2016, 01:51 PM
RE: CSS not linking with CGI script - by wavic - Nov-14-2016, 07:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I need litte help with linking to another website. darktitan 3 2,164 Nov-08-2019, 01:17 PM
Last Post: darktitan

Forum Jump:

User Panel Messages

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