Example #1
0
# Required to use Flask sessions and the debug toolbar
app.secret_key = os.environ["FLASK_APP_SECRET_KEY"]

# Jinja should not fail silently
app.jinja_env.undefined = StrictUndefined

# Configurations for flask-uploads
# These are required
app.config["UPLOADED_PICTURES_DEST"] = "upload_temp"
pictures = UploadSet("pictures", IMAGES)
configure_uploads(app, (pictures,))

# These are a handy place to pass the info
app.config["S3_FOLDER"] = os.environ["AWS_S3_FOLDER"]
app.config["S3_BUCKET"] = os.environ["AWS_S3_BUCKET"]

# Configure paths for online resources
resources = ResourcePaths(online=False)
app.config["JQUERY_PATH"] = resources.jquery_path
app.config["BOOSTRAP_CSS_PATH"] = resources.boostrap_css_path
app.config["BOOSTRAP_JS_PATH"] = resources.boostrap_js_path
app.config["CHARTJS_PATH"] = resources.chartjs_path

# Default user ID used to display sample images when no other user logged in
DEFAULT_USER_ID = 1


@app.route("/")
def index():
    """Homepage."""
Example #2
0
    mail_handler.setLevel(logging.ERROR)
    app.logger.addHandler(mail_handler)

if not app.debug and os.environ.get("HEROKU") is None:
    import logging
    from logging.handlers import RotatingFileHandler

    file_handler = RotatingFileHandler("tmp/burtonblog.log", "a", 1 * 1024 * 1024, 10)
    file_handler.setLevel(logging.INFO)
    file_handler.setFormatter(logging.Formatter("%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]"))
    app.logger.addHandler(file_handler)
    app.logger.setLevel(logging.INFO)
    app.logger.info("homeporch startup")

if os.environ.get("HEROKU") is not None:
    import logging

    stream_handler = logging.StreamHandler()
    app.logger.addHandler(stream_handler)
    app.logger.setLevel(logging.INFO)
    app.logger.info("homeporch startup")


app.config["S3_LOCATION"] = "https://s3.amazonaws.com/aperturus/"
app.config["S3_UPLOAD_DIRECTORY"] = "site_assets"
app.config["S3_BUCKET"] = "aperturus"
app.config["S3_REGION"] = "us-east-1"
app.config["AWS_ACCESS_KEY_ID"] = os.environ["AWS_ACCESS_KEY_ID"]
app.config["AWS_SECRET_ACCESS_KEY"] = os.environ["AWS_SECRET_ACCESS_KEY"]

from app import views, models