<commit_before>from flask import Flask

app = Flask(__name__)
app.config.from_object(__name__)


<commit_msg>Can now log in and out with statically configured user.<commit_after>import os
from flask import Flask, request, session, g, redirect, url_for, abort, \
     render_template, flash
import redis

app = Flask(__name__)
app.config.from_object(__name__)
app.config.from_envvar('FLASKR_SETTINGS', silent=True)

app.config.update(dict(
  SECRET_KEY='development key',
  USERNAME='admin',
  PASSWORD='<PASSWORD>'
))

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

@app.route('/login', methods=['GET', 'POST'])
def login():
  error = None
  if request.method == 'POST':
    if (request.form['username'] != app.config['USERNAME']) or \
       (request.form['password'] != app.config['PASSWORD']):
      error = 'Invalid login'
    else:
      session['logged_in'] = True
      flash('You were logged in')
      return redirect(url_for('login'))
  return render_template('login.html', error=error)

@app.route('/logout')
def logout():
  session.pop('logged_in', None)
  flash('You were logged out')
  return redirect(url_for('login'))
{'fraction_non_alphanumeric': 0.1559792027729636, 'fraction_numerical': 0.0, 'mean_word_length': 4.862944162436548, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4956532', 'n_tokens_mistral': 378, 'n_tokens_neox': 372, 'n_words': 89}