app-const.py 497 B

12345678910111213141516171819202122232425
  1. import multiprocessing
  2. import os
  3. from robyn import Robyn
  4. app = Robyn(__file__)
  5. @app.get('/plaintext', const=True)
  6. def plaintext() -> str:
  7. return "Hello, world!"
  8. if __name__ == '__main__':
  9. _is_travis = os.environ.get('TRAVIS') == 'true'
  10. workers = multiprocessing.cpu_count() * 2 + 1
  11. if _is_travis:
  12. workers = 2
  13. app.processes = workers
  14. app.add_header("Server", "Robyn")
  15. app.add_header("Content-Type", "text/plain")
  16. app.start(url="0.0.0.0", port=8080)