def configure_extensions(app):
    "Configure extensions like mail and login here"
    if app.debug: # in other words Development Config
        try:
            from flaskext.lesscss import lesscss
            lesscss(app)
        except: pass

        try:
            from flaskext.coffee import coffee
            coffee(app)
        except: pass
Ejemplo n.º 2
0
from xml.etree import ElementTree as ET
import sys

try:
    import settings
except ImportError:
    sys.stderr(
        """There must be a settings.py file with a secret_key.
Run bin/make_secret.py
"""
    )
    sys.exit(2)

app = Flask(__name__)
app.secret_key = settings.secret_key
coffee(app)

# Add haml support
app.jinja_env.add_extension(HamlishExtension)
app.jinja_env.hamlish_mode = "indented"
app.debug = True

# Load the configuration
config = ConfigParser({"host": "127.0.0.1"})
config.read("config.ini")

# initialize osm oauth
# instantiate OAuth object
oauth = OAuth()
osm = oauth.remote_app(
    "osm",
Ejemplo n.º 3
0
if not os.path.exists('secret.cfg'):
    print('''secret.cfg not found. You need to generate an app secret by
running ../bin/make_secret.py from the MR root directory''')
    exit()

# initialize server KV session store
if not os.path.exists('./sessiondata'):
    os.makedirs('./sessiondata')
store = FilesystemStore('./sessiondata')

# instantiate flask app
app = Flask(__name__,
            static_folder='static',
            template_folder='templates',
            static_url_path='/static')

app.config.from_pyfile('maproulette.cfg')
app.config.from_pyfile('../secret.cfg')
app.secret_key = app.config['SECRET_KEY']
app.debug = True

#from maproulette import views, models
from maproulette import models, views, oauth
from helpers import make_json_response

# connect flask app to server KV session store
KVSessionExtension(store, app)

# Coffeescript enable the app
coffee(app)