Exemplo n.º 1
0
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 = []


@app.route('/')
def index():
    config_file = os.path.join(BASE_DIR, 'example.webpack.js')
Exemplo n.º 2
0
from flask import Flask, render_template
from webpack.conf import settings
from webpack.compiler import webpack

DEBUG = True

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

settings.configure(
    # The root directory that static assets are located in
    STATIC_ROOT=os.path.join(BASE_DIR, 'static'),
    # The url that STATIC_ROOT is served from
    STATIC_URL='/static/',
    CONFIG_DIRS=(
        os.path.join(BASE_DIR, '..'),
    ),
    # Turn on source watching in development
    WATCH=DEBUG,
    # Turn on hmr in development
    HMR=DEBUG,
    CONTEXT={
        'DEBUG': DEBUG
    },
)

app = Flask(__name__)
app.debug = DEBUG


@app.route('/')
def index():
    return render_template(
Exemplo n.º 3
0
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 = []


@app.route('/')
def index():
    config_file = os.path.join(BASE_DIR, 'example.webpack.js')
Exemplo n.º 4
0
import os
from js_host.conf import settings as js_host_settings
from webpack.conf import settings as webpack_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/',

    # In development, a watcher will rebuild a bundle whenever its config file changes
    WATCH_CONFIG_FILES=DEBUG,

    # In development, a watcher will rebuild a bundle whenever any of its source files change
    WATCH_SOURCE_FILES=DEBUG,
)
Exemplo n.º 5
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,
)