Example #1
0
from flask import Flask, send_from_directory

import reynir
from reynir.bindb import BIN_Db
from reynir.fastparser import Fast_Parser

import reynir_correct

from settings import Settings, ConfigError
from article import Article as ArticleProxy


# Initialize and configure Flask app
app = Flask(__name__)
app.config["JSON_AS_ASCII"] = False  # We're fine with using Unicode/UTF-8
app.config["TEMPLATES_AUTO_RELOAD"] = True
app.config["PRODUCTION"] = True


# Register blueprint routes
from routes import routes, max_age

app.register_blueprint(routes)


# Utilities for Flask/Jinja2 formatting of numbers using the Icelandic locale
def make_pattern(rep_dict):
    return re.compile("|".join([re.escape(k) for k in rep_dict.keys()]), re.M)

Example #2
0
import os
import fnmatch
import logging
import atexit
import sqlite3
from datetime import datetime
import codecs
import tempfile
import gzip
import sys
import ConfigParser


app = Flask(__name__, static_url_path='/static')
app.config["JSONIFY_PRETTYPRINT_REGULAR"] = False
app.config["JSON_AS_ASCII"] = False

server_conf = None
logger = None
warncount = 0
songcount = 0


class NotFoundError(Exception):
    pass


class ValidationError(Exception):
    pass