Skip to content

Commit

Permalink
More Heroku config.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcteale committed Feb 17, 2016
1 parent 28714c5 commit 72f589f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# This tells Heroku to run a web app, and what to run.
web: ./run
7 changes: 5 additions & 2 deletions learning_journal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from .security import EntryFactory

import os
from .models import (
DBSession,
Base,
Expand All @@ -13,12 +13,15 @@
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
if 'DATABASE_URL' in os.environ:
settings['sqlalchemy.url'] = os.environ['DATABASE_URL']
engine = engine_from_config(settings, 'sqlalchemy.')
secret = os.environ.get('AUTH_SECRET', 'somesecret')
DBSession.configure(bind=engine)
Base.metadata.bind = engine
config = Configurator(
settings=settings,
authentication_policy=AuthTktAuthenticationPolicy('somesecret'),
authentication_policy=AuthTktAuthenticationPolicy(secret),
authorization_policy=ACLAuthorizationPolicy(),
default_permission='view'
)
Expand Down
5 changes: 3 additions & 2 deletions learning_journal/scripts/initializedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def main(argv=sys.argv):
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)
with transaction.manager:
encrypted = password_context.encrypt('admin')
admin = User(name='admin', password=encrypted)
password = os.environ.get('ADMIN_PASSWORD', 'admin')
encrypted = password_context.encrypt(password)
admin = User(name=u'admin', password=encrypted)
DBSession.add(admin)
38 changes: 38 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Chameleon==2.24
decorator==4.0.7
ipython==4.1.1
ipython-genutils==0.1.0
Jinja2==2.8
Mako==1.0.3
MarkupSafe==0.23
passlib==1.6.5
PasteDeploy==1.5.2
path.py==8.1.2
pexpect==4.0.1
pickleshare==0.6
ptyprocess==0.5.1
py==1.4.31
psycopg2==2.6.1
Pygments==2.1
pyramid==1.6.1
pyramid-chameleon==0.3
pyramid-debugtoolbar==2.4.2
pyramid-ipython==0.1
pyramid-jinja2==2.6.2
pyramid-mako==1.0.2
pyramid-tm==0.12.1
pytest==2.8.7
repoze.lru==0.6
simplegeneric==0.8.1
SQLAlchemy==1.0.11
traitlets==4.1.0
transaction==1.4.4
translationstring==1.3
venusian==1.0
waitress==0.8.10
WebOb==1.5.1
wheel==0.26.0
WTForms==2.1
zope.deprecation==4.1.2
zope.interface==4.1.3
zope.sqlalchemy==0.7.6

0 comments on commit 72f589f

Please sign in to comment.