-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
32 lines (20 loc) · 691 Bytes
/
app.py
File metadata and controls
32 lines (20 loc) · 691 Bytes
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
import psycopg2
from flask import Flask, render_template, request
import parser_practice
app = Flask(__name__)
@app.route('/')
def vacancies():
return render_template('home.html')
@app.route('/search', methods=['POST'])
def search():
conn = psycopg2.connect(**parser_practice.db_config)
cur = conn.cursor()
keyword = request.form['query']
parser_practice.parse_vacancies(keyword)
cur.execute('SELECT title, salary, schedule, experience, city, employer, url FROM vacancies')
rows = cur.fetchall()
cur.close()
conn.close()
return render_template('all_vac.html', data=rows, keyword=keyword)
if __name__ == '__main__':
app.run(debug=True)