def __init__(self): initdb() handlers = url_wrapper([ (r"/users/", include("views.users.users_urls")), (r"/upload/", include("views.upload.upload_urls")) ]) settings = dict( debug=True, static_path=os.path.join(os.path.dirname(__file__), "static"), template_path=os.path.join(os.path.dirname(__file__), "template") ) tornado.web.Application.__init__(self, handlers, **settings)
def __init__(self): initdb() settings = dict(debug=DEBUG, static_path=os.path.join(os.path.dirname(__file__), 'static'), template_path=os.path.join(os.path.dirname(__file__), 'template')) tornado.web.Application.__init__(self, urls, **settings) scoped_session( sessionmaker(bind=engine, autocommit=False, autoflush=True, expire_on_commit=False))
def __init__(self): initdb(), handles = url_wrapper([(r'/users/', include('views.users.users_urls')) ]) settings = dict(debug=True, static_path=os.path.join(os.path.dirname(__file__), "static"), template_path=os.path.join(os.path.dirname(__file__), "templates")) tornado.web.Application.__init__(self, handles, **settings) self.db = scoped_session( sessionmaker(bind=engine, autocommit=False, autoflush=True, expire_on_commit=False))
def __init__(self): initdb() handlers = url_wrapper([ (r"/users/", include('views.users.users_urls')), (r"/upload/", include('views.upload.upload_urls')) ]) #定义tornado服务器的配置项,如static/templates目录位置,debug级别等 settings = dict(debug=True, static_path=os.path.join(os.path.dirname(__file__), "static"), template_path=os.path.join(os.path.dirname(__file__), "templates")) tornado.web.Application.__init__(self, handlers, **settings) self.db = scoped_session( sessionmaker(bind=engine, autocommit=False, autoflush=True, expire_on_commit=False))
def __init__(self): initdb() # http://127.0.0.1:8998/users/login # http://127.0.0.1:8998/login handlers = url_wrapper([(r'/users/', include('views.urls.users_urls')), (r'/upload/', include('views.urls.upload_urls')), (r'/', IndexHandle)]) settings = dict(debug=True, static_path=os.path.join(os.path.dirname(__file__), "static"), template_path=os.path.join(os.path.dirname(__file__), "templates")) tornado.web.Application.__init__(self, handlers, **settings) self.dbSession = sessionmaker(bind=engine, autocommit=False, autoflush=True, expire_on_commit=False)
import bottle import settings import models from pages import detail from pages import list_all from pages import about_us from pages import search from pages import feed from json_api import single_item from json_api import all_item from static_views import css_views from static_views import js_views models.initdb() bottle.run(server="gunicorn", host=settings.HOST, port=settings.PORT)
def run(): models.initdb() add_language() migrate_bills() migrate_revisions()
rev = (session.query(models.BillRevision).filter( models.BillRevision.bill_id == bill.id).filter( models.BillRevision.year == int(b['year'])).first()) now = datetime.datetime.now() b['update_date'] = now if not rev: b['create_date'] = now rev = models.BillRevision(**b) session.add(rev) session.flush() message = 'Bill Started: %s, year %s %s' else: if rev.status != b['status']: for k, v in b.iteritems(): if hasattr(rev, k): setattr(rev, k, v) session.flush() message = 'Bills Updated: %s, year %s %s' if message: url = settings.URL + 'detail/%d/' % (rev.id) indexer.index_single(rev.id) print message % (bill.long_name, rev.year, url) session.commit() if __name__ == '__main__': models.initdb() load_data()
from bottle import run from pages import detail from pages import list_all from pages import about_us from pages import search from pages import feed from json_api import single_item from json_api import all_item from static_views import css_views, js_views from settings import HOST, PORT from models import initdb initdb() run(host=HOST, port=PORT)
from bottle import run from pages import detail from pages import list_all from pages import about_us from pages import search from pages import feed from json_api import single_item from json_api import all_item from static_views import css_views,js_views from settings import HOST,PORT from models import initdb initdb() run(host=HOST,port=PORT)