Skip to content

Commit

Permalink
Merge pull request #25 from huge-success/master
Browse files Browse the repository at this point in the history
Merge upstream master branch
  • Loading branch information
yunstanford committed Oct 8, 2018
2 parents cc83c1f + 5cc12fd commit 439a386
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ matrix:
python: 3.6
- env: TOX_ENV=check
python: 3.6
install: pip install -U tox
install:
- pip install -U tox
- pip install codecov
script: travis_retry tox -e $TOX_ENV
after_success:
- codecov
deploy:
provider: pypi
user: channelcat
Expand Down
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Sanic
=====

|Join the chat at https://gitter.im/sanic-python/Lobby| |Build Status| |PyPI| |PyPI version|
|Join the chat at https://gitter.im/sanic-python/Lobby| |Build Status| |Codecov| |PyPI| |PyPI version|

Sanic is a Flask-like Python 3.5+ web server that's written to go fast. It's based on the work done by the amazing folks at magicstack, and was inspired by `this article <https://magic.io/blog/uvloop-blazing-fast-python-networking/>`_.

Expand Down Expand Up @@ -47,6 +47,8 @@ Documentation

.. |Join the chat at https://gitter.im/sanic-python/Lobby| image:: https://badges.gitter.im/sanic-python/Lobby.svg
:target: https://gitter.im/sanic-python/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
.. |Codecov| image:: https://codecov.io/gh/huge-success/sanic/branch/master/graph/badge.svg
:target: https://codecov.io/gh/huge-success/sanic
.. |Build Status| image:: https://travis-ci.org/huge-success/sanic.svg?branch=master
:target: https://travis-ci.org/huge-success/sanic
.. |Documentation| image:: https://readthedocs.org/projects/sanic/badge/?version=latest
Expand Down
16 changes: 9 additions & 7 deletions docs/sanic/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ DB_USER = 'appuser'

Out of the box there are just a few predefined values which can be overwritten when creating the application.

| Variable | Default | Description |
| ------------------ | --------- | --------------------------------------------- |
| REQUEST_MAX_SIZE | 100000000 | How big a request may be (bytes) |
| REQUEST_TIMEOUT | 60 | How long a request can take to arrive (sec) |
| RESPONSE_TIMEOUT | 60 | How long a response can take to process (sec) |
| KEEP_ALIVE | True | Disables keep-alive when False |
| KEEP_ALIVE_TIMEOUT | 5 | How long to hold a TCP connection open (sec) |
| Variable | Default | Description |
| ------------------------- | --------- | ------------------------------------------------------ |
| REQUEST_MAX_SIZE | 100000000 | How big a request may be (bytes) |
| REQUEST_TIMEOUT | 60 | How long a request can take to arrive (sec) |
| RESPONSE_TIMEOUT | 60 | How long a response can take to process (sec) |
| KEEP_ALIVE | True | Disables keep-alive when False |
| KEEP_ALIVE_TIMEOUT | 5 | How long to hold a TCP connection open (sec) |
| GRACEFUL_SHUTDOWN_TIMEOUT | 15.0 | How long take to force close non-idle connection (sec) |
| ACCESS_LOG | True | Disable or enable access log |

### The different Timeout variables:

Expand Down
2 changes: 2 additions & 0 deletions sanic/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ def serve(host, port, request_handler, error_handler, before_start=None,
quarter of the high-water limit.
:param is_request_stream: disable/enable Request.stream
:param router: Router object
:param graceful_shutdown_timeout: How long take to Force close non-idle
connection
:return: Nothing
"""
if not run_async:
Expand Down
10 changes: 10 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ class Config:
assert app.config.DEFAULT == 2


def test_overwrite_exisiting_config_ignore_lowercase(app):
app.config.default = 1

class Config:
default = 2

app.config.from_object(Config)
assert app.config.default == 1


def test_missing_config(app):
with pytest.raises(AttributeError) as e:
app.config.NON_EXISTENT
Expand Down

0 comments on commit 439a386

Please sign in to comment.