Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASGI cookbook recipe #198

Merged
merged 3 commits into from
May 20, 2018
Merged

ASGI cookbook recipe #198

merged 3 commits into from
May 20, 2018

Conversation

jordaneremieff
Copy link
Contributor

Refers to Pylons/pyramid#2603.

This provides an example ASGI WebSocket app using Pyramid. It also contains example deployment configurations for nginx and supervisor.

Copy link
Member

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This looks good. I made a few suggestions.

ASGI (Asynchronous Server Gateway Interface)
++++++++++++++++++++++++++++++++++++++++++++


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove 1 extra blank line.

Note, it's OK to have two blank lines preceding a heading because it helps visually separate the narrative from the subsequent heading. Next it's good to have the heading visually "connect" with its narrative content.



This chapter contains information about using ASGI with
Pyramid. You can read more about the specification here: https://github.com/django/asgiref/blob/master/specs/asgi.rst.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you consider publishing to Read the Docs? GitHub's rendering of reStructuredText is suboptimal. I can assist with PRs to your repo, if you like, but you'd need to configure GitHub and RTD under your own account.

This chapter contains information about using ASGI with
Pyramid. You can read more about the specification here: https://github.com/django/asgiref/blob/master/specs/asgi.rst.

The example app below uses the WSGI to ASGI wrapper from the `asgiref` library to transform normal WSGI requests into ASGI responses - this allows the application to be run with an ASGI server, `uvicorn` or `daphne`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reStructuredText uses double-ticks for inline literals, single-ticks for italics/emphasis. If literals are your intent, then change them throughout, for example:

``asgiref``

However, when first mentioned in a narrative, it is a good idea to include links to references. Suggest for the first instance of each turning these into links, with subsequent mentions as inline literals.

`asgiref <https://pypi.org/project/asgiref/>`_

This is two sentences. "responses. This"

Finally:

 server, including `uvicorn <http://www.uvicorn.org/>`_ or `daphne <https://pypi.org/project/daphne/>`_.

Note, choosing appropriate URLs for a project depends on context. Here the context is docs. Unfortunately there are no ReadTheDocs URLs for these projects, so I picked the one that appears to best represent the project, with PyPI as the default. If you have better URLs, please use them instead.

Simple WSGI -> ASGI WebSocket application
-----------------------------------------


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove 1 extra blank line.

$ daphne app:app


There are several potential deployment options, one example is `nginx` and `supervisor`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`nginx <https://nginx.org/>`_ and `supervisor <http://supervisord.org/>`_.

@jordaneremieff
Copy link
Contributor Author

Thanks for the quick feedback :)

I'll have a think about how I should go about hosting the documentation and then update the PR based on your suggestions.

@stevepiercy stevepiercy merged commit 4437b6c into Pylons:master May 20, 2018
@stevepiercy
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants