Skip to content

Commit

Permalink
wsgi에 bot 실행 통합
Browse files Browse the repository at this point in the history
  • Loading branch information
sim0629 committed May 10, 2012
1 parent 1d286ed commit 67db33b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
config.py
config.pyc
*.pyc
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python wsgi.py
2 changes: 1 addition & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self):
self.connected = False

connection = pymongo.Connection()
self.db = connection.sirc_db
self.db = connection[config.SIRC_DB]
self.db.send.remove()
self._fetch()

Expand Down
1 change: 1 addition & 0 deletions config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# SIRC
N_LINES = 32
SIRC_PORT = 2354
SIRC_DB = 'sirc_db'

# IRC
SERVER = 'irc.uriirc.org'
Expand Down
5 changes: 4 additions & 1 deletion wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
sys.path.append(PATH)

import config
import bot

con = pymongo.Connection()
db = con.sirc_db
db = con[config.SIRC_DB]

def application(environ, start_response):
cookie = Cookie.SimpleCookie()
Expand Down Expand Up @@ -285,6 +286,8 @@ def remove_invalid_utf8_char(s):
return pattern.sub(u'�', s)

if __name__ == '__main__':
bot = bot.SBot()
gevent.spawn(bot.start)
server = gevent.pywsgi.WSGIServer(('0.0.0.0', config.SIRC_PORT), application)
server.serve_forever()

0 comments on commit 67db33b

Please sign in to comment.