]> git.aero2k.de Git - sirius.git/commitdiff
preparing to do a test deploy to heroku
authorMatt Webb <matt@interconnected.org>
Sat, 27 Sep 2014 12:24:41 +0000 (13:24 +0100)
committerMatt Webb <matt@interconnected.org>
Sat, 27 Sep 2014 12:24:41 +0000 (13:24 +0100)
Procfile [new file with mode: 0644]
config.py
requirements.txt

diff --git a/Procfile b/Procfile
new file mode 100644 (file)
index 0000000..ff76cd9
--- /dev/null
+++ b/Procfile
@@ -0,0 +1 @@
+web: gunicorn -k flask_sockets.worker manage:app
index 49993cf59b4be3a83b1027eb3200d558665d3e9f..dfb1eb5ac0c8d5a8b9a128f230e96214d783abd3 100755 (executable)
--- a/config.py
+++ b/config.py
@@ -3,20 +3,49 @@ basedir = os.path.abspath(os.path.dirname(__file__))
 
 
 class Config:
-    SECRET_KEY = os.environ.get('SECRET_KEY') or 'this is the lp2 secret'
-    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
-
-    @staticmethod
-    def init_app(app):
-        pass
+       SECRET_KEY = os.environ.get('SECRET_KEY') or 'this is the lp2 secret'
+       SQLALCHEMY_COMMIT_ON_TEARDOWN = True
+       
+       @staticmethod
+       def init_app(app):
+               pass
 
 class DevelopmentConfig(Config):
-    DEBUG = True
-    SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or \
-        'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
+       DEBUG = True
+       SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or \
+               'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
+
+class ProductionConfig(Config):
+       SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
+               'sqlite:///' + os.path.join(basedir, 'data.sqlite')
+       
+       @classmethod
+       def init_app(cls, app):
+               Config.init_app(app)
+       
+class HerokuConfig(ProductionConfig):
+       SSL_DISABLE = bool(os.environ.get('SSL_DISABLE'))
+       
+       @classmethod
+       def init_app(cls, app):
+               ProductionConfig.init_app(app)
+
+               # handle proxy server headers
+               from werkzeug.contrib.fixers import ProxyFix
+               app.wsgi_app = ProxyFix(app.wsgi_app)
+               
+               # log to stderr
+               import logging
+               from logging import StreamHandler
+               file_handler = StreamHandler()
+               file_handler.setLevel(logging.WARNING)
+               app.logger.addHandler(file_handler)
+
 
 config = {
-    'development': DevelopmentConfig,
-    
-    'default': DevelopmentConfig
+       'development': DevelopmentConfig,
+       'production': ProductionConfig,
+       'heroku': HerokuConfig,
+       
+       'default': DevelopmentConfig
 }
\ No newline at end of file
index a5502ba5209bd7f6f2ba21847f9dde17d10c4f89..4e2ed5cd206dc32a473971cb98d8bcedc1e4fb4f 100755 (executable)
@@ -18,6 +18,7 @@ gevent-websocket==0.9.3
 greenlet==0.4.4
 gunicorn==19.1.1
 itsdangerous==0.24
+psycopg2==2.5.4
 pycrypto==2.6.1
 redis==2.10.3
 selenium==2.43.0