2016-10-11 17:45:56 +03:00
|
|
|
"""Run example application."""
|
2016-10-06 22:48:43 +03:00
|
|
|
|
|
|
|
import sys
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from containers import Platform, Application
|
2016-09-18 23:00:10 +03:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2016-12-02 21:43:39 +03:00
|
|
|
# Configure platform:
|
|
|
|
Platform.configuration.update({'database': {'dsn': ':memory:'},
|
|
|
|
'aws': {'access_key_id': 'KEY',
|
|
|
|
'secret_access_key': 'SECRET'},
|
|
|
|
'auth': {'token_ttl': 3600}})
|
2016-10-06 22:48:43 +03:00
|
|
|
Platform.logger().addHandler(logging.StreamHandler(sys.stdout))
|
|
|
|
|
|
|
|
# Run application:
|
|
|
|
Application.main(uid=sys.argv[1],
|
|
|
|
password=sys.argv[2],
|
|
|
|
photo=sys.argv[3])
|
2016-09-18 23:00:10 +03:00
|
|
|
|
|
|
|
# Previous call is an equivalent of next operations:
|
|
|
|
#
|
2016-10-06 22:48:43 +03:00
|
|
|
# logger = logging.Logger(name='example')
|
2016-09-18 23:00:10 +03:00
|
|
|
# database = sqlite3.connect(':memory:')
|
|
|
|
# s3 = boto.s3.connection.S3Connection(aws_access_key_id='KEY',
|
|
|
|
# aws_secret_access_key='SECRET')
|
|
|
|
#
|
2016-10-19 15:25:19 +03:00
|
|
|
# example.main.main(
|
|
|
|
# uid=sys.argv[1],
|
|
|
|
# password=sys.argv[2],
|
|
|
|
# photo=sys.argv[3],
|
|
|
|
# users_service=example.services.UsersService(logger=logger,
|
|
|
|
# db=database),
|
|
|
|
# auth_service=example.services.AuthService(logger=logger,
|
|
|
|
# db=database,
|
|
|
|
# token_ttl=3600),
|
|
|
|
# photos_service=example.services.PhotosService(logger=logger,
|
|
|
|
# db=database,
|
|
|
|
# s3=s3))
|