Example #1
0
def create_app():
    app = Flask(__name__)
    app.g = [0, 0, 0, [], {}]

    def gethighscore():
        highscore = open("highscore", "r")
        highscore = highscore.read()
        app.g[2] = highscore

    def setupdb():
        db = open("ips", "r")
        db = json.load(db)
        app.g[3] = db

    gethighscore()
    setupdb()
    return app
Example #2
0
File: app.py Project: timoh/GoCast
import simplejson as json
import mongokit

# import models

# BLUEPRINTS
from main.app import main
from api.app import api

PROD_CONFIG = "config_prod.json"
DEV_CONFIG = "config_dev.json"
APP_NAME = "gocast"


application = Flask(__name__)
application.g = g


def init_settings():
    """ """
    settings = None
    abs_path = os.path.abspath(os.path.curdir)

    if abs_path.find("www") <= 8:
        abs_path += "/www/"

    if os.environ.has_key(APP_NAME) and os.environ[APP_NAME] == "production":
        abs_path += PROD_CONFIG
    else:
        print("NB! Database runs with local settings.\n")
        abs_path += DEV_CONFIG