|
|
|
@ -4,7 +4,8 @@ import sqlalchemy
|
|
|
|
|
from sqlalchemy.sql import select
|
|
|
|
|
from sqlalchemy.sql import text
|
|
|
|
|
from flask import Flask
|
|
|
|
|
from flask import render_template, send_from_directory
|
|
|
|
|
from flask import render_template, send_from_directory, request
|
|
|
|
|
from werkzeug.utils import secure_filename
|
|
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
|
@ -57,6 +58,16 @@ def getfile(filename):
|
|
|
|
|
|
|
|
|
|
return send_from_directory('/srv/datasheets/', 'filename')
|
|
|
|
|
|
|
|
|
|
@app.route('/parts/alter/<partID>', methods=['POST'])
|
|
|
|
|
def alter(partID):
|
|
|
|
|
'''if 'file' not in request.files:
|
|
|
|
|
pass
|
|
|
|
|
else:
|
|
|
|
|
file = request.files['file']
|
|
|
|
|
filename = secure_filename(file.filename)
|
|
|
|
|
file.save(os.path.join('/srv/datasheets', filename))'''
|
|
|
|
|
print dict(request)
|
|
|
|
|
|
|
|
|
|
def connect(user, password, db, host='localhost', port=5432):
|
|
|
|
|
'''Returns a connection and a metadata object'''
|
|
|
|
|
# We connect with the help of the PostgreSQL URL
|
|
|
|
|