A Python content management system designed for kirsle.net featuring a blog, comments and photo albums. https://rophako.kirsle.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

48 lines
1.1 KiB

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