差分

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

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
python:emmett [2024/06/23 16:36] – [Emmett チュートリアル] ともやんpython:emmett [2024/06/24 08:03] (現在) – [参考文献] ともやん
行 170: 行 170:
 (.venv) <font color="#0087FF"><b>$</b></font> <font color="#26A269">pip</font> install emmett (.venv) <font color="#0087FF"><b>$</b></font> <font color="#26A269">pip</font> install emmett
 </pre></html></WRAP> </pre></html></WRAP>
-<WRAP color_result_long><html><pre>+<WRAP color_result_hlong><html><pre>
 Collecting emmett Collecting emmett
   Downloading emmett-2.5.11-py3-none-any.whl.metadata (4.8 kB)   Downloading emmett-2.5.11-py3-none-any.whl.metadata (4.8 kB)
行 229: 行 229:
 Installing collected packages: pyDAL, uvloop, tzdata, six, renoir, pyyaml, python-rapidjson, emmett-crypto, click, severus, python-dateutil, granian, time-machine, pendulum, emmett Installing collected packages: pyDAL, uvloop, tzdata, six, renoir, pyyaml, python-rapidjson, emmett-crypto, click, severus, python-dateutil, granian, time-machine, pendulum, emmett
 Successfully installed click-8.1.7 emmett-2.5.11 emmett-crypto-0.6.0 granian-1.4.4 pendulum-3.0.0 pyDAL-17.3 python-dateutil-2.9.0.post0 python-rapidjson-1.17 pyyaml-6.0.1 renoir-1.7.1 severus-1.3.0 six-1.16.0 time-machine-2.14.1 tzdata-2024.1 uvloop-0.19.0 Successfully installed click-8.1.7 emmett-2.5.11 emmett-crypto-0.6.0 granian-1.4.4 pendulum-3.0.0 pyDAL-17.3 python-dateutil-2.9.0.post0 python-rapidjson-1.17 pyyaml-6.0.1 renoir-1.7.1 severus-1.3.0 six-1.16.0 time-machine-2.14.1 tzdata-2024.1 uvloop-0.19.0
 +</pre></html></WRAP>
 +</WRAP>
 +
 +===== 技術情報 =====
 +
 +==== Emmett は ASGI ではなく RSGI で動作する...🤔 ====
 +Granian HTTPサーバーはASGI 代替プロトコルRSGI(Rust Server Gateway Interface)を実装してて、Emmett 2.5 で使用されるデフォルトのプロトコル、uvicorn への依存は削除されてる🤔\\
 +コードを変更することなく、Webアプリケーションのパフォーマンスが約 50%  向上してる😍\\
 +[[https://emmett.sh/docs/2.5.x/upgrading|Upgrading to newer releases | Emmett framework]]\\
 +[[https://github.com/emmett-framework/granian/blob/master/docs/spec/RSGI.md|RSGI Specification - granian/docs/spec/RSGI.md at master · emmett-framework/granian]]\\
 +
 +==== データベース URL に指定可能な文字列の例...🤔 ====
 +公式: [[https://pydal.readthedocs.io/en/latest/|Welcome to pyDAL’s API documentation! — pyDAL 17.11 documentation]]\\
 +
 +Emmett は内部で [[http://www.web2py.com/|web2py]] Web フレームワーク 由来の pyDAL を利用するので、そのドキュメントに記載がある😉\\
 +<WRAP color_term>
 +<WRAP color_mincode><code python>
 +'sqlite://test.db'
 +'spatialite://test.db'
 +'sqlite:memory'
 +'spatialite:memory'
 +'jdbc:sqlite://test.db'
 +'mysql://root:none@localhost/test'
 +'postgres://mdipierro:password@localhost/test'
 +'postgres:psycopg2://mdipierro:password@localhost/test'
 +'postgres:pg8000://mdipierro:password@localhost/test'
 +'jdbc:postgres://mdipierro:none@localhost/test'
 +'mssql://web2py:none@A64X2/web2py_test'
 +'mssql2://web2py:none@A64X2/web2py_test' # alternate mappings
 +'mssql3://web2py:none@A64X2/web2py_test' # better pagination (requires >= 2005)
 +'mssql4://web2py:none@A64X2/web2py_test' # best pagination (requires >= 2012)
 +'oracle://username:password@database'
 +'firebird://user:password@server:3050/database'
 +'db2:ibm_db_dbi://DSN=dsn;UID=user;PWD=pass'
 +'db2:pyodbc://driver=DB2;hostname=host;database=database;uid=user;pwd=password;port=port'
 +'firebird://username:password@hostname/database'
 +'firebird_embedded://username:password@c://path'
 +'informix://user:password@server:3050/database'
 +'informixu://user:password@server:3050/database' # unicode informix
 +'ingres://database'  # or use an ODBC connection string, e.g. 'ingres://dsn=dsn_name'
 +'google:datastore' # for google app engine datastore (uses ndb by default)
 +'google:sql' # for google app engine with sql (mysql compatible)
 +'teradata://DSN=dsn;UID=user;PWD=pass; DATABASE=database' # experimental
 +'imap://user:password@server:port' # experimental
 +'mongodb://user:password@server:port/database' # experimental
 +</code></WRAP>
 +</WRAP>
 +
 +===== トラブルシューティング =====
 +
 +==== RuntimeError: No driver of supported ones ('psycopg2', 'pg8000') is available ====
 +PostgreSQL に接続する際に以下の内容のようなエラーが発生する...😱\\
 +<WRAP color_term>
 +<WRAP color_result><html><pre>
 +  File &quot;/home/tomoyan/my_projects/emmett_proj/.venv/lib64/python3.12/site-packages/pydal/adapters/base.py&quot;, line 367, in __init__
 +    super(SQLAdapter, self).__init__(*args, **kwargs)
 +  File &quot;/home/tomoyan/my_projects/emmett_proj/.venv/lib64/python3.12/site-packages/pydal/adapters/base.py&quot;, line 49, in __init__
 +    self.find_driver()
 +  File &quot;/home/tomoyan/my_projects/emmett_proj/.venv/lib64/python3.12/site-packages/pydal/adapters/base.py&quot;, line 98, in find_driver
 +    raise RuntimeError(
 +RuntimeError: No driver of supported ones (&apos;psycopg2&apos;, &apos;pg8000&apos;) is available
 +</pre></html></WRAP>
 +</WRAP>
 +
 +PostgreSQL ドライバをインストールする必要がある🤔\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +(.venv) <font color="#0087FF"><b>$</b></font> <font color="#26A269">pip</font> install psycopg2
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +Collecting psycopg2
 +  Downloading psycopg2-2.9.9.tar.gz (384 kB)
 +     <font color="#729C1F">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</font> <font color="#26A269">384.9/384.9 kB</font> <font color="#C01C28">27.4 kB/s</font> eta <font color="#2AA1B3">0:00:00</font>
 +  Installing build dependencies ... done
 +  Getting requirements to build wheel ... done
 +  Preparing metadata (pyproject.toml) ... done
 +Building wheels for collected packages: psycopg2
 +  Building wheel for psycopg2 (pyproject.toml) ... done
 +  Created wheel for psycopg2: filename=psycopg2-2.9.9-cp312-cp312-linux_x86_64.whl size=170256 sha256=2e90e7bb4e1ff74e850d424bfbc9bf7c017ffbb1c37b42d79b550d13f29af782
 +  Stored in directory: /home/tomoyan/.cache/pip/wheels/ff/ac/80/7ccec163e3d05ae2112311b895132409b9abfd7e0c1c6b5183
 +Successfully built psycopg2
 +Installing collected packages: psycopg2
 +Successfully installed psycopg2-2.9.9
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 235: 行 318:
 [[https://towardsdatascience.com/elegant-web-development-with-emmett-in-python-612ed898a71e|Elegant Web Development With Emmett In Python | by Emma Boudreau | Towards Data Science]]\\ [[https://towardsdatascience.com/elegant-web-development-with-emmett-in-python-612ed898a71e|Elegant Web Development With Emmett In Python | by Emma Boudreau | Towards Data Science]]\\
 [[https://medium.com/@pangea.ai/the-ultimate-guide-to-python-development-frameworks-2021-d5f3daad75c6|The Ultimate Guide to Python Development Frameworks 2021 | by Pangea.ai | Medium]]\\ [[https://medium.com/@pangea.ai/the-ultimate-guide-to-python-development-frameworks-2021-d5f3daad75c6|The Ultimate Guide to Python Development Frameworks 2021 | by Pangea.ai | Medium]]\\
 +[[https://medium.com/@carlosmarcano2704/seven-alternatives-to-fastapi-to-explore-and-contribute-python-47bcd394bf31|Seven Alternatives To FastAPI To Explore and Contribute To | Python | by Carlos Armando Marcano Vargas | Medium]]\\
  
 ==== 付録 ==== ==== 付録 ====
 [[tw>tomoyan596sp/status/1804386410151223725|誰のホームページを作ってるんでしょうね...🤔 Dr. Emmett Brown 博士😅 ドッグが由来らしいPythonのEmmettフレームワーク🤔 真の非同期 Web アプリケーション フレームワークだから...😊 ASGIサーバーはRustで実装されてるGranian、weppyをforkしたEmmettは、Flaskに似てるがDjangoくらい高機能です😋]]\\ [[tw>tomoyan596sp/status/1804386410151223725|誰のホームページを作ってるんでしょうね...🤔 Dr. Emmett Brown 博士😅 ドッグが由来らしいPythonのEmmettフレームワーク🤔 真の非同期 Web アプリケーション フレームワークだから...😊 ASGIサーバーはRustで実装されてるGranian、weppyをforkしたEmmettは、Flaskに似てるがDjangoくらい高機能です😋]]\\
  
  • python/emmett.1719128184.txt.gz
  • 最終更新: 2024/06/23 16:36
  • by ともやん