Beispiel #1
0
def appConfig():
    import aha
    config = aha.Config()

    # your custom configurations follows
    # config.foo_config = 'spamspamspam'

    # your route follows.
    from aha.dispatch.router import get_router, get_fallback_router
     # set the fallback route leading to object structure dispatcher
    fr = get_fallback_router()
    fr.connect(r'*url', controller = 'main', action = 'index')

    config.debug = True
    config.useappstatus = False # Make it 'True' if you want to use appstats

    if config.debug:
        logging.basicConfig(level = logging.DEBUG)
    else:
        # setting log level
        logging.basicConfig(level = logging.DEBUG)
Beispiel #2
0
def appConfig():
    import aha
    from aha.controller.decorator import cache
    cache.set_namespace_func(cache_namespace)

    config = aha.Config()
    # initialize route and the installed plugins
    from aha.dispatch.router import get_router, get_fallback_router
    # initialize router with default rule.
    r = get_router()

    # setting up well known config attributes
    config.initial_user = ['*****@*****.**', '*****@*****.**', 'ats']
    config.site_root = 'http://coreblog.org'
    config.error_template = '/common/error'
    config.logout_url = '/logout'

    config.page_cache_expire = 60*60*4 # 8 hours
    config.query_cache_expire = 60*60*2 # 2 hours

    if not hasattr(config, 'site_admin_menus'):
        config.site_admin_menus = [
            ('/style/img/edit_icon.gif', 'Site setting', '/_edit_sitedata' ),
            ]

    # urls for admin interfaces
    r.connect(r'/_edit_sitedata', controller = 'sitedata', action = 'edit')

    from plugin.twitteroauth.twitter_auth import TwitterOAuth
    config.auth_obj = TwitterOAuth

    # route fot oauth redirector.
    r.connect('/_oauth', controller = 'twitteroauth')

    config.consumer_key = '8tvBBBU4P8SqPypC1X4tpA'
    config.consumer_secret = 'RGdpAxEnuETjKQdpDxsJkR67Ki16st6gfv4URhfdM'

    # set the default authenticate function
    from util.authenticate import admin
    config.admin_auth = admin

    # set the fallback route leading to object structure dispatcher
    fr = get_fallback_router()
    fr.connect(r'*url', controller = 'main', action = 'index')

    if config.debug:
        from aha.auth.appengine import AppEngineAuth
        config.auth_obj = AppEngineAuth
        """
        from plugin.user.datastoreauth import DataStoreAuth
        config.auth_obj = DataStoreAuth
        config.login_url = '/login'
        """

        #config.page_cache_expire = 0  # no caceh in development envronment.
        #config.query_cache_expire = 0  # no caceh in development envronment.

        config.site_root = 'http://127.0.0.1:8080'
        # setting log level
        logging.basicConfig(level = logging.DEBUG)
    else:
        # setting log level
        logging.basicConfig(level = logging.DEBUG)