예제 #1
0
파일: demo_mako.py 프로젝트: UXE/brubeck
#!/usr/bin/env python

import sys
from brubeck.request_handling import Brubeck, WebMessageHandler
from brubeck.templating import MakoRendering, load_mako_env


class DemoHandler(WebMessageHandler, MakoRendering):
  def get(self):
    name = self.get_argument('name', 'dude')
    context = {'name': name}
    return self.render_template('success.html', **context)


app = Brubeck(mongrel2_pair=('ipc://127.0.0.1:9999', 'ipc://127.0.0.1:9998'),
  handler_tuples=[(r'^/brubeck', DemoHandler)],
  template_loader=load_mako_env('./templates/mako'))
app.run()
예제 #2
0
# Connect to database before every request
db_connection_service.configure()

routes = [
	(r'^/stripe_redirect', index_handlers.StripeRedirectHandler),
	(r'^/submit_payment_with_address', payment_handlers.PayAddressHandler),
	(r'^/submit_payment_without_address', payment_handlers.PayHandler),
	(r'^/login', index_handlers.IndexHandler),
	(r'^/check_test_mode_allowed', index_handlers.CheckTestModeAllowedHandler),
	(r'^/save_user_details', index_handlers.SaveUserDetailsHandler),
	(r'^/get_form_transactions', payment_handlers.GetFormTransactionsHandler),
	(r'^/save_new_form', index_handlers.NewFormHandler),
	(r'^/form_conf', index_handlers.FormConfHandler),
	(r'^/save_form_conf', index_handlers.SaveFormConfHandler),
	(r'^/form_delete', index_handlers.DeleteFormHandler),
	(r'^/payment_form', payment_handlers.PaymentFormHandler),
	(r'^/ping', index_handlers.PingHandler),
	(r'^/', index_handlers.DashboardHandler)
	 ]

config = {
	'msg_conn' : Mongrel2Connection('tcp://127.0.0.1:9999', 'tcp://127.0.0.1:9998'),
	'handler_tuples' : routes,
	'template_loader' : load_mako_env('./templates'),
	'login_url' : '/login' # This is the URL the user will be redirected to when not logged in
	 }

app = Brubeck(**config)
app.run()
예제 #3
0
#!/usr/bin/env python

from brubeck.request_handling import Brubeck
from brubeck.templating import MakoRendering, load_mako_env
from brubeck.connections import Mongrel2Connection
import sys


class DemoHandler(MakoRendering):
    def get(self):
        name = self.get_argument('name', 'dude')
        context = {
            'name': name
        }
        return self.render_template('success.html', **context)

app = Brubeck(msg_conn=Mongrel2Connection('tcp://127.0.0.1:9999', 'tcp://127.0.0.1:9998'),
              handler_tuples=[(r'^/brubeck', DemoHandler)],
              template_loader=load_mako_env('./templates/mako'))
app.run()
예제 #4
0
파일: app.py 프로젝트: droot/Batty
    #(r'^/confs/(?P<id>\w+)', ConferenceManagementHandler),
    #(r'^/confs', ConferenceManagementHandler),
    #(r'^/sessions/(?P<id>\w+)', SessionManagementHandler),
    #(r'^/sessions', SessionManagementHandler),
    #(r'^/speakers/(?P<id>\w+)', SpeakerManagementHandler),
    #(r'^/speakers', SpeakerManagementHandler),
    #(r'^/(?P<conf_handle>\w+)', IndexPageHandler),
    #(r'^/$', IndexPageHandler),
]

_batty_config = app_config.get_config()
# Application config
config = {
    'mongrel2_pair': ('tcp://127.0.0.1:9999', 'tcp://127.0.0.1:9998'),
    'handler_tuples': handler_tuples,
    'template_loader': load_mako_env(_batty_config.get('template_path'),
			input_encoding='utf-8',
			output_encoding='utf-8',
			encoding_errors='replace',
			default_filters=['escape'],
			imports=['from webhelpers.html import escape'])
    #'db_conn': db_conn,
    #'login_url': '/login',
    #'cookie_secret': 'OMGSOOOOOSECRET',
}
config.update(_batty_config)

# Instantiate app instance
app = Brubeck(**config)
app.run()