import json import psycopg2 from flask import Flask, jsonify from psycopg2 import sql app = Flask(__name__) app.config['ENV'] = "development" app.config['DEBUG'] = True # Testing: Exceptions are propagated rather than handled by the the app’s error handlers. Extensions may also change their behavior to facilitate easier testing. You should enable this in your own tests. app.config['TESTING'] = False @app.route('/') def index(): with psycopg2.connect(database='temperatures_berteld_morstein', user='postgres', password='postgres', host='localhost', port=5432) as connection: with connection.cursor() as cursor: # query = sql.SQL("""CREATE TABLE stations ({});""".format(columns_clean)) pass return jsonify({'läuft': 'jo'}) app.run(host='127.0.0.1', port=42000)