示例#1
0
from gevent import monkey; monkey.patch_all()
import os, sys, json
from pbkdf2 import crypt
from flask.ext.script import Manager, prompt_bool, prompt_pass
from socketio.server import SocketIOServer

from lobbypy import create_app, config_app

app = create_app()
manager = Manager(app)
port = int(os.environ.get('PORT', 5000))

with open('environment.json') as f:
    env = json.load(f)

config = {
        'DATABASE_URI':env['DATABASE_URI'],
        'REDIS_URI':env['REDIS_URI'],
        'SESSION_KEY':env['SESSION_KEY'],
        'STEAM_API_KEY':env['STEAM_API_KEY']
         }

@manager.option('--no-rcon-check', dest='rcon_check', action='store_const',
        const=True, default=False)
@manager.option('--debug', dest='debug', action='store_const', const=True, default=False)
def run(debug, rcon_check):
    from random import randint
    from asciiart import print_image, print_title
    print_image()
    print_title()
    config_app(app, DEBUG=debug, RCON_CHECK_SERVER=(not rcon_check), **config)
 def create_app(self):
     app = create_app()
     config_app(app, SQLALCHEMY_DATABASE_URI='sqlite://', TESTING=True)
     return app
 def create_app(self):
     app = create_app()
     config_app(app, SQLALCHEMY_DATABASE_URI='sqlite://', TESTING=True)
     return app
示例#4
0
from gevent import monkey
monkey.patch_all()
import os, sys
from pbkdf2 import crypt
from flask.ext.script import Manager, prompt_bool, prompt_pass
from socketio.server import SocketIOServer

from lobbypy import create_app, config_app

app = create_app()
manager = Manager(app)


@manager.option('--no-rcon-check',
                dest='rcon_check',
                action='store_const',
                const=True,
                default=False)
@manager.option('--debug',
                dest='debug',
                action='store_const',
                const=True,
                default=False)
def run(debug, rcon_check):
    from random import randint
    from asciiart import images, title
    sys.stderr.write(images[randint(0, len(images) - 1)] + '\n')
    # Bind to PORT if defined, otherwise default to 5000.
    port = int(os.environ.get('PORT', 5000))
    sys.stderr.write('PORT: %d\n' % port)
    sys.stderr.write(title + '\n')