-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
55 lines (33 loc) · 1.15 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from flask import Flask, render_template, request
from data import Articles
from flask_sqlalchemy import SQLAlchemy
#teste teess
Articles = Articles()
app = Flask(__name__)
app.debug = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:postgres@localhost/flask_test'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
class Owocki(db.Model):
id = db.Column(db.Integer, primary_key=True)
owocek = db.Column(db.String(255), nullable=False)
def __repr__(self):
return self.owocek
@app.route('/')
def index():
return render_template('home.html')
@app.route('/about')
def about():
# colours = ['Red', 'Blue', 'Orange']
colours = Owocki.query.all()
return render_template('about.html', colours=colours)
@app.route('/articles')
def articles():
return render_template('articles.html', articles=Articles)
@app.route("/displayTest", methods=['GET', 'POST'])
def test():
select = request.form.get('comp_select')
return render_template('empty.html', selects=select)
# return str(select) # just to see what select is
if __name__ == '__main__':
app.run(host='0.0.0.0')