from beaker.middleware import SessionMiddleware from core import bottle from application import settings # override the template path if we have had one specified BEFORE importing the routes try: bottle.TEMPLATE_PATH = settings.TEMPLATE_PATH except: pass # now import the routes from core.routes import * from application.routes import * session_opts = { 'session.auto':True, 'session.cookie_expires': 60 * 60 * 60, 'session.key':'se', 'session.type':'file', 'session.data_dir':'/home/chris/code/_beaker_sessions', } app = SessionMiddleware(bottle.app(), session_opts) if __name__ == '__main__': with open(settings.ROOTPATH +'/app.pid','w') as f: f.write(str(os.getpid())) if settings.DEBUG: bottle.debug() bottle.run(app=app, server=settings.SERVER, reloader=settings.DEBUG, host=settings.APPHOST, port=settings.APPPORT, quiet=(settings.DEBUG==False) )
from core.bottle import Bottle, debug, jinja2_template as template, TEMPLATE_PATH, static_file, redirect, request, run, response from core.lib import template_settings from business.service.pics_services import PicsService from business.service.users_services import UsersService from business.service.seo_services import SeoService from business.service.black_list_services import BlackListService from business.service.weibo_services import WeiboService from business.service.comments_services import CommentsService from business.service.options_services import OptionsService, get_option from business import auth, log import os, json from settings import STATIC_FILE, DEBUG, TEMP_PATH, PAGESIZE, jsversion, MEMCACHE_KEY app = Bottle() debug(DEBUG) TEMPLATE_PATH.append(TEMP_PATH) app.install(log.stopwatch) def get_site_info(): '''获取站点基本信息''' APP_TITLE = get_option('site_name') SITE_URL = get_option('site_url', '/') return dict(app_title=APP_TITLE, site_url=SITE_URL, static_url='%s%s' % (SITE_URL, STATIC_FILE), jsversion=jsversion) #=======SEO BOF=======
from core.bottle import Bottle, debug, jinja2_template as template, TEMPLATE_PATH, static_file, redirect, request, run, response from core.lib import template_settings from business.service.pics_services import PicsService from business.service.users_services import UsersService from business.service.seo_services import SeoService from business.service.black_list_services import BlackListService from business.service.weibo_services import WeiboService from business.service.comments_services import CommentsService from business.service.options_services import OptionsService, get_option from business import auth, log import os, json from settings import STATIC_FILE, DEBUG, TEMP_PATH, PAGESIZE, jsversion, MEMCACHE_KEY app = Bottle() debug(DEBUG) TEMPLATE_PATH.append(TEMP_PATH) app.install(log.stopwatch) def get_site_info(): '''获取站点基本信息''' APP_TITLE = get_option('site_name') SITE_URL = get_option('site_url', '/') return dict(app_title=APP_TITLE, site_url=SITE_URL, static_url='%s%s'%(SITE_URL, STATIC_FILE), jsversion=jsversion) #=======SEO BOF======= @app.get('/sitemap.xml') def sitemap(): '''sitemap'''