Giter VIP home page Giter VIP logo

sanic-guide's Introduction

sanic-guide's People

Contributors

ahopkins avatar anothercat avatar chihweilhbird avatar ensteinjun avatar gabhijit avatar gnat avatar jobedom avatar lllama avatar miss85246 avatar pawelrubin avatar perzan avatar plusk-dev avatar programripper avatar prryplatypus avatar robinlanglois avatar rooba avatar saidbysolo avatar sam-writer avatar sezginonline avatar sfermigier avatar shaib avatar sjsadowski avatar smlbiobot avatar tronic avatar tuna2134 avatar ultrasonic1209 avatar yaakiyu avatar zhilinlinlin avatar zhou-tx avatar zinklu avatar

Stargazers

 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

sanic-guide's Issues

`handlers` in chinese

在中文中,最古老的翻译是句柄,我看我俩翻译的不太一样,你这边是响应程序,我这边是处理函数,我突然觉得响应函数似乎更加得适合,不知道你怎么看? @miss85246

Add documentation on partial segment matching

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.

Detail discussion

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?

Enhance documentation on strict_slashes

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)

markdown lint

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?

Writing Specification

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!

Writing Specification

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:

Overall

Most of our documents are written by the markdown. The current rules are as follows:

1. Heading levels should only increment by one level at a time

When using multiple heading levels, nested headings should increase by only one level at a time:

# Heading1

## Heading2

### Heading3

2. First heading should be a top-level heading

please let document Heading start at H1.

# Heading1

3. Clear separation of paragraphs

  • Between the title and body
  • Between paragraphs and paragraphs
  • Between code blocks and code blocks
  • vuepress grammar block and markdown grammar block

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::

4. Every sentence should end with appropriate punctuation marks.

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...

5. please don't end with empty line in code block.

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.

6. Leave blank before and after grammar blocks in sentences.

√: 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.

7. Try to use Arabic numerals.

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.

8. Use PEP8 in code block for Python.

PEP8 is a standard Python writing standard. When you write Python in code block, please apply PEP8.

9. Try to avoid using italics

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*

10. Emphasize keywords, not the whole sentence

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...**

Custom

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.

Separate the localized configuration from `config.js`

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.
floder

Before separate, config.js have 1082 line.

before

After separate, config.js only have 143 line.

after

Now I have preliminarily finished this work. How do you think?

SEO supporting more search engines

Now, we supported google SEO, we can search sanic documentation easily from google with any documentation supported language
image

image

image

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.

🙈

http1_request_header() error: asyncio.exceptions.CancelledError

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:

  • sanic: 22.6.2
  • python: 3.8.5
  • linux os:
    LSB Version: core-11.1.0ubuntu4-noarch:security-11.1.0ubuntu4-noarch
    Distributor ID: Ubuntu
    Description: Ubuntu 22.04.1 LTS
    Release: 22.04

log screenshot:
image

The duplications of the sections after the lists

#47 #48
The same phenomenon appears on "class-based-views" page too. Similarly, both en and zh.😂
相同的现象又出现在“基于类的视图(Class Based Views)”这个页面上了。同样的,中英文界面都有。
image
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.
这次我已经概览了整个文档,虽然我没有找到更多这样的情况,但是为了以防我的遗漏,请审查一下文档的其他地方。

there is no stream in sanic.response

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)

invalid contribution guidelines link

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?

[`en/guide/basics/routing.md`] "Regular expression applied" to path parameter of type `path` is incorrect

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:

image

Thus, the first phrase should be changed to:

Regular expression applied: r"[^/].*")

image

Writing this issue so I won't forget about it and hoping someone fixes this before I manage to.

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.