Skip to content

Commit

Permalink
adding gunicorn.py
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Jan 5, 2017
1 parent 9e216aa commit e6e1e6a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
17 changes: 17 additions & 0 deletions aiohttp_devtools/start/template/app/gunicorn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
This file allows your to serve your application using gunicorn. gunicorn is not installed by default
by the requirements file adev creates, you'll need to install it yourself.
To run the app using gunicorn, in the terminal run
pip install gunicorn
gunicorn app.gunicorn:app --worker-class aiohttp.worker.GunicornWebWorker
You could also use a variant of the above with heroku (in the `Procfile`) or with Docker in the
ENTRYPOINT statement.
"""
import asyncio
from .main import create_app

loop = asyncio.get_event_loop()
app = create_app(loop)
5 changes: 3 additions & 2 deletions tests/test_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from aiohttp_devtools.start.main import enum_choices

from .conftest import get_if_boxed, get_slow

slow = get_slow(pytest)
if_boxed = get_if_boxed(pytest)

Expand All @@ -35,7 +36,7 @@ def test_start_simple(tmpdir, caplog):
session: secure
database: pg-sqlalchemy
example: message-board
adev.main INFO: project created, 16 files generated\n""" == caplog(('"/tmp/.*?"', '"/tmp/..."'))
adev.main INFO: project created, 17 files generated\n""" == caplog(('"/tmp/.*?"', '"/tmp/..."'))


@if_boxed
Expand All @@ -59,7 +60,7 @@ async def test_start_other_dir(tmpdir, loop, test_client, caplog):
session: secure
database: none
example: message-board
adev.main INFO: project created, 14 files generated\n""" == caplog.log.replace(str(tmpdir), '/<tmpdir>')
adev.main INFO: project created, 15 files generated\n""" == caplog.log.replace(str(tmpdir), '/<tmpdir>')
app = create_main_app(Config(str(tmpdir.join('the-path'))), loop=loop)
assert isinstance(app, aiohttp.web.Application)

Expand Down

0 comments on commit e6e1e6a

Please sign in to comment.