MAIL_DEFAULT_SENDER = '*****@*****.**'
MAIL_SERVER = 'smtp.gmail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USE_SSL = False

# Celery.
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_REDIS_MAX_CONNECTIONS = 5

# SQLAlchemy.
SQLALCHEMY_TRACK_MODIFICATIONS = False

# User.
REMEMBER_COOKIE_DURATION = timedelta(days=90)

# Rate limit
RATELIMIT_STRATEGY = 'fixed-window-elastic-expiry'
RATELIMIT_HEADERS_ENABLED = True

# File upload
IMAGES = 'server/static/images/'
IMAGES_1000 = 'server/static/images/1000'
IMAGES_2000 = 'server/static/images/2000'
IMAGES_400 = 'server/static/images/400'

settings.configure(
  RENDER_URL='http://10.0.0.3:9009/render'
)
Example #2
0
import os
import json
from flask import Flask, render_template, request, redirect, jsonify
from react.conf import settings as react_settings
from react.render import render_component
from webpack.conf import settings as webpack_settings
from webpack.compiler import webpack

DEBUG = True
BASE_DIR = os.path.dirname(os.path.abspath(__file__))

# As a convenience for development, only connect to the
# render server when DEBUG is False
react_settings.configure(RENDER=not DEBUG)

webpack_settings.configure(
    STATIC_ROOT=os.path.join(BASE_DIR, 'static'),
    STATIC_URL='/static/',
    WATCH=DEBUG,
    HMR=DEBUG,
    CONFIG_DIRS=BASE_DIR,
    CONTEXT={
        'DEBUG': DEBUG,
    },
)

app = Flask(__name__)
app.debug = DEBUG

comments = []
Example #3
0
    # Should only use this in cases of serialized execution of requests in a multi-threaded processes.
    # So setdeploy manually, and test from there. Never a live server, as it would be both broken *and* slow.
    # from hacks import memory_leaks
    # app = memory_leaks.leak_middleware(app)

    return app


def is_local_appengine():
    return ('APPENGINE_RUNTIME' in os.environ and
            'Development/' in os.environ['SERVER_SOFTWARE'])

from react.conf import settings
settings.configure(
    # We want to always use the render server, since we may be rendering things that we aren't sending clientside code to render
    RENDER=True,
    RENDER_URL='http://localhost:8090/render',
)


logging.info("Begin modules")
import webapp2
from google.appengine.ext import ereporter
from google.appengine.ext.ndb import tasklets

# We call this here to force loading _strptime module upfront,
# because once threads come online and call strptime(), they try to load _strptime lazily,
# and the second thread to call it while the first one is loading with the lock, triggers an exception.
# More info:
# http://bugs.python.org/issue7980
# http://code-trick.com/python-bug-attribute-error-_strptime/
Example #4
0
import os
import json
from flask import Flask, render_template, request, redirect, jsonify
from react.conf import settings as react_settings
from react.render import render_component
from webpack.conf import settings as webpack_settings
from webpack.compiler import webpack

DEBUG = True
BASE_DIR = os.path.dirname(os.path.abspath(__file__))

# As a convenience for development, only connect to the
# render server when DEBUG is False
react_settings.configure(RENDER=not DEBUG)

webpack_settings.configure(
    STATIC_ROOT=os.path.join(BASE_DIR, 'static'),
    STATIC_URL='/static/',
    WATCH=DEBUG,
    HMR=DEBUG,
    CONFIG_DIRS=BASE_DIR,
    CONTEXT={
        'DEBUG': DEBUG,
    },
)


app = Flask(__name__)
app.debug = DEBUG

comments = []
import os

from flask import Flask, render_template
from react.conf import settings
from react.render import render_component

app = Flask(__name__)

settings.configure(RENDER=True, RENDER_URL='http://127.0.0.1:9009/render')

TODOS = [
    'Buy groceries',
    'Mow the lawn',
    'Take out the trash',
]


@app.route('/')
def index():
    component = render_component(os.path.join(os.getcwd(), 'static',
                                              'TodoList.jsx'),
                                 props={'todos': TODOS},
                                 to_static_markup=False)

    return render_template('index.html', component=component)


if __name__ == '__main__':
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)
Example #6
0
import os

from flask import Flask, render_template
from react.conf import settings
from react.render import render_component


app = Flask(__name__)


settings.configure(
    RENDER=True,
    RENDER_URL='http://127.0.0.1:9009/render'
)


TODOS = [
    'Buy groceries',
    'Mow the lawn',
    'Take out the trash',
]


@app.route('/')
def index():
    component = render_component(
        os.path.join(os.getcwd(), 'static', 'TodoList.jsx'),
        props={'todos': TODOS},
        to_static_markup=False
    )
Example #7
0
import os
from js_host.conf import settings as js_host_settings
from webpack.conf import settings as webpack_settings
from react.conf import settings as react_settings

DEBUG = True

BASE_DIR = os.path.dirname(os.path.abspath(__file__))

js_host_settings.configure(
    USE_MANAGER=DEBUG
)

webpack_settings.configure(
    # The root directory that webpack will place files into and infer urls from
    BUNDLE_ROOT=os.path.join(BASE_DIR, 'static'),

    # The root url that webpack will use to determine the urls to bundles
    BUNDLE_URL='/static/',

    WATCH_SOURCE_FILES=DEBUG,

    WATCH_CONFIG_FILES=DEBUG,
)

react_settings.configure(
    DEVTOOL='eval' if DEBUG else None,
)