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()
""" 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
def REDIRECT_URI(self): return environment.get_unicode(unicode("TASK_RABBIT_REDIRECT_URI"))
def ACCESS_TOKEN(self): return environment.get_unicode(unicode("TASK_RABBIT_ACCESS_TOKEN"))
def SECRET(self): return environment.get_unicode(unicode("TASK_RABBIT_SECRET"))
def KEY(self): return environment.get_unicode(unicode("TASK_RABBIT_KEY"))
def DOMAIN(self): return environment.get_unicode(unicode("TASK_RABBIT_DOMAIN"))
def DOMAIN(self): return environment.get_unicode(unicode("SEND_JACK_DOMAIN"))
def PASSWORD(self): return environment.get_unicode(unicode("PGPASSWORD"))
def USER(self): return environment.get_unicode(unicode("PGUSER"))
def DATABASE(self): return environment.get_unicode(unicode("PGDATABASE"))
def HOST(self): return environment.get_unicode(unicode("PGHOST"))
def URL(self): return environment.get_unicode(unicode("DATABASE_URL"))
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"))
""" 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
# 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:
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
def API_KEY(self): return environment.get_unicode(unicode("ASANA_API_KEY"))