Nexom 0.1.4__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. {nexom-0.1.4/src/Nexom.egg-info → nexom-1.0.2}/PKG-INFO +76 -50
  2. nexom-1.0.2/README.md +157 -0
  3. {nexom-0.1.4 → nexom-1.0.2}/pyproject.toml +7 -4
  4. {nexom-0.1.4 → nexom-1.0.2/src/Nexom.egg-info}/PKG-INFO +76 -50
  5. nexom-1.0.2/src/Nexom.egg-info/SOURCES.txt +66 -0
  6. nexom-1.0.2/src/Nexom.egg-info/requires.txt +3 -0
  7. {nexom-0.1.4 → nexom-1.0.2}/src/nexom/__init__.py +2 -2
  8. nexom-1.0.2/src/nexom/__main__.py +155 -0
  9. nexom-1.0.2/src/nexom/app/__init__.py +62 -0
  10. nexom-1.0.2/src/nexom/app/auth.py +322 -0
  11. {nexom-0.1.4/src/nexom/web → nexom-1.0.2/src/nexom/app}/cookie.py +4 -2
  12. nexom-1.0.2/src/nexom/app/db.py +88 -0
  13. nexom-1.0.2/src/nexom/app/path.py +195 -0
  14. nexom-1.0.2/src/nexom/app/request.py +267 -0
  15. {nexom-0.1.4/src/nexom/web → nexom-1.0.2/src/nexom/app}/response.py +13 -3
  16. {nexom-0.1.4/src/nexom/web → nexom-1.0.2/src/nexom/app}/template.py +1 -1
  17. nexom-1.0.2/src/nexom/app/user.py +31 -0
  18. nexom-1.0.2/src/nexom/assets/app/__pycache__/__init__.cpython-313.pyc +0 -0
  19. nexom-1.0.2/src/nexom/assets/app/config.py +28 -0
  20. nexom-1.0.2/src/nexom/assets/app/gunicorn.conf.py +5 -0
  21. nexom-1.0.2/src/nexom/assets/app/pages/__pycache__/__init__.cpython-313.pyc +0 -0
  22. nexom-1.0.2/src/nexom/assets/app/pages/_templates.py +7 -0
  23. {nexom-0.1.4/src/nexom/assets/server → nexom-1.0.2/src/nexom/assets/app}/pages/default.py +2 -2
  24. {nexom-0.1.4/src/nexom/assets/server → nexom-1.0.2/src/nexom/assets/app}/pages/document.py +2 -2
  25. nexom-1.0.2/src/nexom/assets/app/router.py +12 -0
  26. nexom-1.0.2/src/nexom/assets/app/wsgi.py +64 -0
  27. nexom-1.0.2/src/nexom/assets/auth/__init__.py +0 -0
  28. nexom-1.0.2/src/nexom/assets/auth/__pycache__/__init__.cpython-313.pyc +0 -0
  29. nexom-1.0.2/src/nexom/assets/auth/config.py +27 -0
  30. nexom-1.0.2/src/nexom/assets/auth/gunicorn.conf.py +5 -0
  31. nexom-1.0.2/src/nexom/assets/auth/wsgi.py +62 -0
  32. nexom-1.0.2/src/nexom/assets/auth_page/login.html +95 -0
  33. nexom-1.0.2/src/nexom/assets/auth_page/signup.html +106 -0
  34. {nexom-0.1.4 → nexom-1.0.2}/src/nexom/assets/error_page/error.html +3 -3
  35. nexom-1.0.2/src/nexom/assets/gateway/apache_app.conf +16 -0
  36. nexom-1.0.2/src/nexom/assets/gateway/nginx_app.conf +21 -0
  37. nexom-1.0.2/src/nexom/buildTools/__init__.py +1 -0
  38. nexom-1.0.2/src/nexom/buildTools/build.py +319 -0
  39. nexom-1.0.2/src/nexom/buildTools/run.py +185 -0
  40. nexom-1.0.2/src/nexom/core/__init__.py +2 -0
  41. {nexom-0.1.4 → nexom-1.0.2}/src/nexom/core/error.py +81 -3
  42. nexom-1.0.2/src/nexom/core/log.py +111 -0
  43. {nexom-0.1.4/src/nexom/engine → nexom-1.0.2/src/nexom/core}/object_html_render.py +4 -1
  44. nexom-1.0.2/src/nexom/templates/__init__.py +0 -0
  45. nexom-1.0.2/src/nexom/templates/auth.py +72 -0
  46. nexom-0.1.4/README.md +0 -132
  47. nexom-0.1.4/src/Nexom.egg-info/SOURCES.txt +0 -48
  48. nexom-0.1.4/src/nexom/__main__.py +0 -61
  49. nexom-0.1.4/src/nexom/assets/server/config.py +0 -27
  50. nexom-0.1.4/src/nexom/assets/server/gunicorn.conf.py +0 -16
  51. nexom-0.1.4/src/nexom/assets/server/pages/__pycache__/__init__.cpython-313.pyc +0 -0
  52. nexom-0.1.4/src/nexom/assets/server/pages/_templates.py +0 -11
  53. nexom-0.1.4/src/nexom/assets/server/router.py +0 -18
  54. nexom-0.1.4/src/nexom/assets/server/wsgi.py +0 -30
  55. nexom-0.1.4/src/nexom/buildTools/build.py +0 -99
  56. nexom-0.1.4/src/nexom/core/__init__.py +0 -1
  57. nexom-0.1.4/src/nexom/engine/__init__.py +0 -1
  58. nexom-0.1.4/src/nexom/web/__init__.py +0 -5
  59. nexom-0.1.4/src/nexom/web/path.py +0 -125
  60. nexom-0.1.4/src/nexom/web/request.py +0 -62
  61. {nexom-0.1.4 → nexom-1.0.2}/LICENSE +0 -0
  62. {nexom-0.1.4 → nexom-1.0.2}/setup.cfg +0 -0
  63. {nexom-0.1.4 → nexom-1.0.2}/src/Nexom.egg-info/dependency_links.txt +0 -0
  64. {nexom-0.1.4 → nexom-1.0.2}/src/Nexom.egg-info/entry_points.txt +0 -0
  65. {nexom-0.1.4 → nexom-1.0.2}/src/Nexom.egg-info/top_level.txt +0 -0
  66. {nexom-0.1.4/src/nexom/web → nexom-1.0.2/src/nexom/app}/http_status_codes.py +0 -0
  67. {nexom-0.1.4/src/nexom/web → nexom-1.0.2/src/nexom/app}/middleware.py +0 -0
  68. {nexom-0.1.4/src/nexom/buildTools → nexom-1.0.2/src/nexom/assets/app}/__init__.py +0 -0
  69. {nexom-0.1.4/src/nexom/assets/server → nexom-1.0.2/src/nexom/assets/app}/pages/__init__.py +0 -0
  70. {nexom-0.1.4/src/nexom/assets/server → nexom-1.0.2/src/nexom/assets/app}/static/dog.jpeg +0 -0
  71. {nexom-0.1.4/src/nexom/assets/server → nexom-1.0.2/src/nexom/assets/app}/static/style.css +0 -0
  72. {nexom-0.1.4/src/nexom/assets/server → nexom-1.0.2/src/nexom/assets/app}/templates/base.html +0 -0
  73. {nexom-0.1.4/src/nexom/assets/server → nexom-1.0.2/src/nexom/assets/app}/templates/default.html +0 -0
  74. {nexom-0.1.4/src/nexom/assets/server → nexom-1.0.2/src/nexom/assets/app}/templates/document.html +0 -0
  75. {nexom-0.1.4/src/nexom/assets/server → nexom-1.0.2/src/nexom/assets/app}/templates/footer.html +0 -0
  76. {nexom-0.1.4/src/nexom/assets/server → nexom-1.0.2/src/nexom/assets/app}/templates/header.html +0 -0
  77. {nexom-0.1.4 → nexom-1.0.2}/tests/test_buildtools.py +0 -0
  78. {nexom-0.1.4 → nexom-1.0.2}/tests/test_http_status_codes.py +0 -0
  79. {nexom-0.1.4 → nexom-1.0.2}/tests/test_middleware.py +0 -0
  80. {nexom-0.1.4 → nexom-1.0.2}/tests/test_path_routing.py +0 -0
  81. {nexom-0.1.4 → nexom-1.0.2}/tests/test_request.py +0 -0
  82. {nexom-0.1.4 → nexom-1.0.2}/tests/test_response.py +0 -0
  83. {nexom-0.1.4 → nexom-1.0.2}/tests/test_static.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Nexom
3
- Version: 0.1.4
3
+ Version: 1.0.2
4
4
  Summary: Lightweight Python Web Framework (WSGI)
5
5
  Author: TouriAida
6
6
  License: MIT License
@@ -32,6 +32,7 @@ Keywords: wsgi,web,framework
32
32
  Requires-Python: >=3.10
33
33
  Description-Content-Type: text/markdown
34
34
  License-File: LICENSE
35
+ Requires-Dist: typing-extensions; python_version < "3.12"
35
36
  Dynamic: license-file
36
37
 
37
38
 
@@ -44,64 +45,96 @@ Nexomは短いコードで最低限動作し、シンプルで理解のしやす
44
45
  ## はじめる
45
46
  最初のサーバーを起動するには、3つの手順が必要です。
46
47
 
47
- 1. ディレクトリを作成
48
- 2. nexomをpipでインストール、サーバーのビルド
48
+ 1. プロジェクトディレクトリを作成
49
+ 2. nexomをpipでインストール、プロジェクトのビルド
49
50
  3. 起動
50
51
 
51
- ### 1.ディレクトリの作成
52
+ ### 1.プロジェクトディレクトリの作成
52
53
  **準備**
53
- 用意していない場合はディレクトリを作成し、仮想環境も準備てください
54
+
55
+ 用意していない場合はディレクトリを作成し、仮想環境も準備してください
54
56
  ```
55
- mkdir sample
56
- cd sample
57
+ mkdir banana_project
58
+ cd banana_project
57
59
 
58
60
  python -m venv venv
59
61
  source venv/bin/activate
60
62
  ```
61
- ### 2.npipでインストール、サーバーのビルド
63
+ ### 2. pipでインストール、サーバーのビルド
62
64
  **インストール**
65
+
63
66
  nexomをインストールします。
64
- ※まだベータ版のため、最新のバージョンを確認してください。
65
67
  ```
66
- pip install nexom==0.1.4
68
+ pip install
67
69
  ```
68
- **テンプレートサーバーのビルド**
69
- サーバーを置きたいディレクトリ上で、以下のコマンドを実行してください(sampleは自由)
70
+ **プロジェクトのビルド**
71
+
72
+ プロジェクトディレクトリ上で、以下のコマンドを実行してください(名前は自由)
73
+ もしNginxもしくはApacheを使用する場合 --gateway オプションにどちらか入力してください
74
+
75
+ ```
76
+ $ python -m nexom start-project
77
+ ```
78
+
79
+ 以下の構成でプロジェクトが生成されます。
80
+
70
81
  ```
71
- python -m nexom build-server sample
82
+ banana_project/
83
+ ├─ app/
84
+ │ ├─ pages/
85
+ │ │ ├─ __init__.py
86
+ │ │ ├─ _templates.py
87
+ │ │ └─ * pages *
88
+ │ ├─ static/
89
+ │ │ └─ * static items *
90
+ │ ├─ templates/
91
+ │ │ └─ * html files *
92
+ │ ├─ __init__.py
93
+ │ ├─ config.py
94
+ │ ├─ gunicorn.conf.py
95
+ │ ├─ router.py
96
+ │ └─ wsgi.py
97
+ ├─ auth/
98
+ │ ├─ __init__.py
99
+ │ ├─ config.py
100
+ │ ├─ gunicorn.conf.py
101
+ │ └─ wsgi.py
102
+ └─ data/
103
+ ├─ log/
104
+ │ └─ * app logs *
105
+ ├─ db/
106
+ │ └─ * app db *
107
+ └─ gateway/
108
+ ├─ app.nginx.conf
109
+ └─ app.apache.conf
72
110
  ```
73
111
 
74
112
  ### 3.起動
75
113
  以下のコマンドを起動します。
76
114
  ```
77
- gunicorn wsgi:app
115
+ $ python -m nexom run
78
116
  ```
79
117
  ブラウザからアクセスできるようになります。
80
118
  デフォルトのポートは8080です。
81
- [httpls://localhost:8080](httpls://localhost:8080)
119
+
120
+ [https://localhost:8080](https://localhost:8080)
121
+
82
122
  ポートなどの設定は `config.py` から変更してください。
83
123
 
84
124
  ## Nginx等使用して外部公開する
85
- `config.py` で指定したポートにプロキシしてください。
125
+ gatewayディレクトリにある設定を読み込んでください
86
126
  ```
87
- server {
88
- listen 443 ssl;
89
- server_name nexom.ceez7.com;
90
-
91
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92
-
93
- location / {
94
- proxy_pass http://localhost:8080;
95
- }
127
+ http {
128
+ include /home/ubuntu/banana_project/gateway/*.conf;
96
129
  }
97
130
  ```
98
131
 
99
132
  ## Systemdに登録して自動起動する
100
133
  **Ubuntuの場合**
101
- 1. `/etc/systemd/system` に、 `your_server_name.service` を作成します。
102
- 2. `your_server_name.service` に以下を書き込みます。(これは一例です。環境に合わせて設定してください。)
134
+ 1. `/etc/systemd/system` に、 `banana_sample.service` を作成します。
135
+ 2. `banana_sample.service` に以下を書き込みます。(これは一例です。環境に合わせて設定してください。)
103
136
 
104
- サーバーのディレクトリが `/home/ubuntu/nexom` にある場合
137
+ サーバーのディレクトリが `/home/ubuntu/banana_project` にある場合
105
138
  ```
106
139
  [Unit]
107
140
  Description=Nexom Web Freamework
@@ -110,9 +143,11 @@ After=network.target
110
143
  [Service]
111
144
  User=www-data
112
145
  Group=www-data
113
- WorkingDirectory=/home/ubuntu/nexom
114
- Environment="/home/ubuntu/nexom/venv/bin"
115
- ExecStart=/home/ubuntu/nexom/venv/bin/gunicorn wsgi:app
146
+ WorkingDirectory=/home/ubuntu/banana_project
147
+ Environment="PYTHONPATH=/home/ubuntu/banana_project"
148
+ ExecStart=/home/ubuntu/banana_project/venv/bin/gunicorn sample.wsgi:app --config sample/gunicorn.conf.py
149
+ Restart=always
150
+ RestartSec=3
116
151
  [Install]
117
152
  WantedBy=multi-user.target
118
153
  ```
@@ -120,23 +155,12 @@ WantedBy=multi-user.target
120
155
  以下のコマンドを実行します
121
156
  ```
122
157
  sudo systemd daemon-reload
123
- sudo systemd enable your_server_name
124
- sudo systemd start your_server_name
158
+ sudo systemd enable banana_sample
159
+ sudo systemd start banana_sample
125
160
  ```
126
161
 
127
- ### テンプレートユニットを活用して複数のサーバーを効率的に管理
128
- 以下の構成でサーバーが建てられていたとします。
129
- ```
130
- /home/ubuntu/BananaProject/
131
- └─ web/
132
- ├─ banana1 (Nexomサーバー)/
133
- │ └─ wsgi.py
134
- ├─ banana2 (Nexomサーバー)/
135
- │ └─ wsgi.py
136
- └─ banana3 (Nexomサーバー)/
137
- └─ wsgi.py
138
- ```
139
- この構成の場合、テンプレートユニットを活用し .service ファイルを一枚にまとめられます。
162
+ ### テンプレートユニットを活用して複数のアプリを効率的に管理
163
+ テンプレートユニットを活用し .service ファイルを一枚にまとめられます。
140
164
 
141
165
  `/etc/systemd/system/banana-project@.service`
142
166
  ```
@@ -147,9 +171,11 @@ After=network.target
147
171
  [Service]
148
172
  User=www-data
149
173
  Group=www-data
150
- WorkingDirectory=/home/ubuntu/BananaProject/web/%i
151
- Environment="/home/ubuntu/BananaProject/web/%i/venv/bin"
152
- ExecStart=/home/ubuntu/BananaProject/web/%i/venv/bin/gunicorn wsgi:app
174
+ WorkingDirectory=/home/ubuntu/banana_project
175
+ Environment="PYTHONPATH=/home/ubuntu/banana_project"
176
+ ExecStart=/home/ubuntu/banana_project/venv/bin/gunicorn %iwsgi:app --config %i/gunicorn.conf.py
177
+ Restart=always
178
+ RestartSec=3
153
179
  [Install]
154
180
  WantedBy=multi-user.target
155
181
  ```
@@ -165,4 +191,4 @@ sudo systemd start banana-project@banana2
165
191
  sudo systemd start banana-project@banana3
166
192
  ```
167
193
 
168
- 2026 1/24
194
+ 2026 1/25
nexom-1.0.2/README.md ADDED
@@ -0,0 +1,157 @@
1
+
2
+ # Nexom
3
+ Lightweight Python Web Framework (WSGI)
4
+
5
+ Nexomは短いコードで最低限動作し、シンプルで理解のしやすい設計・構造を目指しています。
6
+ また細かい仕様も変更でき、多様な処理に対応します。
7
+
8
+ ## はじめる
9
+ 最初のサーバーを起動するには、3つの手順が必要です。
10
+
11
+ 1. プロジェクトディレクトリを作成
12
+ 2. nexomをpipでインストール、プロジェクトのビルド
13
+ 3. 起動
14
+
15
+ ### 1.プロジェクトディレクトリの作成
16
+ **準備**
17
+
18
+ 用意していない場合はディレクトリを作成し、仮想環境も準備してください
19
+ ```
20
+ mkdir banana_project
21
+ cd banana_project
22
+
23
+ python -m venv venv
24
+ source venv/bin/activate
25
+ ```
26
+ ### 2. pipでインストール、サーバーのビルド
27
+ **インストール**
28
+
29
+ nexomをインストールします。
30
+ ```
31
+ pip install
32
+ ```
33
+ **プロジェクトのビルド**
34
+
35
+ プロジェクトディレクトリ上で、以下のコマンドを実行してください(名前は自由)
36
+ もしNginxもしくはApacheを使用する場合 --gateway オプションにどちらか入力してください
37
+
38
+ ```
39
+ $ python -m nexom start-project
40
+ ```
41
+
42
+ 以下の構成でプロジェクトが生成されます。
43
+
44
+ ```
45
+ banana_project/
46
+ ├─ app/
47
+ │ ├─ pages/
48
+ │ │ ├─ __init__.py
49
+ │ │ ├─ _templates.py
50
+ │ │ └─ * pages *
51
+ │ ├─ static/
52
+ │ │ └─ * static items *
53
+ │ ├─ templates/
54
+ │ │ └─ * html files *
55
+ │ ├─ __init__.py
56
+ │ ├─ config.py
57
+ │ ├─ gunicorn.conf.py
58
+ │ ├─ router.py
59
+ │ └─ wsgi.py
60
+ ├─ auth/
61
+ │ ├─ __init__.py
62
+ │ ├─ config.py
63
+ │ ├─ gunicorn.conf.py
64
+ │ └─ wsgi.py
65
+ └─ data/
66
+ ├─ log/
67
+ │ └─ * app logs *
68
+ ├─ db/
69
+ │ └─ * app db *
70
+ └─ gateway/
71
+ ├─ app.nginx.conf
72
+ └─ app.apache.conf
73
+ ```
74
+
75
+ ### 3.起動
76
+ 以下のコマンドを起動します。
77
+ ```
78
+ $ python -m nexom run
79
+ ```
80
+ ブラウザからアクセスできるようになります。
81
+ デフォルトのポートは8080です。
82
+
83
+ [https://localhost:8080](https://localhost:8080)
84
+
85
+ ポートなどの設定は `config.py` から変更してください。
86
+
87
+ ## Nginx等使用して外部公開する
88
+ gatewayディレクトリにある設定を読み込んでください
89
+ ```
90
+ http {
91
+ include /home/ubuntu/banana_project/gateway/*.conf;
92
+ }
93
+ ```
94
+
95
+ ## Systemdに登録して自動起動する
96
+ **Ubuntuの場合**
97
+ 1. `/etc/systemd/system` に、 `banana_sample.service` を作成します。
98
+ 2. `banana_sample.service` に以下を書き込みます。(これは一例です。環境に合わせて設定してください。)
99
+
100
+ サーバーのディレクトリが `/home/ubuntu/banana_project` にある場合
101
+ ```
102
+ [Unit]
103
+ Description=Nexom Web Freamework
104
+ After=network.target
105
+
106
+ [Service]
107
+ User=www-data
108
+ Group=www-data
109
+ WorkingDirectory=/home/ubuntu/banana_project
110
+ Environment="PYTHONPATH=/home/ubuntu/banana_project"
111
+ ExecStart=/home/ubuntu/banana_project/venv/bin/gunicorn sample.wsgi:app --config sample/gunicorn.conf.py
112
+ Restart=always
113
+ RestartSec=3
114
+ [Install]
115
+ WantedBy=multi-user.target
116
+ ```
117
+
118
+ 以下のコマンドを実行します
119
+ ```
120
+ sudo systemd daemon-reload
121
+ sudo systemd enable banana_sample
122
+ sudo systemd start banana_sample
123
+ ```
124
+
125
+ ### テンプレートユニットを活用して複数のアプリを効率的に管理
126
+ テンプレートユニットを活用し .service ファイルを一枚にまとめられます。
127
+
128
+ `/etc/systemd/system/banana-project@.service`
129
+ ```
130
+ [Unit]
131
+ Description=Nexom Web Server (%i)
132
+ After=network.target
133
+
134
+ [Service]
135
+ User=www-data
136
+ Group=www-data
137
+ WorkingDirectory=/home/ubuntu/banana_project
138
+ Environment="PYTHONPATH=/home/ubuntu/banana_project"
139
+ ExecStart=/home/ubuntu/banana_project/venv/bin/gunicorn %iwsgi:app --config %i/gunicorn.conf.py
140
+ Restart=always
141
+ RestartSec=3
142
+ [Install]
143
+ WantedBy=multi-user.target
144
+ ```
145
+ ```
146
+ sudo systemd daemon-reload
147
+
148
+ sudo systemd enable banana-project@banana1
149
+ sudo systemd enable banana-project@banana2
150
+ sudo systemd enable banana-project@banana3
151
+
152
+ sudo systemd start banana-project@banana1
153
+ sudo systemd start banana-project@banana2
154
+ sudo systemd start banana-project@banana3
155
+ ```
156
+
157
+ 2026 1/25
@@ -4,16 +4,19 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "Nexom"
7
- version = "0.1.4"
7
+ version = "1.0.2"
8
8
  description = "Lightweight Python Web Framework (WSGI)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
11
11
  license = { file = "LICENSE" }
12
- authors = [
13
- { name = "TouriAida" }
14
- ]
12
+ authors = [{ name = "TouriAida" }]
15
13
  keywords = ["wsgi", "web", "framework"]
16
14
 
15
+ # ★ 追加
16
+ dependencies = [
17
+ "typing-extensions; python_version < '3.12'",
18
+ ]
19
+
17
20
  [project.urls]
18
21
  Homepage = "https://nexom.ceez7.com"
19
22
  Repository = "https://github.com/ait913/Nexom"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Nexom
3
- Version: 0.1.4
3
+ Version: 1.0.2
4
4
  Summary: Lightweight Python Web Framework (WSGI)
5
5
  Author: TouriAida
6
6
  License: MIT License
@@ -32,6 +32,7 @@ Keywords: wsgi,web,framework
32
32
  Requires-Python: >=3.10
33
33
  Description-Content-Type: text/markdown
34
34
  License-File: LICENSE
35
+ Requires-Dist: typing-extensions; python_version < "3.12"
35
36
  Dynamic: license-file
36
37
 
37
38
 
@@ -44,64 +45,96 @@ Nexomは短いコードで最低限動作し、シンプルで理解のしやす
44
45
  ## はじめる
45
46
  最初のサーバーを起動するには、3つの手順が必要です。
46
47
 
47
- 1. ディレクトリを作成
48
- 2. nexomをpipでインストール、サーバーのビルド
48
+ 1. プロジェクトディレクトリを作成
49
+ 2. nexomをpipでインストール、プロジェクトのビルド
49
50
  3. 起動
50
51
 
51
- ### 1.ディレクトリの作成
52
+ ### 1.プロジェクトディレクトリの作成
52
53
  **準備**
53
- 用意していない場合はディレクトリを作成し、仮想環境も準備てください
54
+
55
+ 用意していない場合はディレクトリを作成し、仮想環境も準備してください
54
56
  ```
55
- mkdir sample
56
- cd sample
57
+ mkdir banana_project
58
+ cd banana_project
57
59
 
58
60
  python -m venv venv
59
61
  source venv/bin/activate
60
62
  ```
61
- ### 2.npipでインストール、サーバーのビルド
63
+ ### 2. pipでインストール、サーバーのビルド
62
64
  **インストール**
65
+
63
66
  nexomをインストールします。
64
- ※まだベータ版のため、最新のバージョンを確認してください。
65
67
  ```
66
- pip install nexom==0.1.4
68
+ pip install
67
69
  ```
68
- **テンプレートサーバーのビルド**
69
- サーバーを置きたいディレクトリ上で、以下のコマンドを実行してください(sampleは自由)
70
+ **プロジェクトのビルド**
71
+
72
+ プロジェクトディレクトリ上で、以下のコマンドを実行してください(名前は自由)
73
+ もしNginxもしくはApacheを使用する場合 --gateway オプションにどちらか入力してください
74
+
75
+ ```
76
+ $ python -m nexom start-project
77
+ ```
78
+
79
+ 以下の構成でプロジェクトが生成されます。
80
+
70
81
  ```
71
- python -m nexom build-server sample
82
+ banana_project/
83
+ ├─ app/
84
+ │ ├─ pages/
85
+ │ │ ├─ __init__.py
86
+ │ │ ├─ _templates.py
87
+ │ │ └─ * pages *
88
+ │ ├─ static/
89
+ │ │ └─ * static items *
90
+ │ ├─ templates/
91
+ │ │ └─ * html files *
92
+ │ ├─ __init__.py
93
+ │ ├─ config.py
94
+ │ ├─ gunicorn.conf.py
95
+ │ ├─ router.py
96
+ │ └─ wsgi.py
97
+ ├─ auth/
98
+ │ ├─ __init__.py
99
+ │ ├─ config.py
100
+ │ ├─ gunicorn.conf.py
101
+ │ └─ wsgi.py
102
+ └─ data/
103
+ ├─ log/
104
+ │ └─ * app logs *
105
+ ├─ db/
106
+ │ └─ * app db *
107
+ └─ gateway/
108
+ ├─ app.nginx.conf
109
+ └─ app.apache.conf
72
110
  ```
73
111
 
74
112
  ### 3.起動
75
113
  以下のコマンドを起動します。
76
114
  ```
77
- gunicorn wsgi:app
115
+ $ python -m nexom run
78
116
  ```
79
117
  ブラウザからアクセスできるようになります。
80
118
  デフォルトのポートは8080です。
81
- [httpls://localhost:8080](httpls://localhost:8080)
119
+
120
+ [https://localhost:8080](https://localhost:8080)
121
+
82
122
  ポートなどの設定は `config.py` から変更してください。
83
123
 
84
124
  ## Nginx等使用して外部公開する
85
- `config.py` で指定したポートにプロキシしてください。
125
+ gatewayディレクトリにある設定を読み込んでください
86
126
  ```
87
- server {
88
- listen 443 ssl;
89
- server_name nexom.ceez7.com;
90
-
91
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92
-
93
- location / {
94
- proxy_pass http://localhost:8080;
95
- }
127
+ http {
128
+ include /home/ubuntu/banana_project/gateway/*.conf;
96
129
  }
97
130
  ```
98
131
 
99
132
  ## Systemdに登録して自動起動する
100
133
  **Ubuntuの場合**
101
- 1. `/etc/systemd/system` に、 `your_server_name.service` を作成します。
102
- 2. `your_server_name.service` に以下を書き込みます。(これは一例です。環境に合わせて設定してください。)
134
+ 1. `/etc/systemd/system` に、 `banana_sample.service` を作成します。
135
+ 2. `banana_sample.service` に以下を書き込みます。(これは一例です。環境に合わせて設定してください。)
103
136
 
104
- サーバーのディレクトリが `/home/ubuntu/nexom` にある場合
137
+ サーバーのディレクトリが `/home/ubuntu/banana_project` にある場合
105
138
  ```
106
139
  [Unit]
107
140
  Description=Nexom Web Freamework
@@ -110,9 +143,11 @@ After=network.target
110
143
  [Service]
111
144
  User=www-data
112
145
  Group=www-data
113
- WorkingDirectory=/home/ubuntu/nexom
114
- Environment="/home/ubuntu/nexom/venv/bin"
115
- ExecStart=/home/ubuntu/nexom/venv/bin/gunicorn wsgi:app
146
+ WorkingDirectory=/home/ubuntu/banana_project
147
+ Environment="PYTHONPATH=/home/ubuntu/banana_project"
148
+ ExecStart=/home/ubuntu/banana_project/venv/bin/gunicorn sample.wsgi:app --config sample/gunicorn.conf.py
149
+ Restart=always
150
+ RestartSec=3
116
151
  [Install]
117
152
  WantedBy=multi-user.target
118
153
  ```
@@ -120,23 +155,12 @@ WantedBy=multi-user.target
120
155
  以下のコマンドを実行します
121
156
  ```
122
157
  sudo systemd daemon-reload
123
- sudo systemd enable your_server_name
124
- sudo systemd start your_server_name
158
+ sudo systemd enable banana_sample
159
+ sudo systemd start banana_sample
125
160
  ```
126
161
 
127
- ### テンプレートユニットを活用して複数のサーバーを効率的に管理
128
- 以下の構成でサーバーが建てられていたとします。
129
- ```
130
- /home/ubuntu/BananaProject/
131
- └─ web/
132
- ├─ banana1 (Nexomサーバー)/
133
- │ └─ wsgi.py
134
- ├─ banana2 (Nexomサーバー)/
135
- │ └─ wsgi.py
136
- └─ banana3 (Nexomサーバー)/
137
- └─ wsgi.py
138
- ```
139
- この構成の場合、テンプレートユニットを活用し .service ファイルを一枚にまとめられます。
162
+ ### テンプレートユニットを活用して複数のアプリを効率的に管理
163
+ テンプレートユニットを活用し .service ファイルを一枚にまとめられます。
140
164
 
141
165
  `/etc/systemd/system/banana-project@.service`
142
166
  ```
@@ -147,9 +171,11 @@ After=network.target
147
171
  [Service]
148
172
  User=www-data
149
173
  Group=www-data
150
- WorkingDirectory=/home/ubuntu/BananaProject/web/%i
151
- Environment="/home/ubuntu/BananaProject/web/%i/venv/bin"
152
- ExecStart=/home/ubuntu/BananaProject/web/%i/venv/bin/gunicorn wsgi:app
174
+ WorkingDirectory=/home/ubuntu/banana_project
175
+ Environment="PYTHONPATH=/home/ubuntu/banana_project"
176
+ ExecStart=/home/ubuntu/banana_project/venv/bin/gunicorn %iwsgi:app --config %i/gunicorn.conf.py
177
+ Restart=always
178
+ RestartSec=3
153
179
  [Install]
154
180
  WantedBy=multi-user.target
155
181
  ```
@@ -165,4 +191,4 @@ sudo systemd start banana-project@banana2
165
191
  sudo systemd start banana-project@banana3
166
192
  ```
167
193
 
168
- 2026 1/24
194
+ 2026 1/25
@@ -0,0 +1,66 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/Nexom.egg-info/PKG-INFO
5
+ src/Nexom.egg-info/SOURCES.txt
6
+ src/Nexom.egg-info/dependency_links.txt
7
+ src/Nexom.egg-info/entry_points.txt
8
+ src/Nexom.egg-info/requires.txt
9
+ src/Nexom.egg-info/top_level.txt
10
+ src/nexom/__init__.py
11
+ src/nexom/__main__.py
12
+ src/nexom/app/__init__.py
13
+ src/nexom/app/auth.py
14
+ src/nexom/app/cookie.py
15
+ src/nexom/app/db.py
16
+ src/nexom/app/http_status_codes.py
17
+ src/nexom/app/middleware.py
18
+ src/nexom/app/path.py
19
+ src/nexom/app/request.py
20
+ src/nexom/app/response.py
21
+ src/nexom/app/template.py
22
+ src/nexom/app/user.py
23
+ src/nexom/assets/app/__init__.py
24
+ src/nexom/assets/app/config.py
25
+ src/nexom/assets/app/gunicorn.conf.py
26
+ src/nexom/assets/app/router.py
27
+ src/nexom/assets/app/wsgi.py
28
+ src/nexom/assets/app/__pycache__/__init__.cpython-313.pyc
29
+ src/nexom/assets/app/pages/__init__.py
30
+ src/nexom/assets/app/pages/_templates.py
31
+ src/nexom/assets/app/pages/default.py
32
+ src/nexom/assets/app/pages/document.py
33
+ src/nexom/assets/app/pages/__pycache__/__init__.cpython-313.pyc
34
+ src/nexom/assets/app/static/dog.jpeg
35
+ src/nexom/assets/app/static/style.css
36
+ src/nexom/assets/app/templates/base.html
37
+ src/nexom/assets/app/templates/default.html
38
+ src/nexom/assets/app/templates/document.html
39
+ src/nexom/assets/app/templates/footer.html
40
+ src/nexom/assets/app/templates/header.html
41
+ src/nexom/assets/auth/__init__.py
42
+ src/nexom/assets/auth/config.py
43
+ src/nexom/assets/auth/gunicorn.conf.py
44
+ src/nexom/assets/auth/wsgi.py
45
+ src/nexom/assets/auth/__pycache__/__init__.cpython-313.pyc
46
+ src/nexom/assets/auth_page/login.html
47
+ src/nexom/assets/auth_page/signup.html
48
+ src/nexom/assets/error_page/error.html
49
+ src/nexom/assets/gateway/apache_app.conf
50
+ src/nexom/assets/gateway/nginx_app.conf
51
+ src/nexom/buildTools/__init__.py
52
+ src/nexom/buildTools/build.py
53
+ src/nexom/buildTools/run.py
54
+ src/nexom/core/__init__.py
55
+ src/nexom/core/error.py
56
+ src/nexom/core/log.py
57
+ src/nexom/core/object_html_render.py
58
+ src/nexom/templates/__init__.py
59
+ src/nexom/templates/auth.py
60
+ tests/test_buildtools.py
61
+ tests/test_http_status_codes.py
62
+ tests/test_middleware.py
63
+ tests/test_path_routing.py
64
+ tests/test_request.py
65
+ tests/test_response.py
66
+ tests/test_static.py
@@ -0,0 +1,3 @@
1
+
2
+ [:python_version < "3.12"]
3
+ typing-extensions
@@ -7,8 +7,8 @@ WSGI-based web applications with minimal overhead.
7
7
 
8
8
  from __future__ import annotations
9
9
 
10
- from nexom.web.request import Request
11
- from nexom.web.response import Response
10
+ from nexom.app.request import Request
11
+ from nexom.app.response import Response
12
12
 
13
13
  __all__ = [
14
14
  "Request",