sanic-org / sanic-guide Goto Github PK
View Code? Open in Web Editor NEWFrontpage and user guide for Sanic
Home Page: https://sanic.dev
Frontpage and user guide for Sanic
Home Page: https://sanic.dev
Add NOISY_EXCEPTIONS
config value to configuration's built-in values.
Functionality added in sanic-org/sanic#2262.
在
“https://github.com/sanic-org/sanic-guide/blob/main/src/zh/guide/getting-started.md#%E8%BF%90%E8%A1%8Crunning”
处的
“让我们将上面写好的文件保存为 sanic.py, 然后运行它。”
应该改为
“让我们将上面写好的文件保存为 server.py, 然后运行它。”
could you add some examples or links about topics of unittests?
sanic vsersion:22.6.2
ImportError: cannot import name 'stream' from 'sanic.response' (C:\Users\1A\anaconda3\envs\sanic_server\lib\site-packages\sanic\response.py)
Now we have supported three languages, and there is another language being translated. However, all localized configuration stuffed in config.js
. It's bring great challenges to the translation work involving directory changes.
I think we need separate the localized configuration from config.js
.
Before separate, config.js
have 1082 line.
After separate, config.js
only have 143 line.
Now I have preliminarily finished this work. How do you think?
We should probably also include a lifecycle diagram in the docs with the flow of handlers, middleware, and signals.
Originally posted by @ahopkins in sanic-org/sanic#2352 (comment)
Nowadays, the path
type in the Supported types
section of the Routing
page of the Guide Basics reads as:
Regular expression applied: r"[^/].*?")
Cast type: str
Example matches:
/path/to/hello
/path/to/hello.txt
/path/to/hello/world.txt
The supplied regular expression does not match the examples:
Thus, the first phrase should be changed to:
Regular expression applied: r"[^/].*")
Writing this issue so I won't forget about it and hoping someone fixes this before I manage to.
Was removed in 21.12 (according to release notes) and it is also mentioned a in some of the translated pages.
https://sanic.dev/en/guide/deployment/configuration.html#environment-variables
Missing from sanic guide, seems like it should have a section in Advanced.
Sometimes you want to match on a part of a path segment:
/image/123456789.jpg
If you wanted to match the file pattern, but only capture the numeric portion, you need to do some regex fun:
app.route("/image/<img_id:(?P<img_id>\d+)\.jpg>")
This should be documented in the routing section.
https://sanicframework.org/en/guide/advanced/versioning.html#per-blueprint
bp = Blueprint("test", url_prefix="/foo", version=1)
# /v1/foo/text
@bp.route("/html")
def handle_request(request):
return response.html("<p>Hello world!</p>")
/v1/foo/text
-> /v1/foo/html
The headings get trimmed on the left and the content appears to be missing some margin as well as can be seen in the picture:
Issue raised on Fosstodon
#47 #48
The same phenomenon appears on "class-based-views" page too. Similarly, both en and zh.😂
相同的现象又出现在“基于类的视图(Class Based Views)”这个页面上了。同样的,中英文界面都有。
This time I have looked through the whole document, though I didn't find out any more, please review elsewhere in the document in case of my omission.
这次我已经概览了整个文档,虽然我没有找到更多这样的情况,但是为了以防我的遗漏,请审查一下文档的其他地方。
At present, I want to run a torch program with multiple workers, but GPU CUDA needs to configure compatible parameters in the main thread. At present, the relevant configuration documents are not found in the documents
By reading the doc I found some code examples are duplicated.
For example: http://localhost:8081/en/guide/best-practices/logging.html#quick-start
The issue doesn't seems to come from the markdown eg. for the above example: https://github.com/sanic-org/sanic-guide/blob/main/src/en/guide/best-practices/logging.md?plain=1#L28-L38
Maybe it can be a good idea to check all website pages to see if there is this issue on other pages.
https://sanicframework.org/en/guide/how-to/cors.html#options.py
for route in routes.values():
for uri, methods in route.methods.items():
if "OPTIONS" not in methods:
needs_options[uri].extend(methods)
getting error in the second loop, it says frozenset has no attribute items.
hi, @ahopkins .
When I translated the chapter of listener
, The life cycle of a worker process looks not very intuitive.
Have you ever tried to express this concept by using flow chart or other forms?
I think the flow chart is simpler and more intuitive than the text description, and it will also increase the interest.
what do you think?
FOR REFERENCE:
That does not seem sensible IMO. It would be a breaking change for a lot of applications. I would think that most people on the Internet would assume https://mysite.com/foo
and https://mysite.com/foo/
to be the same thing. This is default in Sanic for as long as I can remember.
Since we corrected the bug in the old router, this is the 3rd time this has come up (I just went back to check). I would not call that frequent. I would call it a failure of the docs. We should fix that.
If we want to do anything, then maybe we discuss whether or not str
matching includes and empty string ""
(which it does and is the root of this "problem"). That (however) is a distinct issue from strict slashes.
@johndoe46 Here is a more thorough discussion: sanic-org/sanic#2239 (comment)
And, it is also probably worth mentioning the alternative I gave there that <foo:alpha>
will not have the empty string matching issues.
Originally posted by @ahopkins in sanic-org/sanic#2384 (comment)
Ok, everyone, I think you can take the initiative to read this issue, which shows that you already know what we are going to do. let's beginning!
In the process of contributing guide documents, we should have a consistent writing standard to help vuepress display
better and translators translate more easily. so now we draft this document for every contributor and translator.
the document has 2 part:
Most of our documents are written by the markdown. The current rules are as follows:
When using multiple heading levels, nested headings should increase by only one level at a time:
# Heading1
## Heading2
### Heading3
please let document Heading start at H1.
# Heading1
In the scenario described above, we should keep the paragraphs clear and keep an empty line between them.
# Heading
this is some content...
::-1
the vuepress block should have an empty line with markdown content.
-1::
Ensure that every sentence ends with punctuation marks such as period, ellipsis and question mark.
Do you often encounter problems during use sanic ?
yes, but I can find the solution from sanic froums.
you can add it again, again, again...
in python file, because of PEP8, we often end with an empty line. In markdown file, it's will let code block display
more ugly. vuepress will automatically add empty line when rendering. Please don't manually add empty line in the end of
code block.
in python file, because of PEP8, we often end with an empty line.
√: you can use `request` object and ...
×: you can use`request`object and...
If there are multiple consecutive syntax blocks, only one space is left at the beginning and end of the consecutive
syntax blocks
√: the method `get`, `post` are allowed.
×: the method `get` , `post` are allowed.
For the use of numbers in a sentence, we also try to leave a blank space.
√: I have 20 apps.
×: I have20 apps.
It is inevitable to use numbers in our usual writing process. Please use Arabic numerals as much as possible.
√: It has about 32 bytes.
×: It has about thirty-two bytes.
PEP8 is a standard Python writing standard. When you write Python in code block, please apply PEP8.
In vuepress, italics can't bring great display effect, because its font is too thin, please use bold instead of italics.
√: build faster, run **faster**
×: build faster, run *faster*
In some sentences, if we emphasize a whole sentence, we can't find the key point. We should try to emphasize the
keywords instead of the whole sentence.
√: Quite much configuration is **required** to allow fast transparent proxying...
×: **Quite much configuration is required to allow fast transparent proxying...**
For some specific languages, They have a special writing standard. such as Chinese, Japanese, Korean. Because of the
particularity of language, they need special writing format.
Translators can negotiate with each other to reach a consensus. Just keep the style consistent on the basis of the above.
Now, we supported google SEO, we can search sanic documentation easily from google with any documentation supported language
But out of google,we can't search this documentation. for example, I can't search any offical information in the bigest Chinese search engine —— Baidu.
I think we need let our documentation supported more different countries search engines.
But considering the particularity of Chinese network environment,If you want any supported,you can contact me or Lu,we are willing to provide all help.
🙈
There is one error in my app server:
File "/usr/local/lib/python3.8/site-packages/sanic/http/http1.py", line 123, in http1
await self.http1_request_header()
File "http1_request_header", line 18, in http1_request_header
ServiceUnavailable,
File "/usr/local/lib/python3.8/site-packages/sanic/server/protocols/base_protocol.py", line 82, in receive_more
await self._data_received.wait()
File "/usr/local/lib/python3.8/asyncio/locks.py", line 309, in wait
await fut
asyncio.exceptions.CancelledError
server environment:
https://sanic.readthedocs.io/en/latest/sanic/contributing.html
is now on 404 which still in guide/README.md
.
do we have a valid contribution guidelines page? or should we link contributing to SCOPE page?
In the dependency section, the formatting is incorrect for preformatted items
在中文中,最古老的翻译是句柄,我看我俩翻译的不太一样,你这边是响应程序
,我这边是处理函数
,我突然觉得响应函数
似乎更加得适合,不知道你怎么看? @miss85246
In Running section, https://sanicframework.org/en/guide/getting-started.html#running
It should be fixed to:
sanic server.app:app
We want to add support for language translations. Will fill out with more details.
Since we have a spell check, should we take markdown lint into consideration?
In #17 (disscuss in chinese) @miss85246 said a we should lint on markdown files.
As far as I am concerned, markdown syntax has different standard and the doc has some vuepress syntax, like :::
block.
I think the markdown is fine as long as the vuepress can render it.
Or should we make basic rule on markdown writing such as a blank line between two content line.
Any thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.