Example #1
# from google.appengine.ext.webapp import template
# from samplelib import samplemodule

from flask import Flask, request, render_template, redirect, abort, jsonify
from werkzeug import secure_filename

from flask.ext.mongoengine import mongoengine

# Below is used to use file such as images.
import StringIO

app = Flask(__name__)
app.secret_key = os.environ.get("SECRET_KEY")
app.config["CSRF_ENABLED"] = False
app.config["TRAP_BAD_REQUEST_ERRORS"] = True

# ------------- Database Connection -----------------
# MongoDB connection to MongoLab's database

# mongoengine.connect('mydata', host=os.environ.get('MONGOLAB_URI'))
app.logger.debug("Connecting to MongoLabs")

ALLOWED_EXTENSIONS = set(["png", "jpg", "jpeg", "gif"])

def index():
    return render_template("main.html")