A Python content management system designed for kirsle.net featuring a blog, comments and photo albums. https://rophako.kirsle.net/
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from __future__ import unicode_literals, absolute_import
  4. import argparse
  5. from rophako.app import app
  6. parser = argparse.ArgumentParser(description="Rophako")
  7. parser.add_argument(
  8. "--port", "-p",
  9. type=int,
  10. help="Port to listen on",
  11. default=2006,
  12. )
  13. parser.add_argument(
  14. "--key", "-k",
  15. type=str,
  16. help="SSL private key file. Providing this option will turn on SSL mode " \
  17. + "(and will require pyOpenSSL to be installed).",
  18. )
  19. parser.add_argument(
  20. "--cert", "-c",
  21. type=str,
  22. help="SSL certificate file.",
  23. )
  24. parser.add_argument(
  25. "--production",
  26. help="Turns off debug mode, runs as if in production.",
  27. action="store_true",
  28. )
  29. args = parser.parse_args()
  30. if __name__ == '__main__':
  31. flask_options = dict(
  32. host='0.0.0.0',
  33. debug=not args.production,
  34. port=args.port,
  35. threaded=True,
  36. )
  37. if args.key and args.cert:
  38. from OpenSSL import SSL
  39. context = SSL.Context(SSL.SSLv23_METHOD)
  40. context.use_privatekey_file(args.key)
  41. context.use_certificate_file(args.cert)
  42. app.config['SESSION_COOKIE_SECURE'] = True
  43. flask_options["ssl_context"] = context
  44. app.run(**flask_options)