예제 #1
0
파일: entry.py 프로젝트: Troush/fontbakery
def runServer():
    app = create_app(app_name="bakery")
    app.config.from_object("config")
    app.config.from_pyfile(op.join(op.dirname(__file__), "local.cfg"), silent=True)
    init_app(app)
    import os
    from werkzeug.wsgi import SharedDataMiddleware

    app.config["DEBUG"] = True
    app = SharedDataMiddleware(app, {"/static": os.path.join(os.path.dirname(__file__), "static")})
    from socketio.server import SocketIOServer

    SocketIOServer(
        ("0.0.0.0", 5000), app, resource="socket.io", policy_server=False, transports=["websocket", "xhr-polling"]
    ).serve_forever()
예제 #2
0
파일: entry.py 프로젝트: cicku/fontbakery
def runServer():
    app = create_app(app_name='bakery')
    app.config.from_object('config')
    app.config.from_pyfile('../local.cfg', silent=True)
    init_app(app)
    import os
    from werkzeug.wsgi import SharedDataMiddleware
    app.config['DEBUG'] = True
    app = SharedDataMiddleware(app, {
        '/static': os.path.join(os.path.dirname(__file__), 'static')
        })
    from socketio.server import SocketIOServer
    SocketIOServer(('0.0.0.0', 5000), app,
        resource="socket.io", policy_server=False,
        transports=['websocket', 'xhr-polling'],
        ).serve_forever()
예제 #3
0
#
# See AUTHORS.txt for the list of Authors and LICENSE.txt for the License.

from __future__ import print_function

import sys, os
import requests
from bs4 import BeautifulSoup

sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))

from bakery import create_app, init_app
from bakery.models import FontStats
from bakery.extensions import db

app = create_app(app_name="bakery")
app.config["DEBUG"] = True
app.config.from_object("config")
app.config.from_pyfile("local.cfg", silent=True)
init_app(app)

ctx = app.test_request_context("/")
ctx.push()

r = requests.get("http://www.google.com/fonts/stats?key=WebFonts2010")

if r.status_code != 200:
    print("Wrong download code", file=sys.stderr)
    sys.exit(1)

soup = BeautifulSoup(r.text)
예제 #4
0
파일: wsgi.py 프로젝트: Troush/fontbakery
# coding: utf-8
# Copyright 2013 The Font Bakery Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# See AUTHORS.txt for the list of Authors and LICENSE.txt for the License.
import os.path as op
import gevent.monkey
gevent.monkey.patch_all()

from bakery import create_app, init_app


app = create_app(app_name='bakery')
app.config.from_object('config')
app.config.from_pyfile(op.join(op.realpath(op.dirname(__name__)), 'local.cfg'),
                       silent=True)
app.config['DEBUG'] = False
init_app(app)