Beispiel #1
0
 def run_app(self):
     api_app = Bottle()
     api_app.install(log_to_logger)
     app.install(log_to_logger)
     api_app.mount('/api/', app)
     conf = self.get_config()
     api_app.config['host'] = conf['host']
     api_app.config['port'] = conf['port']
     api_app.run(host=api_app.config['host'], port=api_app.config['port'])
Beispiel #2
0
__author__ = 'reason'
from lib.bottle import Bottle,TEMPLATE_PATH
import index,shunion,option ,datareport ,nokiareport,ssx,wlapi,tdwap
import  setting

TEMPLATE_PATH.insert(0,setting.TEM_PATH)

app=Bottle()
app.mount("/nokiadata",nokiareport.app)
app.mount("/data",datareport.app)
app.mount("/index",index.app)
app.mount("/shunion",shunion.app)
app.mount("/option",option.app)
app.mount("/ssx",ssx.app)
app.mount("/wlapi",wlapi.app)
app.mount("/tdwap",tdwap.app)



Beispiel #3
0
__author__ = 'reason'
from lib.bottle import Bottle,TEMPLATE_PATH
import index
import  setting

TEMPLATE_PATH.insert(0,setting.TEM_PATH)

app=Bottle()

app.mount("/index",index.app)




Beispiel #4
0
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

from lib.bottle import Bottle
from lib.bottle import TEMPLATE_PATH
from sample.controllers import login
from sample.controllers import sign_up
from sample.controllers import search
from sample.controllers import manage
from sample.controllers import add_website
from sample.controllers import edit_profile
from sample.controllers import logout

app = Bottle()
TEMPLATE_PATH.append('../sample/views')

# resources/でアクセスできるRESTful API群を以下に羅列していく
app.mount('/login', login.app)
app.mount('/sign_up', sign_up.app)
app.mount('/search', search.app)
app.mount('/manage', manage.app)
app.mount('/add_website', add_website.app)
app.mount('/edit_profile', edit_profile.app)
app.mount("/logout", logout.app)


@app.get('/')
def index():
    return str('Hello. This is sample_top page.')
Beispiel #5
0
# -*- coding:utf-8 -*-

from lib.bottle import Bottle
from lib.bottle import run
from beaker.middleware import SessionMiddleware
from sample.controllers import index as sample_index

# セッションの設定
session_opts = {
    'session.type': 'file',
    'session.data_dir': '/tmp',
    'session.cookie_expires': True,
    'session.auto': True,
}

app = Bottle()
apps = SessionMiddleware(app, session_opts)


@app.route('/')
def index():
    return str('Hello. This is top page.')


if __name__ == '__main__':
    # 以下のindex.py(sample/controllers/index.py)で、さらに別のroutesを指定することも可能。
    # このようにワンクッション置くことで、/sampleと言うようなURLのみの場合にも何かメッセージを表示することが可能。
    app.mount('/sample', sample_index.app)

    run(app=apps, host='localhost', port=8080, debug=True, reloader=True)
Beispiel #6
0
__author__ = 'reason'
from lib.bottle import Bottle,TEMPLATE_PATH
import main,user,code,upload,setting,play,vlist,playlist,home
import logging
# import redis
from setting import project_path

TEMPLATE_PATH.insert(0,setting.TEM_PATH)

app=Bottle()

# init path
app.mount("/main",main.app)
app.mount("/code",code.app)
app.mount("/user",user.app)
app.mount("/upload",upload.app)
app.mount("/programs",play.app)
app.mount("/list",vlist.app)
app.mount("/zh",playlist.app)
app.mount("/home",home.app)


# init log config
log_file = project_path + "/log/gkgp.log" 
logging.basicConfig(filename = log_file, level = logging.DEBUG,format = '%(asctime)s - %(levelname)s: %(message)s') 

Beispiel #7
0
__author__ = 'reason'
from lib.bottle import Bottle,TEMPLATE_PATH
import index,option,video,channel,notice,template,main
import  setting


TEMPLATE_PATH.insert(0,setting.TEM_PATH)

app=Bottle()

app.mount("/option",option.app)
app.mount("/index",index.app)
app.mount("/video",video.app)
app.mount("/channel",channel.app)
app.mount("/notice",notice.app)
app.mount("/template",template.app)
app.mount("/main",main.app)
Beispiel #8
0
handler.
"""
from lib import bottle
from lib.bottle import Bottle, redirect, request
# name and list your controllers here so their routes become accessible.
from server.controllers import main_controller, project_controller, code_controller
# Enable debugging, which gives us tracebacks
bottle.DEBUG = True

# Run the Bottle wsgi application. We don't need to call run() since our
# application is embedded within an App Engine WSGI application server.
appbottle = Bottle()

# Mount a new instance of bottle for each controller and URL prefix.
# appbottle.mount("/external/brython/Lib/site-packages", project_controller.bottle)
appbottle.mount("/<:re:.*>/_spy", code_controller.bottle)
appbottle.mount("superpython", project_controller.appbottle)

# Mount a new instance of bottle for each controller and URL prefix.
appbottle.mount("/main", main_controller.bottle)
appbottle.mount("/code", code_controller.bottle)
# bottle.mount("/pontos", pontos_controller.bottle)


@appbottle.get('/')
def home():
    """ Return Hello World at application root URL"""
    prj = request.query.proj
    print("home project /", prj)
    redirect('/main?proj=%s' % prj)