/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
webserver__cherrypy__examples/jquery__static_dir/main.py
49 строк
999 B
gil9red
Refactoring. Using black code style
28 июн 2023, 14:01
28 июн 2023, 14:01
58287fe
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pip install cherrypy # https://github.com/cherrypy/cherrypy import cherrypy class RootServer: @cherrypy.expose def index(self): return """ <html> <head> <script type="text/javascript" src="jquery 1.4.2.min.js"></script> </head> <body> <a href="jquery 1.4.2.min.js">Open jquery 1.4.2.min.js</a> </body> </html> """ if __name__ == "__main__": import pathlib # Autoreload off cherrypy.config.update({"engine.autoreload.on": False}) # Set port cherrypy.config.update({"server.socket_port": 9090}) # # Public IP # cherrypy.config.update({'server.socket_host': '0.0.0.0'}) static_dir = str((pathlib.Path(__file__).parent / "static").resolve()) # For include css, js in html cherrypy.config.update( { "tools.staticdir.on": True, "tools.staticdir.dir": static_dir, } ) cherrypy.quickstart(RootServer())