profiler.py 596 B

1234567891011121314151617181920212223
  1. import logging
  2. from logging.config import dictConfig
  3. from werkzeug.contrib.profiler import ProfilerMiddleware
  4. # Environment must be set before importing the app factory function.
  5. from lakesuperior import env
  6. env.setup()
  7. options = {
  8. 'restrictions': [50],
  9. #'profile_dir': '/var/tmp/lsup_profiling'
  10. }
  11. from lakesuperior.app import create_app
  12. def run():
  13. fcrepo = create_app(env.app_globals.config['application'])
  14. fcrepo.wsgi_app = ProfilerMiddleware(fcrepo.wsgi_app, **options)
  15. fcrepo.config['PROFILE'] = True
  16. fcrepo.run(debug = True)
  17. if __name__ == '__main__':
  18. run()