<commit_before>import os

from flask import Flask, url_for

from charat2.model.connections import (
    db_commit,
    db_disconnect,
    redis_connect,
    redis_disconnect,
    set_cookie,
)
from charat2.views import root, account, rp, blog
from charat2.views.rp import chat, chat_api

from flask.ext.babel import Babel, gettext

app = Flask(__name__)
app.url_map.strict_slashes = False
app.config["SERVER_NAME"] = os.environ["BASE_DOMAIN"]

babel = Babel(app)
app.jinja_env.globals.update(gettext=gettext)

app.before_request(redis_connect)

app.after_request(set_cookie)
app.after_request(db_commit)

app.teardown_request(db_disconnect)
app.teardown_request(redis_disconnect)

# Root domain (charat.net)

app.add_url_rule("/", "home", root.home, methods=("GET",))

app.add_url_rule('/favicon.ico', redirect_to=url_for('static', filename='img/favicons/root/favicon.ico'))

app.add_url_rule("/feed", "feed", root.feed, methods=("GET",))

app.add_url_rule("/login", "login_get", account.login_get, methods=("GET",))
app.add_url_rule("/register", "register_get", account.register_get, methods=("GET",))
app.add_url_rule("/login", "login_post", account.login_post, methods=("POST",))
app.add_url_rule("/logout", "logout", account.logout)
app.add_url_rule("/register", "register", account.register, methods=("POST",))

# RP subdomain (rp.charat.net)

app.add_url_rule("/", "rp_home", rp.home, subdomain="rp", methods=("GET",))

app.add_url_rule('/favicon.ico', redirect_to=url_for('static', filename='img/favicons/rp/favicon.ico'))

app.add_url_rule("/rooms", "rooms", rp.rooms, subdomain="rp", methods=("GET",))

app.add_url_rule("/create_chat", "create_chat", chat.create_chat, subdomain="rp", methods=("POST",))
app.add_url_rule("/<url>", "chat", chat.chat, subdomain="rp", methods=("GET",))

app.add_url_rule("/chat_api/messages", "messages", chat_api.messages, subdomain="rp", methods=("POST",))
app.add_url_rule("/chat_api/send", "send", chat_api.send, subdomain="rp", methods=("post",))
app.add_url_rule("/chat_api/set_state", "set_state", chat_api.set_state, subdomain="rp", methods=("POST",))
app.add_url_rule("/chat_api/set_group", "set_group", chat_api.set_group, subdomain="rp", methods=("POST",))
app.add_url_rule("/chat_api/user_action", "user_action", chat_api.user_action, subdomain="rp", methods=("POST",))
app.add_url_rule("/chat_api/set_flag", "set_flag", chat_api.set_flag, subdomain="rp", methods=("POST",))
app.add_url_rule("/chat_api/set_topic", "set_topic", chat_api.set_topic, subdomain="rp", methods=("POST",))<commit_msg>let's do more with favicon<commit_after>import os

from flask import Flask, url_for

from charat2.model.connections import (
    db_commit,
    db_disconnect,
    redis_connect,
    redis_disconnect,
    set_cookie,
)
from charat2.views import root, account, rp, blog
from charat2.views.rp import chat, chat_api

from flask.ext.babel import Babel, gettext

app = Flask(__name__)
app.url_map.strict_slashes = False
app.config["SERVER_NAME"] = os.environ["BASE_DOMAIN"]

babel = Babel(app)
app.jinja_env.globals.update(gettext=gettext)

app.before_request(redis_connect)

app.after_request(set_cookie)
app.after_request(db_commit)

app.teardown_request(db_disconnect)
app.teardown_request(redis_disconnect)

# Root domain (charat.net)

app.add_url_rule("/", "home", root.home, methods=("GET",))

#app.add_url_rule('/favicon.ico', redirect_to=url_for('static', filename='img/favicons/root/favicon.ico'))

app.add_url_rule("/feed", "feed", root.feed, methods=("GET",))

app.add_url_rule("/login", "login_get", account.login_get, methods=("GET",))
app.add_url_rule("/register", "register_get", account.register_get, methods=("GET",))
app.add_url_rule("/login", "login_post", account.login_post, methods=("POST",))
app.add_url_rule("/logout", "logout", account.logout)
app.add_url_rule("/register", "register", account.register, methods=("POST",))

# RP subdomain (rp.charat.net)

app.add_url_rule("/", "rp_home", rp.home, subdomain="rp", methods=("GET",))

#app.add_url_rule('/favicon.ico', redirect_to=url_for('static', filename='img/favicons/rp/favicon.ico'))

app.add_url_rule("/rooms", "rooms", rp.rooms, subdomain="rp", methods=("GET",))

app.add_url_rule("/create_chat", "create_chat", chat.create_chat, subdomain="rp", methods=("POST",))
app.add_url_rule("/<url>", "chat", chat.chat, subdomain="rp", methods=("GET",))

app.add_url_rule("/chat_api/messages", "messages", chat_api.messages, subdomain="rp", methods=("POST",))
app.add_url_rule("/chat_api/send", "send", chat_api.send, subdomain="rp", methods=("post",))
app.add_url_rule("/chat_api/set_state", "set_state", chat_api.set_state, subdomain="rp", methods=("POST",))
app.add_url_rule("/chat_api/set_group", "set_group", chat_api.set_group, subdomain="rp", methods=("POST",))
app.add_url_rule("/chat_api/user_action", "user_action", chat_api.user_action, subdomain="rp", methods=("POST",))
app.add_url_rule("/chat_api/set_flag", "set_flag", chat_api.set_flag, subdomain="rp", methods=("POST",))
app.add_url_rule("/chat_api/set_topic", "set_topic", chat_api.set_topic, subdomain="rp", methods=("POST",))
{'fraction_non_alphanumeric': 0.19052281182690425, 'fraction_numerical': 0.0011748580379870766, 'mean_word_length': 7.945709281961471, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '69133', 'n_tokens_mistral': 1908, 'n_tokens_neox': 1882, 'n_words': 283}