Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import render_template, url_for, request, Blueprint
- import pymssql
- shipworks = Blueprint('shipworks', __name__,
- template_folder='templates')
- import pymssql
- conn = pymssql.connect(
- server="WAHOO\SHIPWORKS",
- port=1433,
- user="sa",
- password="gr##%%51",
- database="ShipWorks_Local")
- @shipworks.route("/shipworks")
- def shipworks_view():
- return render_template("shipworks_customers.html")
- #
- @shipworks.route("/shipworks/data", methods=['POST'])
- def get_shipworks_customers():
- if request.method == 'POST':
- if request.form['submit'] == 'Get Data':
- title = "Database View"
- if request.method == 'POST':
- cursor = conn.cursor(as_dict=True)
- cursor.execute('SELECT * FROM Customer')
- for row in cursor:
- return row['BillFirstName']
- elif request.form['submit'] == 'Do Something Else':
- pass # do something else
- else:
- pass # unknown
- elif request.method == 'GET':
- return render_template("shipworks_data.html")
- #
- #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement