Beispiel #1
0
def main(global_config, **settings):
    config_path = global_config['__file__']
    app_info = configparser.ConfigParser()
    app_info.read(config_path)        
    init_setting(app_info)
    
    config = Configurator(settings=settings)
    
    config.include('pyramid_chameleon')
    config.add_static_view(name='static', path= 'static', cache_max_age=0)  

    config.add_route('home', '/')    
    config.add_route('api','/api/{func}')   
    
    ys_session_factory = SignedCookieSessionFactory("thisissecretkay")
    config.set_session_factory(ys_session_factory)

    config.scan()
    return config.make_wsgi_app()
Beispiel #2
0
def InitSetting(path):    
    config = configparser.ConfigParser()
    config.read(path)
    init_setting(config)
    init_db()
Beispiel #3
0
# -*- coding: utf8 -*-
# encoding=utf8  
import configparser,sys

from yeksatr.backend.helpers.setting import init_setting, init_db
from yeksatr.backend.helpers.setting import Setting

from feed.rssreader import RssReader
from feed.newsagent import NewsAgent

if __name__ == '__main__':
    path = "../development.ini";
    config = configparser.ConfigParser()
    config.read(path)
    init_setting(config)
    init_db()
 
    for i in range(len(sys.argv)):
        param = sys.argv[i]
        if param == '-update' :
            rr = RssReader()
            rr.read()
            pass
        elif param == '-extract':
            na = NewsAgent()    
            na.extract_news(30)
            pass
    

    print ("jobs done")
    pass