OSDN Git Service

no use unicorn
authoryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 25 Aug 2017 11:37:40 +0000 (20:37 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 25 Aug 2017 11:37:40 +0000 (20:37 +0900)
Procfile
index.py
requirements.txt

index c033cea..1c09329 100644 (file)
--- a/Procfile
+++ b/Procfile
@@ -1 +1 @@
-web: gunicorn -k tornado index:app
+web: python index.py —port=$PORT
index 968616f..f1ce4da 100755 (executable)
--- a/index.py
+++ b/index.py
@@ -1,10 +1,14 @@
-
+#!/usr/bin/env python
 import os,re
 import tornado.escape
 import tornado.web
 import pymongo
 from datetime import datetime
 import json
+from tornado.options import define, options, parse_command_line
+
+define("port", default=8888, help="run on the given port", type=int)
+define("debug", default=False, help="run in debug mode")
 
 class BaseHandler(tornado.web.RequestHandler):
     def get_current_user(self):
@@ -419,7 +423,14 @@ class Application(tornado.web.Application):
                 name.remove(x)
         return name
 
-app = Application()
-MONGOLAB_URI = 'mongodb://kainushi:1234abcd@ds113678.mlab.com:13678/heroku_n905jfw2'
-conn = pymongo.MongoClient(MONGOLAB_URI,13678)
-app.db = conn.heroku_n905jfw2
+def main():
+    parse_command_line()
+    app = Application()
+    MONGOLAB_URI = 'mongodb://kainushi:1234abcd@ds113678.mlab.com:13678/heroku_n905jfw2'
+    conn = pymongo.MongoClient(MONGOLAB_URI,13678)
+    app.db = conn.heroku_n905jfw2
+    app.listen(options.port)
+    tornado.ioloop.IOLoop.current().start()
+
+if __name__ =='__main__':
+    main()
\ No newline at end of file
index d9a8823..a7d6aa1 100644 (file)
@@ -1,3 +1,2 @@
-gunicorn==19.6.0
 tornado==4.4.2
 pymongo==3.4.0
\ No newline at end of file