当前位置: 首页>>代码示例>>Python>>正文


Python Music.as_view方法代码示例

本文整理汇总了Python中music.Music.as_view方法的典型用法代码示例。如果您正苦于以下问题:Python Music.as_view方法的具体用法?Python Music.as_view怎么用?Python Music.as_view使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在music.Music的用法示例。


在下文中一共展示了Music.as_view方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: page_not_found

# 需要导入模块: from music import Music [as 别名]
# 或者: from music.Music import as_view [as 别名]
app =flask.Flask(__name__)

app.secret_key = settings.secret_key

#Routes

app.add_url_rule('/',
			view_func=Main.as_view('main'),
			methods=['GET'])

app.add_url_rule('/<page>/',
			view_func=Main.as_view('page'),
			methods=['GET'])

app.add_url_rule('/login',
			view_func=Login.as_view('login'),
			methods=['GET','POST'])
app.add_url_rule('/remote',
			view_func=Remote.as_view('remote'),
			methods=['GET','POST'])
app.add_url_rule('/music',
			view_func=Music.as_view('music'),
			methods=['GET'])

@app.errorhandler(404)
def page_not_found(error):
	return flask.render_template('404.html'),404

app.debug=True

app.run()
开发者ID:richardqlin,项目名称:flask_demo,代码行数:33,代码来源:app.py

示例2: page_not_found

# 需要导入模块: from music import Music [as 别名]
# 或者: from music.Music import as_view [as 别名]
from events import Events
from users import Users
from docs import Docs

# configuration
DATABASE = 'test.json'

app = flask.Flask(__name__)
app.secret_key = settings.secret_key

#URL rules:  add as needed for the various dynamic pages
app.add_url_rule('/', view_func=Main.as_view('main'), methods=('get','post'))
app.add_url_rule('/<page>/', view_func=Main.as_view('main'), methods=('get','post'))
app.add_url_rule('/login/', view_func=Login.as_view('login'), methods=('get','post'))
app.add_url_rule('/remote/', view_func=Remote.as_view('remote'), methods=('get','post'))
app.add_url_rule('/music/', view_func=Music.as_view('music'), methods=('get', 'post'))
app.add_url_rule('/events/', view_func=Events.as_view('events'), methods=('get','post'))
app.add_url_rule('/users/', view_func=Users.as_view('users'), methods=('get','post'))
app.add_url_rule('/docs/', view_func=Docs.as_view('docs'), methods=('get','post'))

#error handling wrapper
@app.errorhandler(404)
def page_not_found(error):
	return flask.render_template('404.html'), 404

#database handling wrappers
@app.before_request
def before_request():
    """Make sure we are connected to the database each request."""
    try:
        db = open(DATABASE).read()
开发者ID:zkastl,项目名称:knights3,代码行数:33,代码来源:app.py

示例3: page_not_found

# 需要导入模块: from music import Music [as 别名]
# 或者: from music.Music import as_view [as 别名]
import flask
import settings

#Views
from main import Main
from login import Login
from remote import Remote
from music import Music

app = flask.Flask(__name__)
app.secret_key = settings.secret_key

#Routes
app.add_url_rule('/', view_func=Main.as_view('main'), methods=["GET"])
app.add_url_rule('/<page>/', view_func=Main.as_view('main'), methods=["GET"])
app.add_url_rule('/login/', view_func=Login.as_view('login'), methods=["GET", "POST"])
app.add_url_rule('/remote/', view_func=Remote.as_view('remote'), methods=["GET", "POST"])
app.add_url_rule('/music/', view_func=Music.as_view('music'), methods=["GET"])

@app.errorhandler(404)
def page_not_found(error):
	return flask.render_template('404.html'), 404

app.debug = True
app.run()
开发者ID:ovasylev,项目名称:dev-sprint3,代码行数:27,代码来源:app.py

示例4: page_not_found

# 需要导入模块: from music import Music [as 别名]
# 或者: from music.Music import as_view [as 别名]
app.secret_key = settings.secret_key


#Routes	
app.add_url_rule('/',
			view_func=Main.as_view('main')
			methods=["GET"])

app.add_url_rule('/<page>/',
			view_func=Main.as_view('main')
			methods=["GET"])

app.add_url_rule('/Login/', 
			view_func=Login.as_view('login'), 
			methods=['GET', 'POST'])

app.add_url_rule('/remote/', 
			view_func=Music.as_view('remote'), 
			methods=(['GET'])

app.add_url_rule('/music/',
			view_func=Music.as_view('music'),
			methods=['GET'])

@app.errorhandler(404)
def page_not_found(error):
		return flask.render_template('404.html'), 404


app.debug = True
app.run()
开发者ID:learnthecraft617,项目名称:dev-sprint3,代码行数:33,代码来源:base_app.py


注:本文中的music.Music.as_view方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。