<commit_before>from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def home():
    return render_template('home.html')

if __name__ == '__main__':
    app.run(host="127.0.0.1", port=6666, debug=True) <commit_msg>Add DB connection decorator to routes.py<commit_after>from flask import Flask, render_template, redirect
import psycopg2
import os
import urlparse

app = Flask(__name__)


def connectDB(wrapped):
    def inner(*args, **kwargs):
        api_token = os.<PASSWORD>["API_TOKEN"]
        urlparse.uses_netloc.append("postgres")
        url = urlparse.urlparse(os.environ["DATABASE_URL"])
        conn = psycopg2.connect(
            database=url.path[1:],
            user=url.username,
            password=<PASSWORD>,
            host=url.hostname,
            port=url.port
        )
        cur = conn.cursor()
        ret = wrapped(*args, **kwargs)
        return ret
    return inner


@app.route('/')
def home():
    return render_template('home.html')


@app.route('/participants')
@connectDB
def participants():
    return render_template('participants.html')


@app.route('/setup')
def setup():
    return render_template('setup.html')


@app.route('/register')
def register():
    return render_template('register.html')


@app.route('/complete', methods=['POST'])
@connectDB
def complete():
    return redirect('/')


if __name__ == '__main__':
    app.run(host="127.0.0.1", port=6666, debug=True)
{'fraction_non_alphanumeric': 0.14948096885813147, 'fraction_numerical': 0.01591695501730104, 'mean_word_length': 3.4220183486238533, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1611989', 'n_tokens_mistral': 474, 'n_tokens_neox': 455, 'n_words': 97}