Пример #1
0
def precompile_template():
    # Yes, we're importing a module we just wrote.
    config_module = imp.load_module("config",
                                    *imp.find_module("config", ["./"]))
    app = create_app(config_module.Config)
    with app.test_request_context():
        write_main_template()
Пример #2
0
def run_server():
    app = create_app()
    remove_all_client_ids(app)
    remove_all_anonymous_users_from_channels(app)
    http_server = WSGIServer(('0.0.0.0', 5000),
                             app,
                             handler_class=WebSocketHandler)
    http_server.serve_forever()
Пример #3
0
def run_server():
    app = create_app()
    http_server = WSGIServer(('0.0.0.0', 5000),
                             app,
                             handler_class=WebSocketHandler)
    sys.stderr.write("Now serving on port 5000...\n")
    sys.stderr.flush()
    http_server.serve_forever()
Пример #4
0
def precompile_template():
  # Yes, we're importing a module we just wrote.
  config_module = imp.load_module("config", *imp.find_module("config", ["./"]))
  app = create_app(config_module.Config)
  with app.test_request_context():
    write_main_template()
Пример #5
0
from chat import create_app

app = create_app("config.Config")
Пример #6
0
from aiohttp import web
from chat import create_app

app = create_app()

if __name__ == '__main__':
    web.run_app(app)
Пример #7
0
from chat import create_app

app = create_app()
Пример #8
0
#!/bin/env python
from chat import create_app, socketio

app = create_app(debug=True)

if __name__ == '__main__':
    socketio.run(app, host='0.0.0.0', port=2001)
Пример #9
0
def run_server():
  app = create_app()
  remove_all_client_ids(app)
  remove_all_anonymous_users_from_channels(app)
  http_server = WSGIServer(('0.0.0.0',5000), app, handler_class=WebSocketHandler)
  http_server.serve_forever()
Пример #10
0
import os
import flask
from flask_script import Manager, Server, Shell
from flask_migrate import Migrate, MigrateCommand
from dotenv import load_dotenv, find_dotenv
from chat import create_app, db, models
from chat.resources import socketio

dotenv_path = os.path.join(os.path.dirname(__file__), '.flaskenv')
load_dotenv(dotenv_path=dotenv_path)
load_dotenv(find_dotenv())
app = create_app(os.getenv('FLASK_CONFIG'))
Migrate(app, db)
manager = Manager(app)
RUN_HOST = os.getenv('FLASK_RUN_HOST')
RUN_PORT = int(os.getenv('FLASK_RUN_PORT'))
server = Server(host=RUN_HOST, port=RUN_PORT)
#manager.add_command('runserver', server)
#server = socketio.run(app=app, host=RUN_HOST, port=RUN_PORT)
manager.add_command('runserver', server)
manager.add_command('db', MigrateCommand)


@app.shell_context_processor
def make_shell_context():
    return dict(app=app, db=db, models=models)


manager.add_command("shell", Shell(make_context=make_shell_context))

Пример #11
0
def run_server():
  app = create_app()
  http_server = WSGIServer(('0.0.0.0',5000), app, handler_class=WebSocketHandler)
  sys.stderr.write("Now serving on port 5000...\n")
  sys.stderr.flush()
  http_server.serve_forever()