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()
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()
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) c = soup.find("div", "container") for i in c.find_all("div", "row")[1:]: