差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
| python:moinmoin [2019/08/09 17:03] – ともやん | python:moinmoin [2021/07/05 02:40] (現在) – ともやん | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | <ifauth !@loggedinusers>< | ||
| - | <script async src="// | ||
| - | < | ||
| - | | ||
| - | google_ad_client: | ||
| - | enable_page_level_ads: | ||
| - | }); | ||
| - | </ | ||
| - | < | ||
| - | < | ||
| - | #result pre { | ||
| - | height: 200px; | ||
| - | overflow: scroll; | ||
| - | overflow-x: hidden; | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| ====== MoinMoin ====== | ====== MoinMoin ====== | ||
| - | {{:python: | + | {{python: |
| \\ | \\ | ||
| 本家: [[https:// | 本家: [[https:// | ||
| 行 31: | 行 14: | ||
| ==== ダウンロード ==== | ==== ダウンロード ==== | ||
| + | [[https:// | ||
| < | < | ||
| - | > git clone https:// | + | $ git clone --depth 1 https:// |
| </ | </ | ||
| ==== quickinstall.py を venv を利用するようにハックする ==== | ==== quickinstall.py を venv を利用するようにハックする ==== | ||
| - | <WRAP prewrap 100% #result> | + | GitHub からダウンロードした **quickinstall.py** をリネームする。\\ |
| + | |||
| + | **Linux**\\ | ||
| + | <WRAP prewrap 100%> | ||
| + | < | ||
| + | $ cd moin | ||
| + | $ mv quickinstall.py quickinstall.py.org | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | **Windows**\\ | ||
| + | <WRAP prewrap 100%> | ||
| + | < | ||
| + | > cd moin | ||
| + | > ren quickinstall.py quickinstall.py.org | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | 以下の **quickinstall.py** を **moin** ディレクトリにダウンロードする。(**quickinstall.py** を差し替える)\\ | ||
| + | <WRAP prewrap 100%> | ||
| + | < | ||
| + | $ curl -O https:// | ||
| + | $ chmod 775 quickinstall.py | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP prewrap 100% mincode_long> | ||
| <file python moin/ | <file python moin/ | ||
| # | # | ||
| 行 93: | 行 102: | ||
| import fnmatch | import fnmatch | ||
| from collections import Counter | from collections import Counter | ||
| - | #try: | + | try: |
| - | # | + | import virtualenv |
| - | #except ImportError: | + | except ImportError: |
| - | # | + | sys.exit(""" |
| - | #Error: import virtualenv failed, either virtualenv is not installed (see installation docs) | + | Error: import virtualenv failed, either virtualenv is not installed (see installation docs) |
| - | #or the virtual environment must be deactivated before rerunning quickinstall.py | + | or the virtual environment must be deactivated before rerunning quickinstall.py |
| - | #""" | + | """ |
| - | import venv | + | |
| if sys.hexversion < 0x3050000: | if sys.hexversion < 0x3050000: | ||
| 行 337: | 行 345: | ||
| command = '{0} quickinstall.py --FirstCall' | command = '{0} quickinstall.py --FirstCall' | ||
| print(' | print(' | ||
| - | print(f' | ||
| with open(QUICKINSTALL, | with open(QUICKINSTALL, | ||
| # we run ourself as a subprocess so we can capture output in a log file | # we run ourself as a subprocess so we can capture output in a log file | ||
| 行 454: | 行 461: | ||
| if wiki_exists(): | if wiki_exists(): | ||
| command = ' | command = ' | ||
| - | print(' | + | print(' |
| try: | try: | ||
| subprocess.call(command, | subprocess.call(command, | ||
| 行 632: | 行 639: | ||
| base, source_name = os.path.split(source) | base, source_name = os.path.split(source) | ||
| executable = os.path.basename(sys.executable).split(' | executable = os.path.basename(sys.executable).split(' | ||
| - | | + | venv = os.path.join(base, |
| - | | + | venv = os.path.abspath(venv) |
| - | | + | venv_home, venv_lib, venv_inc, venv_bin = virtualenv.path_locations(venv) |
| - | venv_home = os.path.join(base, | + | |
| - | venv_home = os.path.abspath(venv_home) | + | |
| - | self.builder = venv.EnvBuilder(with_pip=True) | + | |
| - | context = self.builder.ensure_directories(venv_home) | + | |
| - | venv_home, venv_lib, venv_inc, venv_bin = ( | + | |
| - | context.env_dir, | + | |
| - | os.path.join(context.env_dir, | + | |
| - | context.inc_path, | + | |
| - | context.bin_path) | + | |
| self.dir_venv = venv_home | self.dir_venv = venv_home | ||
| self.dir_venv_bin = venv_bin | self.dir_venv_bin = venv_bin | ||
| 行 655: | 行 653: | ||
| def do_venv(self): | def do_venv(self): | ||
| - | | + | virtualenv.create_environment(self.dir_venv) |
| - | self.builder.create(self.dir_venv) | + | |
| def get_pip_version(self): | def get_pip_version(self): | ||
| 行 721: | 行 718: | ||
| choices.add(name) | choices.add(name) | ||
| args = sys.argv[:] | args = sys.argv[:] | ||
| - | args[0] = os.path.basename(args[0]) | ||
| if len(args) > 2 and args[-1] == ' | if len(args) > 2 and args[-1] == ' | ||
| 行 778: | 行 774: | ||
| </ | </ | ||
| </ | </ | ||
| + | |||
| + | ==== インストール ==== | ||
| + | **quickinstall.py** を実行する。\\ | ||
| + | |||
| + | **Linux**\\ | ||
| + | <WRAP prewrap 100%> | ||
| + | < | ||
| + | $ python3 quickinstall.py | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP prewrap 100% result> | ||
| + | < | ||
| + | Running quickinstall.py... output messages redirected to m-quickinstall.txt | ||
| + | |||
| + | Searching m-quickinstall.txt, | ||
| + | |||
| + | 83 | ||
| + | 119 Successfully installed Babel-2.7.0 Flask-1.1.1 Flask-Babel-0.12.2 Flask-Caching-1.7.2 Flask-Script-2.0.6 Flask-Theme-0.3.4 Jinja2-2.10.1 Markdown-3.1.1 MarkupSafe-1.1.1 Werkzeug-0.15.5 XStatic-1.0.2 XStatic-AnyWikiDraw-0.14.2 XStatic-Bootstrap-3.1.1.2 XStatic-CKEditor-3.6.4.0 XStatic-Font-Awesome-4.7.0.0 XStatic-JQuery.TableSorter-2.14.5.1 XStatic-Pygments-2.2.0.1 XStatic-TWikiDraw-moin-2004.10.23.2 XStatic-autosize-1.17.2.1 XStatic-jQuery-3.3.1.1 XStatic-jQuery-File-Upload-4.4.2 XStatic-svg-edit-moin-2012.11.27.1 blinker-1.4 chardet-3.0.4 click-7.0 docutils-0.15.2 emeraldtree-0.10.0 flatland-0.9.1 itsdangerous-1.1.0 moin passlib-1.7.1 pdfminer3-2018.12.3.0 pycryptodome-3.8.2 pygments-2.4.2 pytz-2019.2 setuptools-41.0.1 six-1.12.0 sortedcontainers-2.1.0 whoosh-2.7.4 | ||
| + | 131 Successfully created or updated venv at / | ||
| + | |||
| + | > > > Type " | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | **Windows**\\ | ||
| + | <WRAP prewrap 100%> | ||
| + | < | ||
| + | > python3 quickinstall.py | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP prewrap 100% result> | ||
| + | < | ||
| + | Running quickinstall.py... output messages redirected to m-quickinstall.txt | ||
| + | |||
| + | Searching m-quickinstall.txt, | ||
| + | |||
| + | 139 Successfully installed Babel-2.9.1 Flask-1.1.4 Flask-Babel-2.0.0 Flask-Caching-1.10.1 Flask-Script-2.0.6 Flask-Theme-0.3.5 Jinja2-2.11.3 Markdown-3.3.4 MarkupSafe-2.0.1 Werkzeug-1.0.1 XStatic-1.0.2 XStatic-AnyWikiDraw-0.14.2 XStatic-Bootstrap-3.1.1.2 XStatic-CKEditor-3.6.4.0 XStatic-Font-Awesome-4.7.0.0 XStatic-JQuery.TableSorter-2.14.5.2 XStatic-Pygments-2.9.0.1 XStatic-TWikiDraw-moin-2004.10.23.2 XStatic-autosize-1.17.2.1 XStatic-jQuery-3.5.1.1 XStatic-jQuery-File-Upload-10.31.0.1 XStatic-svg-edit-moin-2012.11.27.1 blinker-1.4 chardet-4.0.0 click-7.1.2 docutils-0.17.1 emeraldtree-0.10.0 feedgen-0.9.0 flatland-0.9.1 greenlet-1.1.0 itsdangerous-1.1.0 lxml-4.6.3 moin passlib-1.7.4 pdfminer3-2018.12.3.0 pycryptodome-3.10.1 pygments-2.9.0 python-dateutil-2.8.1 pytz-2021.1 six-1.16.0 sortedcontainers-2.4.0 sqlalchemy-1.4.17 whoosh-2.7.4 | ||
| + | 143 c: | ||
| + | 144 | ||
| + | 154 Successfully created or updated venv at C: | ||
| + | Quickinstall run time (h:mm:ss) 0:02:47 | ||
| + | |||
| + | > > > Type " | ||
| + | </ | ||
| + | </ | ||
| + | ^ ディレクトリ | ||
| + | | + ^ moin || moin2 ソースコード | ||
| + | |%%|%%| + | quickinstall.py | ||
| + | |%%|%%| + | m.bat | menu バッチ | | ||
| + | | + ^ moin-venv-python || moin2 仮想環境 | ||
| + | |%%|%%| + | Include | ||
| + | |%%|%%| + | Lib | | | ||
| + | |%%|%%| + | Scripts | ||
| + | |||
| + | menu を実行する。\\ | ||
| + | **Linux, PowerShell**\\ | ||
| + | <WRAP prewrap 100%> | ||
| + | <code powershell> | ||
| + | $ ./m | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | コマンドプロンプト\\ | ||
| + | < | ||
| + | > m | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP prewrap 100% result> | ||
| + | <code powershell> | ||
| + | |||
| + | usage: "m < | ||
| + | |||
| + | quickinstall | ||
| + | extras | ||
| + | docs create moin html documentation (requires extras) | ||
| + | interwiki | ||
| + | log < | ||
| + | |||
| + | new-wiki | ||
| + | sample | ||
| + | restore * | ||
| + | import19 < | ||
| + | |||
| + | run * run built-in wiki server *options (--port 8081) | ||
| + | backup * roll 3 prior backups and create new backup *option, specify file | ||
| + | dump-html * | ||
| + | index | ||
| + | |||
| + | css run lessc to update basic theme CSS files | ||
| + | tests * run tests, log output (-v -k my_test) | ||
| + | coding-std | ||
| + | |||
| + | del-all | ||
| + | del-orig | ||
| + | del-pyc | ||
| + | del-rej | ||
| + | del-wiki | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== 空の Wiki を作成 ==== | ||
| + | **Linux, PowerShell**\\ | ||
| + | <WRAP prewrap 100%> | ||
| + | <code powershell> | ||
| + | $ ./m new-wiki | ||
| + | </ | ||
| + | |||
| + | コマンドプロンプト\\ | ||
| + | < | ||
| + | > m new-wiki | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <WRAP prewrap 100% result> | ||
| + | <code powershell> | ||
| + | Creating a new empty wiki... | ||
| + | Output messages redirected to m-new-wiki.txt. | ||
| + | Important messages from m-new-wiki.txt are shown below: | ||
| + | |||
| + | Error: attempt to create wiki failed. Do "m log new-wiki" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ==== moin2 の実行 ==== | ||
| + | **Linux**\\ | ||
| + | < | ||
| + | $ ./m run | ||
| + | </ | ||
| + | **Windows**\\ | ||
| + | < | ||
| + | > m run | ||
| + | </ | ||
| + | <WRAP prewrap 100% result> | ||
| + | < | ||
| + | 2019-08-09 18: | ||
| + | 2019-08-09 18: | ||
| + | 2019-08-09 18: | ||
| + | 2019-08-09 18: | ||
| + | 2019-08-09 18: | ||
| + | 2019-08-09 18: | ||
| + | 2019-08-09 18: | ||
| + | 2019-08-09 18: | ||
| + | 2019-08-09 18: | ||
| + | * Serving Flask app " | ||
| + | * Environment: | ||
| + | | ||
| + | Use a production WSGI server instead. | ||
| + | * Debug mode: off | ||
| + | 2019-08-09 18: | ||
| + | </ | ||
| + | </ | ||
| + | [[http:// | ||
| + | {{: | ||
| + | |||
| + | ===== ApacheBench してみる ===== | ||
| + | ローカル簡易実行での ApacheBench の結果。\\ | ||
| + | **Web Server:** Werkzeug/ | ||
| + | **Wiki App:** MoinMoin2\\ | ||
| + | **Lang:** Python 3.7.4\\ | ||
| + | **Web Interface: | ||
| + | <WRAP prewrap 100% result> | ||
| + | < | ||
| + | > ab -n 1000 -c 100 http:// | ||
| + | This is ApacheBench, | ||
| + | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http:// | ||
| + | Licensed to The Apache Software Foundation, http:// | ||
| + | |||
| + | Benchmarking localhost (be patient) | ||
| + | Completed 100 requests | ||
| + | Completed 200 requests | ||
| + | Completed 300 requests | ||
| + | Completed 400 requests | ||
| + | Completed 500 requests | ||
| + | Completed 600 requests | ||
| + | Completed 700 requests | ||
| + | Completed 800 requests | ||
| + | Completed 900 requests | ||
| + | Completed 1000 requests | ||
| + | Finished 1000 requests | ||
| + | |||
| + | |||
| + | Server Software: | ||
| + | Server Hostname: | ||
| + | Server Port: 8080 | ||
| + | |||
| + | Document Path: /Home | ||
| + | Document Length: | ||
| + | |||
| + | Concurrency Level: | ||
| + | Time taken for tests: | ||
| + | Complete requests: | ||
| + | Failed requests: | ||
| + | | ||
| + | Total transferred: | ||
| + | HTML transferred: | ||
| + | Requests per second: | ||
| + | Time per request: | ||
| + | Time per request: | ||
| + | Transfer rate: 48.51 [Kbytes/ | ||
| + | |||
| + | Connection Times (ms) | ||
| + | min mean[+/-sd] median | ||
| + | Connect: | ||
| + | Processing: | ||
| + | Waiting: | ||
| + | Total: | ||
| + | |||
| + | Percentage of the requests served within a certain time (ms) | ||
| + | 50% 35389 | ||
| + | 66% 37042 | ||
| + | 75% 37648 | ||
| + | 80% 38042 | ||
| + | 90% 38871 | ||
| + | 95% 39403 | ||
| + | 98% 39964 | ||
| + | 99% 40189 | ||
| + | | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | 1 秒間に平均どれくらいのリクエストをさばけるか?\\ | ||
| + | < | ||
| + | Requests per second: | ||
| + | </ | ||
| + | 1リクエストの平均応答時間は?\\ | ||
| + | < | ||
| + | Time per request: | ||
| + | </ | ||
| + | |||
| + | **Web Server:** Apache/ | ||
| + | **Wiki App:** DokuWiki Release 2018-04-22b " | ||
| + | **Lang:** PHP 7.3.3\\ | ||
| + | **Web Interface: | ||
| + | <WRAP prewrap 100% result> | ||
| + | < | ||
| + | abs -n 1000 -c 100 https:// | ||
| + | This is ApacheBench, | ||
| + | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http:// | ||
| + | Licensed to The Apache Software Foundation, http:// | ||
| + | |||
| + | Benchmarking wiki.monsters-g.local (be patient) | ||
| + | Completed 100 requests | ||
| + | Completed 200 requests | ||
| + | Completed 300 requests | ||
| + | Completed 400 requests | ||
| + | Completed 500 requests | ||
| + | Completed 600 requests | ||
| + | Completed 700 requests | ||
| + | Completed 800 requests | ||
| + | Completed 900 requests | ||
| + | Completed 1000 requests | ||
| + | Finished 1000 requests | ||
| + | |||
| + | |||
| + | Server Software: | ||
| + | Server Hostname: | ||
| + | Server Port: 1443 | ||
| + | SSL/TLS Protocol: | ||
| + | Server Temp Key: ECDH P-256 256 bits | ||
| + | TLS Server Name: wiki.monsters-g.local | ||
| + | |||
| + | Document Path: /start | ||
| + | Document Length: | ||
| + | |||
| + | Concurrency Level: | ||
| + | Time taken for tests: | ||
| + | Complete requests: | ||
| + | Failed requests: | ||
| + | Total transferred: | ||
| + | HTML transferred: | ||
| + | Requests per second: | ||
| + | Time per request: | ||
| + | Time per request: | ||
| + | Transfer rate: 315.21 [Kbytes/ | ||
| + | |||
| + | Connection Times (ms) | ||
| + | min mean[+/-sd] median | ||
| + | Connect: | ||
| + | Processing: | ||
| + | Waiting: | ||
| + | Total: | ||
| + | |||
| + | Percentage of the requests served within a certain time (ms) | ||
| + | 50% 2713 | ||
| + | 66% 3079 | ||
| + | 75% 3954 | ||
| + | 80% 5102 | ||
| + | 90% 11795 | ||
| + | 95% 23513 | ||
| + | 98% 33594 | ||
| + | 99% 40993 | ||
| + | | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | Requests per second: | ||
| + | Time per request: | ||
| + | </ | ||
| + | |||
| + | ===== 参考文献 ===== | ||
| + | [[https:// | ||