Example #1
0
    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
from flask import Flask
from .api import auth_api, profile_api, car_api, dealership_api
from .views import default_route
from .db import Base, engine
from config import S3_BUCKET, S3_KEY, S3_LOCATION, S3_SECRET, S3_UPLOAD_DIRECTORY

app = Flask(__name__)

# Register blueprints
app.register_blueprint(auth_api)
app.register_blueprint(profile_api)
app.register_blueprint(car_api)
app.register_blueprint(dealership_api)
app.register_blueprint(default_route)

# App configuration
app.config["S3_LOCATION"] = S3_LOCATION
app.config["S3_BUCKET"] = S3_BUCKET
app.config["S3_UPLOAD_DIRECTORY"] = S3_UPLOAD_DIRECTORY
app.config["S3_KEY"] = S3_KEY
app.config["S3_SECRET"] = S3_SECRET

# Create tables
Base.metadata.create_all(engine)
Example #3
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('burtonblog 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('burtonblog startup')

app.jinja_env.globals['momentjs'] = momentjs

app.config["S3_LOCATION"] = 'https://s3.amazonaws.com/netbardus/'
app.config["S3_UPLOAD_DIRECTORY"] = 'user_imgs'
app.config["S3_BUCKET"] = 'netbardus'
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
Example #4
0
from tools import s3_upload
from basic_auth import requires_auth
import config_defaults
import os


app = Flask(__name__)

if os.environ.get('DEBUG_MODE', "False") != "False":
    app.debug = True

app.config["S3_UPLOAD_DIRECTORY_CHOICES"] = os.environ.get('S3_UPLOAD_DIRECTORY_CHOICES',config_defaults.S3_UPLOAD_DIRECTORY_CHOICES)
app.config["S3_KEY"] = os.environ.get("S3_KEY", config_defaults.S3_KEY)
app.config["S3_SECRET"] = os.environ.get("S3_SECRET", config_defaults.S3_SECRET)
app.config["S3_UPLOAD_DIRECTORY"] = os.environ.get("S3_UPLOAD_DIRECTORY", config_defaults.S3_UPLOAD_DIRECTORY)
app.config["S3_BUCKET"] = os.environ.get("S3_BUCKET", config_defaults.S3_BUCKET)
app.config["S3_LOCATION"] = os.environ.get("S3_LOCATION", config_defaults.S3_LOCATION)
app.config["SECRET_KEY"] = os.environ.get("SECRET_KEY", config_defaults.SECRET_KEY)
app.config["USERNAME"] = os.environ.get("USERNAME", config_defaults.USERNAME)
app.config["PASSWORD"] = os.environ.get("PASSWORD", config_defaults.PASSWORD)


class UploadForm(Form):
    file_value = FileField('File')
    in_directory = SelectField('Directory', choices=app.config["S3_UPLOAD_DIRECTORY_CHOICES"])
    over_write_existing = BooleanField('Force', default=False)

@app.route('/')
def nothing_here():
    return 'Nothing here.'