python:moinmoin

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
python:moinmoin [2019/08/09 18:00] ともやんpython:moinmoin [2021/07/05 02:40] (現在) ともやん
行 1: 行 1:
-<ifauth !@loggedinusers><html> 
-<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> 
-<script> 
-     (adsbygoogle = window.adsbygoogle || []).push({ 
-          google_ad_client: "ca-pub-0791334967460971", 
-          enable_page_level_ads: true 
-     }); 
-</script></html></ifauth> 
-<html> 
-  <style> 
-    #result pre { 
-      height: 200px; 
-      overflow: scroll; 
-      overflow-x: hidden; 
-    } 
-  </style> 
-</html> 
 ====== MoinMoin ====== ====== MoinMoin ======
-{{:python:moinmoin_logo.png?100|MoinMoin Logo}}\\+{{python:moinmoin_logo.png?100|MoinMoin Logo}}\\
 \\ \\
 本家: [[https://moinmo.in/|MoinMoinWiki - MoinMoin]]\\ 本家: [[https://moinmo.in/|MoinMoinWiki - MoinMoin]]\\
行 31: 行 14:
  
 ==== ダウンロード ==== ==== ダウンロード ====
 +[[https://github.com/moinwiki/moin|GitHub - moinwiki/moin: MoinMoin Wiki Development (2.0+)]] より、ソースコードをダウンロードする。\\
 <code> <code>
-git clone https://github.com/moinwiki/moin.git+git clone --depth 1 https://github.com/moinwiki/moin.git
 </code> </code>
  
 ==== quickinstall.py を venv を利用するようにハックする ==== ==== quickinstall.py を venv を利用するようにハックする ====
 GitHub からダウンロードした **quickinstall.py** をリネームする。\\ GitHub からダウンロードした **quickinstall.py** をリネームする。\\
 +
 +**Linux**\\
 +<WRAP prewrap 100%>
 +<code>
 +$ cd moin
 +$ mv quickinstall.py quickinstall.py.org
 +</code>
 +</WRAP>
 +
 +**Windows**\\
 +<WRAP prewrap 100%>
 <code> <code>
 > cd moin > cd moin
 > ren quickinstall.py quickinstall.py.org > ren quickinstall.py quickinstall.py.org
 </code> </code>
 +</WRAP>
 +
 以下の **quickinstall.py** を **moin** ディレクトリにダウンロードする。(**quickinstall.py** を差し替える)\\ 以下の **quickinstall.py** を **moin** ディレクトリにダウンロードする。(**quickinstall.py** を差し替える)\\
-<WRAP prewrap 100% #result>+<WRAP prewrap 100%
 +<code> 
 +$ curl -O https://www.tomoyan.net/_media/python/quickinstall.py 
 +$ chmod 775 quickinstall.py 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% mincode_long>
 <file python moin/quickinstall.py> <file python moin/quickinstall.py>
 #!/usr/bin/python #!/usr/bin/python
行 99: 行 102:
 import fnmatch import fnmatch
 from collections import Counter from collections import Counter
-#try: +try: 
-   import virtualenv +    import virtualenv 
-#except ImportError: +except ImportError: 
-   sys.exit(""" +    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:
行 459: 行 461:
         if wiki_exists():         if wiki_exists():
             command = '{0}moin index-create -i{1} moin index-build'.format(ACTIVATE, SEP)             command = '{0}moin index-create -i{1} moin index-build'.format(ACTIVATE, SEP)
-            print('Rebuilding indexes...(ignore log messages from rst parser)...')+            print('Rebuilding indexes...')
             try:             try:
                 subprocess.call(command, shell=True)                 subprocess.call(command, shell=True)
行 637: 行 639:
         base, source_name = os.path.split(source)         base, source_name = os.path.split(source)
         executable = os.path.basename(sys.executable).split('.exe')[0]         executable = os.path.basename(sys.executable).split('.exe')[0]
-        #venv = os.path.join(base, '{0}-venv-{1}'.format(source_name, executable)) +        venv = os.path.join(base, '{0}-venv-{1}'.format(source_name, executable)) 
-        #venv = os.path.abspath(venv) +        venv = os.path.abspath(venv) 
-        #venv_home, venv_lib, venv_inc, venv_bin = virtualenv.path_locations(venv+        venv_home, venv_lib, venv_inc, venv_bin = virtualenv.path_locations(venv)
-        venv_home = os.path.join(base, '{0}-venv-{1}'.format(source_name, executable)) +
-        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, 'Lib') if sys.platform == 'win32' else os.path.join(context.env_dir, 'lib'), +
-            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
行 660: 行 653:
  
     def do_venv(self):     def do_venv(self):
-        #virtualenv.create_environment(self.dir_venv) +        virtualenv.create_environment(self.dir_venv)
-        self.builder.create(self.dir_venv)+
  
     def get_pip_version(self):     def get_pip_version(self):
行 726: 行 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] == '--help':     if len(args) > 2 and args[-1] == '--help':
行 783: 行 774:
 </file> </file>
 </WRAP> </WRAP>
 +
 +==== インストール ====
 **quickinstall.py** を実行する。\\ **quickinstall.py** を実行する。\\
 +
 +**Linux**\\
 +<WRAP prewrap 100%>
 <code> <code>
-> python quickinstall.py+$ python3 quickinstall.py
 </code> </code>
 +</WRAP>
 +<WRAP prewrap 100% result>
 +<code>
 +Running quickinstall.py... output messages redirected to m-quickinstall.txt
 +
 +Searching m-quickinstall.txt, important messages are shown below... Do "./m log quickinstall" to see complete log.
 +
 +83       Successfully uninstalled setuptools-40.8.0
 +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 /var/www/vhosts/moin.tomoyan.net/moin-venv-python3
 +
 +> > > Type "./m" for menu < < <
 +</code>
 +</WRAP>
 +
 +**Windows**\\
 +<WRAP prewrap 100%>
 +<code>
 +> python3 quickinstall.py
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% result>
 +<code>
 +Running quickinstall.py... output messages redirected to m-quickinstall.txt
 +
 +Searching m-quickinstall.txt, important messages are shown below... Do "m log quickinstall" to see complete log.
 +
 +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:\my_projects\moin\.eggs\setuptools_scm-6.0.1-py3.9.egg\setuptools_scm\git.py:88: UserWarning: "C:\My_Projects\moin" is shallow and may cause errors
 +144   warnings.warn(f'"{wd.path}" is shallow and may cause errors')
 +154 Successfully created or updated venv at C:\My_Projects\moin-venv-python
 +Quickinstall run time (h:mm:ss) 0:02:47
 +
 +> > > Type "activate" to activate venv, then "m" for menu < < <
 +</code>
 +</WRAP>
 +^  ディレクトリ  ^^^  説明  ^
 +| + ^ moin || moin2 ソースコード  |
 +|%%|%%| + | quickinstall.py  | Quick Install プログラム  |
 +|%%|%%| + | m.bat  | menu バッチ |
 +| + ^ moin-venv-python || moin2 仮想環境  |
 +|%%|%%| + | Include  |  |
 +|%%|%%| + | Lib  |  |
 +|%%|%%| + | Scripts  |  |
 +
 +menu を実行する。\\
 +**Linux, PowerShell**\\
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ ./m
 +</code>
 +</WRAP>
 +
 +コマンドプロンプト\\
 +<code>
 +> m
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% result>
 +<code powershell>
 +
 +usage: "m <target>" where <target> is:
 +
 +quickinstall    update virtual environment with required packages
 +extras          install packages required for docs and moin development
 +docs            create moin html documentation (requires extras)
 +interwiki       refresh intermap.txt
 +log <target>    view detailed log generated by <target>, omit to see list
 +
 +new-wiki        create empty wiki
 +sample          create wiki and load sample data
 +restore *       create wiki and restore wiki/backup.moin *option, specify file
 +import19 <dir>  import a moin 1.9 wiki/data instance from <dir>
 +
 +run *           run built-in wiki server *options (--port 8081)
 +backup *        roll 3 prior backups and create new backup *option, specify file
 +dump-html *     create a static HTML image of wiki *options, see docs
 +index           delete and rebuild indexes
 +
 +css             run lessc to update basic theme CSS files
 +tests *         run tests, log output (-v -k my_test)
 +coding-std      correct scripts that taint the repository with trailing spaces..
 +
 +del-all         same as running the 4 del-* commands below
 +del-orig        delete all files matching *.orig
 +del-pyc         delete all files matching *.pyc
 +del-rej         delete all files matching *.rej
 +del-wiki        create a backup, then delete all wiki data
 +
 +</code>
 +
 +==== 空の Wiki を作成 ====
 +**Linux, PowerShell**\\
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ ./m new-wiki
 +</code>
 +
 +コマンドプロンプト\\
 +<code>
 +> m new-wiki
 +</code>
 +</WRAP>
 +
 +<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" to see complete log.
 +</code>
 +</WRAP>
 +
 +==== moin2 の実行 ====
 +**Linux**\\
 +<code>
 +$ ./m run
 +</code>
 +**Windows**\\
 +<code>
 +> m run
 +</code>
 +<WRAP prewrap 100% result>
 +<code>
 +2019-08-09 18:54:51,020 INFO moin.log:150 using logging configuration read from built-in fallback in moin.log module!
 +2019-08-09 18:54:51,022 INFO moin.log:155 Running MoinMoin 2.0.0.dev546+g8ad1680d.d20190809 code from c:\my_projects\moin\src\moin
 +2019-08-09 18:54:51,639 INFO moin.utils.clock:45 timer create_app load config(0): 26.98ms
 +2019-08-09 18:54:51,725 INFO moin.utils.clock:45 timer create_app register(0): 85.95ms
 +2019-08-09 18:54:51,738 INFO moin.utils.clock:45 timer create_app flask-cache(0): 12.00ms
 +2019-08-09 18:54:51,770 INFO moin.utils.clock:45 timer create_app init backends(0): 31.98ms
 +2019-08-09 18:54:51,770 INFO moin.utils.clock:45 timer create_app flask-babel(0): 0.00ms
 +2019-08-09 18:54:51,772 INFO moin.utils.clock:45 timer create_app flask-theme(0): 2.00ms
 +2019-08-09 18:54:51,772 INFO moin.utils.clock:45 timer create_app total(0): 160.84ms
 + * Serving Flask app "moin" (lazy loading)
 + * Environment: production
 +   WARNING: This is a development server. Do not use it in a production deployment.
 +   Use a production WSGI server instead.
 + * Debug mode: off
 +2019-08-09 18:54:51,783 INFO werkzeug:122  * Running on http://127.0.0.1:8080/ (Press CTRL+C to quit)
 +</code>
 +</WRAP>
 +[[http://localhost:8080]] にブラウザーでアクセスする。\\
 +{{:python:moinmoin2.png?800|MoinMoin 2}}\\
 +
 +===== ApacheBench してみる =====
 +ローカル簡易実行での ApacheBench の結果。\\
 +**Web Server:** Werkzeug/0.15.6\\
 +**Wiki App:** MoinMoin2\\
 +**Lang:** Python 3.7.4\\
 +**Web Interface:** WSGI\\
 +<WRAP prewrap 100% result>
 +<code>
 +> ab -n 1000 -c 100 http://localhost:8080/Home
 +This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
 +Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
 +Licensed to The Apache Software Foundation, http://www.apache.org/
 +
 +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:        Werkzeug/0.15.6
 +Server Hostname:        localhost
 +Server Port:            8080
 +
 +Document Path:          /Home
 +Document Length:        17256 bytes
 +
 +Concurrency Level:      100
 +Time taken for tests:   350.456 seconds
 +Complete requests:      1000
 +Failed requests:        527
 +   (Connect: 0, Receive: 0, Length: 527, Exceptions: 0)
 +Total transferred:      17410304 bytes
 +HTML transferred:       17125304 bytes
 +Requests per second:    2.85 [#/sec] (mean)
 +Time per request:       35045.644 [ms] (mean)
 +Time per request:       350.456 [ms] (mean, across all concurrent requests)
 +Transfer rate:          48.51 [Kbytes/sec] received
 +
 +Connection Times (ms)
 +              min  mean[+/-sd] median   max
 +Connect:        0    0   0.5      0       1
 +Processing:   357 34234 4558.1  35388   40767
 +Waiting:      300 34203 4557.3  35359   40723
 +Total:        357 34234 4558.1  35389   40767
 +
 +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
 + 100%  40767 (longest request)
 +</code>
 +</WRAP>
 +
 +1 秒間に平均どれくらいのリクエストをさばけるか?\\
 +<code>
 +Requests per second:    2.85 [#/sec] (mean)
 +</code>
 +1リクエストの平均応答時間は?\\
 +<code>
 +Time per request:       350.456 [ms] (mean, across all concurrent requests)
 +</code>
 +
 +**Web Server:** Apache/2.4.25\\
 +**Wiki App:** DokuWiki Release 2018-04-22b "Greebo"\\
 +**Lang:** PHP 7.3.3\\
 +**Web Interface:** FastCGI\\
 +<WRAP prewrap 100% result>
 +<code>
 +abs -n 1000 -c 100 https://wiki.monsters-g.local:1443/start
 +This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
 +Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
 +Licensed to The Apache Software Foundation, http://www.apache.org/
 +
 +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:        Apache/2.4.25
 +Server Hostname:        wiki.monsters-g.local
 +Server Port:            1443
 +SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,2048,256
 +Server Temp Key:        ECDH P-256 256 bits
 +TLS Server Name:        wiki.monsters-g.local
 +
 +Document Path:          /start
 +Document Length:        19763 bytes
 +
 +Concurrency Level:      100
 +Time taken for tests:   62.989 seconds
 +Complete requests:      1000
 +Failed requests:        0
 +Total transferred:      20331000 bytes
 +HTML transferred:       19763000 bytes
 +Requests per second:    15.88 [#/sec] (mean)
 +Time per request:       6298.879 [ms] (mean)
 +Time per request:       62.989 [ms] (mean, across all concurrent requests)
 +Transfer rate:          315.21 [Kbytes/sec] received
 +
 +Connection Times (ms)
 +              min  mean[+/-sd] median   max
 +Connect:        7 1872 602.1   2033    3737
 +Processing:   100 3565 7886.9    620   58699
 +Waiting:       99 3563 7887.1    619   58698
 +Total:        284 5437 7678.7   2713   58830
 +
 +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
 + 100%  58830 (longest request)
 +</code>
 +</WRAP>
 +
 +<code>
 +Requests per second:    15.88 [#/sec] (mean)
 +Time per request:       62.989 [ms] (mean, across all concurrent requests)
 +</code>
 +
 +===== 参考文献 =====
 +[[https://moin-20.readthedocs.io/en/latest/|Introducing MoinMoin — MoinMoin 0.1.dev194+gfdb6906 documentation]]\\
 +
  • python/moinmoin.1565341222.txt.gz
  • 最終更新: 2019/08/09 18:00
  • by ともやん