Giter Site home page Giter Site logo

howie6879 / sanic-for-pythoneer Goto Github PK

View Code? Open in Web Editor NEW
390.0 21.0 99.0 2.2 MB

📚 一份sanic使用教程,开源小书

Home Page: https://www.howie6879.cn/sanic_book/

Makefile 7.97% Python 81.39% Batchfile 10.64%
sanic sanic-explore sanic-for-pythoneer book sanic-book

sanic-for-pythoneer's Introduction

Documentation Status

Sanic-For-Pythoneer

  • 这是一份记录文档,是我日常使用Sanic的一些经验之谈,希望能让你在使用Sanic的过程中少走一些弯路
  • 可根据需求跳跃阅读
  • 在线阅读地址

1.介绍

Sanic是一个可以使用 async/await 语法编写项目的异步非阻塞框架,它写法类似于Flask ,但使用了异步特性,而且还使用 uvloop 作为事件循环,其底层使用的是libuv,从而使 Sanic 的速度优势更加明显

我于2017年2月份开始使用 Sanic,使用过程中确实遇到不少问题,如缓存、模板引入、session、认证...

但不用担心,Sanic 更新速度非常快,许多问题都在逐步地解决中,并且比同类别更出色更优秀,个人觉得 Sanic 是一个值得尝试的异步框架,不论是代码编写还是性能比较都算非常不错

本项目的结构如下:

第一部分:技巧

第二部分:源码及附录

2.更新

代码的世界变幻莫测,我能做的就是尽量将本篇文档持续更新、持续修正、让其处于当前最新的状态

3.说明

如果您在使用中有什么不明白的问题,欢迎一起交流(扫码关注,发送:Sanic可获取本书PDF版):

我也创建了一个免费的Python知识星球,欢迎大家一起交流:

sanic-for-pythoneer's People

Contributors

howie6879 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sanic-for-pythoneer's Issues

勘误

1.初使用.md 章中有一节 ”踏出第一步“ run.py代码因为
app = Sanic()
改为
app = Sanic( name )

app.run(host="0.0.0.0", port=8000)
改为
app.run(host="localhost", port=8000 )

浏览器输入地址应为 http://localhost:8000/

你好打扰了,本人小白,本地运行你的代码,报错

https://github.com/howie6879/Sanic-For-Pythoneer/blob/master/examples/demo01/news.py

Traceback (most recent call last):
File "/home/liu/PycharmProjects/sanic_test/run.py", line 45, in
async def index(request, page=1):
File "/home/liu/anaconda3/envs/flask_blog/lib/python3.6/site-packages/sanic/app.py", line 197, in response
args = list(signature(handler).parameters.keys())
File "/home/liu/anaconda3/envs/flask_blog/lib/python3.6/inspect.py", line 3065, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
File "/home/liu/anaconda3/envs/flask_blog/lib/python3.6/inspect.py", line 2815, in from_callable
follow_wrapper_chains=follow_wrapped)
File "/home/liu/anaconda3/envs/flask_blog/lib/python3.6/inspect.py", line 2193, in _signature_from_callable
raise TypeError('{!r} is not a callable object'.format(obj))
TypeError: ([Route(handler=<function index at 0x7fecec5b6620>, methods=frozenset({'GET'}), pattern=re.compile('^/$'), parameters=[], name='index', uri='/')], <function index at 0x7fecec5b6620>) is not a callable object

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.