随笔分类 - cherrypy
摘要:Index.html <!DOCTYPE html> <html> <head> <link href="/static/css/style.css" rel="stylesheet"> <script src="http://code.jquery.com/jquery-2.0.3.min.js"
阅读全文
摘要:index.html <!DOCTYPE html> <html> <head> <link href="/static/css/style.css" rel="stylesheet"> <script src="https://cdnjs.cloudflare.com/ajax/libs/reac
阅读全文
摘要:接收json class Root(object): @cherrypy.expose @cherrypy.tools.json_in() def index(self): data = cherrypy.request.json print(data) 返回json import cherrypy
阅读全文
摘要:code import cherrypy class MyCookieApp(object): @cherrypy.expose def set(self): cookie = cherrypy.response.cookie cookie['cookieName'] = 'cookieValue'
阅读全文
摘要:code cherrypy.log("hello there") test.py import logging import logging.config import cherrypy logger = logging.getLogger() db_logger = logging.getLogg
阅读全文
摘要:tut12.py import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return "Hello world!" @cherrypy.
阅读全文
摘要:目录结构 index.html <!DOCTYPE html> <html> <head> <link href="/static/css/style.css" rel="stylesheet"> <script src="http://code.jquery.com/jquery-2.0.3.mi
阅读全文
摘要:目录结构 code import os, os.path import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return """<h
阅读全文
摘要:This is why /static/css/style.css is found in public/css/style.css code import os, os.path import random import string import cherrypy class StringGen
阅读全文
摘要:code import random import string import cherrypy @cherrypy.expose class StringGeneratorWebService(object): @cherrypy.tools.accept(media='text/plain')
阅读全文
摘要:code import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return """<html> <head></head> <body
阅读全文
摘要:code import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return """<html> <head></head> <body
阅读全文
摘要:code import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return "Hello world!" @cherrypy.expo
阅读全文
摘要:code import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return "Hello world!" @cherrypy.expo
阅读全文
摘要:code import cherrypy class HelloWorld(object): @cherrypy.expose def index(self): return "Hello world!" if __name__ == '__main__': cherrypy.quickstart(
阅读全文
摘要:app.conf [/favicon.ico] tools.staticfile.on: True tools.staticfile.filename: "/path/to/myfavicon.ico" test.py import cherrypy class HelloWorld(object)
阅读全文
摘要:app.conf [/] tools.gzip.on: True [googleapi] key = "..." appid = "..." test.py class Root(object): @cherrypy.expose def index(self): google_appid = ch
阅读全文
摘要:第一种 app.conf [/] tools.gzip.on: True test.py cherrypy.quickstart(myapp, '/', "app.conf") 第二种 class Root(object): @cherrypy.expose @cherrypy.tools.gzip
阅读全文
摘要:code import cherrypy class Band(object): def __init__(self): self.albums = Album() def _cp_dispatch(self, vpath): if len(vpath) == 1: cherrypy.request
阅读全文