diff --git a/development.ini b/development.ini index 4b599f1..fa1d469 100644 --- a/development.ini +++ b/development.ini @@ -16,7 +16,7 @@ pyramid.includes = pyramid_debugtoolbar pyramid_jinja2 -sqlalchemy.url = sqlite:///%(here)s/ordr2.sqlite +sqlalchemy.url = sqlite:///%(here)s/ordr2_development.sqlite passlib.config = %(here)s/passlib.ini # automatic CSRF token validation on each POST resquest diff --git a/ordr2/scripts/initializedb.py b/ordr2/scripts/initializedb.py index cee3c72..7477f61 100644 --- a/ordr2/scripts/initializedb.py +++ b/ordr2/scripts/initializedb.py @@ -17,7 +17,7 @@ from ..models import ( get_session_factory, get_tm_session, ) -# from ..models import MyModel +from ..models.account import User, Role, passlib_context def usage(argv): @@ -40,8 +40,17 @@ def main(argv=sys.argv): session_factory = get_session_factory(engine) + passlib_context.load_path(settings['passlib.config']) + with transaction.manager: dbsession = get_tm_session(session_factory, transaction.manager) - # model = MyModel(name='one', value=1) - # dbsession.add(model) + user = User( + username='HolgerFrey', + first_name='Holger', + last_name='Frey', + email='frey@imtek.de', + role=Role.ADMIN + ) + user.set_password('holgi') + dbsession.add(user)