Ejemplo n.º 1
0
from app import constants
from app import models
from app import utils
from app import exceptions
from app import api
from app import auth
import app.analytics as analytics
from app.seed import seed, is_seeded

DEBUG = (os.environ['SERVER_SOFTWARE'].startswith('Dev')
         if 'SERVER_SOFTWARE' in os.environ else True)

TESTING = os.environ[
    "FLASK_CONF"] == "TEST" if "FLASK_CONF" in os.environ else False
if DEBUG and not TESTING and not is_seeded():
    seed()

if DEBUG:
    app.config.from_object('app.settings.Debug')

    # Google app engine mini profiler
    # https://github.com/kamens/gae_mini_profiler
    app.wsgi_app = DebuggedApplication(app.wsgi_app, evalex=True)
else:
    app.config.from_object('app.settings.Production')

# Enable jinja2 loop controls extension
app.jinja_env.add_extension('jinja2.ext.loopcontrols')

# Pull in URL dispatch routes
import urls
Ejemplo n.º 2
0
def seed():
    "Seed RoseGuarden database filled default data after an migration/upgrade"
    seeder.seed()
Ejemplo n.º 3
0
Archivo: __init__.py Proyecto: hpec/ok
from app import constants
from app import models
from app import utils
from app import exceptions
from app import api
from app import auth
from app.seed import seed

DEBUG = (os.environ['SERVER_SOFTWARE'].startswith('Dev')
         if 'SERVER_SOFTWARE' in os.environ
         else True)

TESTING = os.environ["FLASK_CONF"] == "TEST" if "FLASK_CONF" in os.environ else False
if DEBUG and not TESTING and len(list(models.Course.query().filter(models.Course.name == 'CS 61A'))) == 0:
    seed()

if DEBUG:
    app.config.from_object('app.settings.Debug')

    # Google app engine mini profiler
    # https://github.com/kamens/gae_mini_profiler
    app.wsgi_app = DebuggedApplication(app.wsgi_app, evalex=True)
else:
    app.config.from_object('app.settings.Production')

# Enable jinja2 loop controls extension
app.jinja_env.add_extension('jinja2.ext.loopcontrols')

# Pull in URL dispatch routes
import urls
Ejemplo n.º 4
0
def seed():
    "Seed RoseGuarden database filled default data after an migration/upgrade"
    seeder.seed()