Ejemplo n.º 1
0
class SQLAlchemy(Database):

    _PROTOCOL = "postgres"
    _USER = environment.get_unicode(unicode("PGUSER"))
    _PASSWORD = environment.get_unicode(unicode("PGPASSWORD"))
    _HOST = environment.get_unicode(unicode("PGHOST"))
    _PORT = environment.get_integer(unicode("PGPORT"))
    _PATH = environment.get_unicode(unicode("PGDATABASE"))

    def _init_db(self):
        # TODO: use a url utility package for this sort of thing.
        url = "{}://{}:{}@{}:{}/{}".format(self._PROTOCOL, self._USER,
                                           self._PASSWORD, self._HOST,
                                           self._PORT, self._PATH)

        # our dev instance of PostGres only allows for 20 connections across
        # all applications (Jackalope, SendJack, Prod/Staging/Warman/Hammer)
        engine = create_engine(
            url,
            #echo=True,
            #echo_pool=True,
            # As we have a lot of clients connecting to a 20 connection DB
            # simulataneously.
            pool_size=2,
            max_overflow=1,
            # As we are getting an EOF OperationalError after long breaks
            # without queries.
            pool_recycle=120)

        # create_all must be called after the objects are imported.
        DeclarativeModel.metadata.create_all(engine)

        session_factory = sessionmaker(bind=engine)
        self.session_constructor = scoped_session(session_factory)

    def session(self):
        return self.session_constructor()
Ejemplo n.º 2
0
"""

import requests

from jutil.decorators import constant
from jutil.environment import Deployment, get_unicode

MAILGUN_API_URL = unicode("https://api.mailgun.net/v2")
MAILGUN_MESSAGES_SUFFIX = unicode("messages")

_mailgun_api_key = None
_mailgun_domain = None
_default_name = unicode("")
_default_email = unicode("")
_new_comment_subject = unicode("A comment on task ")
_BOT_EMAIL = get_unicode(unicode("BOT_EMAIL"))


class _Mail(object):

    """Mail constants for interacting with incoming mail from MailGun.

    http://documentation.mailgun.net/user_manual.html#receiving-messages

    """

    @constant
    def RECIPIENT(self):
        return "recipient"

    @constant
Ejemplo n.º 3
0
 def REDIRECT_URI(self):
     return environment.get_unicode(unicode("TASK_RABBIT_REDIRECT_URI"))
Ejemplo n.º 4
0
 def ACCESS_TOKEN(self):
     return environment.get_unicode(unicode("TASK_RABBIT_ACCESS_TOKEN"))
Ejemplo n.º 5
0
 def SECRET(self):
     return environment.get_unicode(unicode("TASK_RABBIT_SECRET"))
Ejemplo n.º 6
0
 def KEY(self):
     return environment.get_unicode(unicode("TASK_RABBIT_KEY"))
Ejemplo n.º 7
0
 def DOMAIN(self):
     return environment.get_unicode(unicode("TASK_RABBIT_DOMAIN"))
Ejemplo n.º 8
0
 def DOMAIN(self):
     return environment.get_unicode(unicode("SEND_JACK_DOMAIN"))
Ejemplo n.º 9
0
 def PASSWORD(self):
     return environment.get_unicode(unicode("PGPASSWORD"))
Ejemplo n.º 10
0
 def USER(self):
     return environment.get_unicode(unicode("PGUSER"))
Ejemplo n.º 11
0
 def DATABASE(self):
     return environment.get_unicode(unicode("PGDATABASE"))
Ejemplo n.º 12
0
 def HOST(self):
     return environment.get_unicode(unicode("PGHOST"))
Ejemplo n.º 13
0
 def URL(self):
     return environment.get_unicode(unicode("DATABASE_URL"))
Ejemplo n.º 14
0
ROOT = os.path.dirname(os.path.abspath(__file__))

# Tornado
PORT = environment.get_integer(unicode("PORT"))
define("port", default=PORT, help="run on the given port", type=int)

define("config", default=None, help="tornado config file")
define("debug", default=True, help="debug mode")
options.parse_command_line()

MEDIA_ROOT = path(ROOT, 'media')
#TEMPLATE_ROOT = path(ROOT, 'view/templates')
#
# settings dictionary
settings = {}
settings['debug'] = options.debug
settings['static_path'] = MEDIA_ROOT
#settings['cookie_secret'] = (
#        "\xee\x0ec\x9bl\x02\xeb/.\xd4\xeb\xc2(\xb0\xb1\x8a\x0b\xb5[^Tq\xecy")
#settings['xsrf_cookies'] = True
#settings['login_url'] = "/"
#settings['template_loader'] = tornado.template.Loader(TEMPLATE_ROOT)
settings['ui_modules'] = {}

if options.config:
    tornado.options.parse_config_file(options.config)

# SERVICES
MAILGUN_API_KEY = environment.get_unicode(unicode("MAILGUN_API_KEY"))
MAILGUN_DOMAIN = environment.get_unicode(unicode("MAILGUN_DOMAIN"))
Ejemplo n.º 15
0
"""
import os
import tornado
import tornado.template
from tornado.options import define, options
from jinja2 import Environment, PackageLoader

from jutil import environment


# Make filepaths relative to settings.
path = lambda root, *a: os.path.join(root, *a)
ROOT = os.path.dirname(os.path.abspath(__file__))

EMBEDDABLE_DOMAIN = environment.get_unicode(unicode("EMBEDDABLE_DOMAIN"))
SSL_DOMAIN = environment.get_unicode(unicode("SSL_DOMAIN"))
PORT = environment.get_integer(unicode("PORT"), 5000)

# tornado config
define("port", default=PORT, help="run on the given port", type=int)
define("config", default=None, help="tornado config file")
define("debug", default=True, help="debug mode")
tornado.options.parse_command_line()

MEDIA_ROOT = path(ROOT, 'media')
TEMPLATE_ROOT = path(ROOT, 'view/templates')

# settings dictionary
settings = {}
settings['debug'] = options.debug
Ejemplo n.º 16
0
# Make filepaths relative to settings.
path = lambda root, *a: os.path.join(root, *a)
ROOT = os.path.dirname(os.path.abspath(__file__))

# Tornado
PORT = environment.get_integer(unicode("PORT"))
define("port", default=PORT, help="run on the given port", type=int)

define("config", default=None, help="tornado config file")
define("debug", default=True, help="debug mode")
options.parse_command_line()

MEDIA_ROOT = path(ROOT, 'media')
#TEMPLATE_ROOT = path(ROOT, 'view/templates')
MAILGUN_API_KEY = environment.get_unicode(unicode("MAILGUN_API_KEY"))
MAILGUN_DOMAIN = environment.get_unicode(unicode("MAILGUN_DOMAIN"))

#
# settings dictionary
settings = {}
settings['debug'] = options.debug
settings['static_path'] = MEDIA_ROOT
#settings['cookie_secret'] = (
#        "\xee\x0ec\x9bl\x02\xeb/.\xd4\xeb\xc2(\xb0\xb1\x8a\x0b\xb5[^Tq\xecy")
#settings['xsrf_cookies'] = True
#settings['login_url'] = "/"
#settings['template_loader'] = tornado.template.Loader(TEMPLATE_ROOT)
settings['ui_modules'] = {}

if options.config:
Ejemplo n.º 17
0
Settings for Tornado project.

"""
import os
import tornado
import tornado.template
from tornado.options import define, options
from jinja2 import Environment, PackageLoader

from jutil import environment

# Make filepaths relative to settings.
path = lambda root, *a: os.path.join(root, *a)
ROOT = os.path.dirname(os.path.abspath(__file__))

EMBEDDABLE_DOMAIN = environment.get_unicode(unicode("EMBEDDABLE_DOMAIN"))
SSL_DOMAIN = environment.get_unicode(unicode("SSL_DOMAIN"))
PORT = environment.get_integer(unicode("PORT"), 5000)

# tornado config
define("port", default=PORT, help="run on the given port", type=int)
define("config", default=None, help="tornado config file")
define("debug", default=True, help="debug mode")
tornado.options.parse_command_line()

MEDIA_ROOT = path(ROOT, 'media')
TEMPLATE_ROOT = path(ROOT, 'view/templates')

# settings dictionary
settings = {}
settings['debug'] = options.debug
Ejemplo n.º 18
0
 def API_KEY(self):
     return environment.get_unicode(unicode("ASANA_API_KEY"))