随笔分类 -  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" 阅读全文
posted @ 2020-12-23 16:37 anobscureretreat 阅读(96) 评论(0) 推荐(0) 编辑
摘要:index.html <!DOCTYPE html> <html> <head> <link href="/static/css/style.css" rel="stylesheet"> <script src="https://cdnjs.cloudflare.com/ajax/libs/reac 阅读全文
posted @ 2020-12-23 16:35 anobscureretreat 阅读(94) 评论(0) 推荐(0) 编辑
摘要:接收json class Root(object): @cherrypy.expose @cherrypy.tools.json_in() def index(self): data = cherrypy.request.json print(data) 返回json import cherrypy 阅读全文
posted @ 2020-12-23 16:32 anobscureretreat 阅读(216) 评论(0) 推荐(0) 编辑
摘要:code import cherrypy class MyCookieApp(object): @cherrypy.expose def set(self): cookie = cherrypy.response.cookie cookie['cookieName'] = 'cookieValue' 阅读全文
posted @ 2020-12-23 16:31 anobscureretreat 阅读(120) 评论(0) 推荐(0) 编辑
摘要:code cherrypy.log("hello there") test.py import logging import logging.config import cherrypy logger = logging.getLogger() db_logger = logging.getLogg 阅读全文
posted @ 2020-12-23 16:24 anobscureretreat 阅读(201) 评论(0) 推荐(0) 编辑
摘要:tut12.py import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return "Hello world!" @cherrypy. 阅读全文
posted @ 2020-12-23 16:20 anobscureretreat 阅读(100) 评论(0) 推荐(0) 编辑
摘要:目录结构 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 阅读全文
posted @ 2020-12-23 16:16 anobscureretreat 阅读(108) 评论(0) 推荐(0) 编辑
摘要:目录结构 code import os, os.path import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return """<h 阅读全文
posted @ 2020-12-23 16:10 anobscureretreat 阅读(74) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2020-12-23 16:08 anobscureretreat 阅读(152) 评论(0) 推荐(0) 编辑
摘要:code import random import string import cherrypy @cherrypy.expose class StringGeneratorWebService(object): @cherrypy.tools.accept(media='text/plain') 阅读全文
posted @ 2020-12-23 15:59 anobscureretreat 阅读(155) 评论(0) 推荐(0) 编辑
摘要:code import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return """<html> <head></head> <body 阅读全文
posted @ 2020-12-23 15:55 anobscureretreat 阅读(123) 评论(0) 推荐(0) 编辑
摘要:code import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return """<html> <head></head> <body 阅读全文
posted @ 2020-12-23 15:53 anobscureretreat 阅读(99) 评论(0) 推荐(0) 编辑
摘要:code import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return "Hello world!" @cherrypy.expo 阅读全文
posted @ 2020-12-23 15:51 anobscureretreat 阅读(140) 评论(0) 推荐(0) 编辑
摘要:code import random import string import cherrypy class StringGenerator(object): @cherrypy.expose def index(self): return "Hello world!" @cherrypy.expo 阅读全文
posted @ 2020-12-23 15:47 anobscureretreat 阅读(103) 评论(0) 推荐(0) 编辑
摘要:code import cherrypy class HelloWorld(object): @cherrypy.expose def index(self): return "Hello world!" if __name__ == '__main__': cherrypy.quickstart( 阅读全文
posted @ 2020-12-23 15:46 anobscureretreat 阅读(87) 评论(0) 推荐(0) 编辑
摘要:app.conf [/favicon.ico] tools.staticfile.on: True tools.staticfile.filename: "/path/to/myfavicon.ico" test.py import cherrypy class HelloWorld(object) 阅读全文
posted @ 2020-12-23 15:43 anobscureretreat 阅读(159) 评论(0) 推荐(0) 编辑
摘要:app.conf [/] tools.gzip.on: True [googleapi] key = "..." appid = "..." test.py class Root(object): @cherrypy.expose def index(self): google_appid = ch 阅读全文
posted @ 2020-12-23 15:41 anobscureretreat 阅读(95) 评论(0) 推荐(0) 编辑
摘要:第一种 app.conf [/] tools.gzip.on: True test.py cherrypy.quickstart(myapp, '/', "app.conf") 第二种 class Root(object): @cherrypy.expose @cherrypy.tools.gzip 阅读全文
posted @ 2020-12-23 15:39 anobscureretreat 阅读(230) 评论(0) 推荐(0) 编辑
摘要:code import cherrypy class Band(object): def __init__(self): self.albums = Album() def _cp_dispatch(self, vpath): if len(vpath) == 1: cherrypy.request 阅读全文
posted @ 2020-12-23 15:38 anobscureretreat 阅读(123) 评论(0) 推荐(0) 编辑