Skip to content

Commit

Permalink
Merge pull request #57 from botstory/feature/move-to-aiohttp-index
Browse files Browse the repository at this point in the history
Feature/move to aiohttp index
  • Loading branch information
hyzhak authored Nov 19, 2016
2 parents 43f7ed8 + c2aca8c commit 8f1b8c9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 205 deletions.
20 changes: 8 additions & 12 deletions echo/main.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
#!/usr/bin/env python

import asyncio
from aiohttp_index import IndexMiddleware

from botstory import chat, story
from botstory.integrations import aiohttp, fb, mongodb
from botstory.integrations.ga import tracker
from botstory.middlewares import any, text
import logging
import os
import pathlib
# import sys

# Makes able to import local modules
# PACKAGE_PARENT = '..'
# SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
# sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))

from echo.static_files_extension import static_files

logger = logging.getLogger('echo-bot')
logger.setLevel(logging.DEBUG)
Expand Down Expand Up @@ -104,6 +98,7 @@ def init(auto_start=True, fake_http_session=None):
http = story.use(aiohttp.AioHttpInterface(
port=os.environ.get('API_PORT', 8080),
auto_start=auto_start,
middlewares=[IndexMiddleware()],
))

# User and Session storage
Expand Down Expand Up @@ -133,10 +128,11 @@ async def start(auto_start=True, fake_http_session=None):

logger.debug('static {}'.format(str(PROJ_ROOT.parent / 'static')))

static_files.add_to(http.app.router, '/',
path=str(PROJ_ROOT.parent / 'static'),
name='static',
)
http.app.router.add_static('/',
path=str(PROJ_ROOT.parent / 'static'),
name='static',
)

# start bot
await story.start()
logger.info('started')
Expand Down
Empty file.
140 changes: 0 additions & 140 deletions echo/static_files_extension/static_files.py

This file was deleted.

52 changes: 0 additions & 52 deletions echo/static_files_extension/static_files_test.py

This file was deleted.

3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
botstory==0.0.35
aiohttp-index==0.1
botstory==0.0.36
gunicorn==19.6.0
pytest==3.0.4
pytest-aiohttp==0.1.2
Expand Down

0 comments on commit 8f1b8c9

Please sign in to comment.