Nexom 0.1.3__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 (50) hide show
  1. nexom-0.1.3/LICENSE +21 -0
  2. nexom-0.1.3/PKG-INFO +168 -0
  3. nexom-0.1.3/README.md +132 -0
  4. nexom-0.1.3/pyproject.toml +39 -0
  5. nexom-0.1.3/setup.cfg +4 -0
  6. nexom-0.1.3/src/Nexom.egg-info/PKG-INFO +168 -0
  7. nexom-0.1.3/src/Nexom.egg-info/SOURCES.txt +48 -0
  8. nexom-0.1.3/src/Nexom.egg-info/dependency_links.txt +1 -0
  9. nexom-0.1.3/src/Nexom.egg-info/entry_points.txt +2 -0
  10. nexom-0.1.3/src/Nexom.egg-info/top_level.txt +1 -0
  11. nexom-0.1.3/src/nexom/__init__.py +19 -0
  12. nexom-0.1.3/src/nexom/__main__.py +61 -0
  13. nexom-0.1.3/src/nexom/assets/error_page/error.html +44 -0
  14. nexom-0.1.3/src/nexom/assets/server/config.py +27 -0
  15. nexom-0.1.3/src/nexom/assets/server/gunicorn.conf.py +16 -0
  16. nexom-0.1.3/src/nexom/assets/server/pages/__init__.py +3 -0
  17. nexom-0.1.3/src/nexom/assets/server/pages/__pycache__/__init__.cpython-313.pyc +0 -0
  18. nexom-0.1.3/src/nexom/assets/server/pages/_templates.py +11 -0
  19. nexom-0.1.3/src/nexom/assets/server/pages/default.py +10 -0
  20. nexom-0.1.3/src/nexom/assets/server/pages/document.py +10 -0
  21. nexom-0.1.3/src/nexom/assets/server/router.py +18 -0
  22. nexom-0.1.3/src/nexom/assets/server/static/dog.jpeg +0 -0
  23. nexom-0.1.3/src/nexom/assets/server/static/style.css +39 -0
  24. nexom-0.1.3/src/nexom/assets/server/templates/base.html +18 -0
  25. nexom-0.1.3/src/nexom/assets/server/templates/default.html +7 -0
  26. nexom-0.1.3/src/nexom/assets/server/templates/document.html +169 -0
  27. nexom-0.1.3/src/nexom/assets/server/templates/footer.html +3 -0
  28. nexom-0.1.3/src/nexom/assets/server/templates/header.html +3 -0
  29. nexom-0.1.3/src/nexom/assets/server/wsgi.py +30 -0
  30. nexom-0.1.3/src/nexom/buildTools/__init__.py +0 -0
  31. nexom-0.1.3/src/nexom/buildTools/build.py +99 -0
  32. nexom-0.1.3/src/nexom/core/__init__.py +1 -0
  33. nexom-0.1.3/src/nexom/core/error.py +149 -0
  34. nexom-0.1.3/src/nexom/engine/__init__.py +1 -0
  35. nexom-0.1.3/src/nexom/engine/object_html_render.py +224 -0
  36. nexom-0.1.3/src/nexom/web/__init__.py +5 -0
  37. nexom-0.1.3/src/nexom/web/cookie.py +73 -0
  38. nexom-0.1.3/src/nexom/web/http_status_codes.py +72 -0
  39. nexom-0.1.3/src/nexom/web/middleware.py +51 -0
  40. nexom-0.1.3/src/nexom/web/path.py +125 -0
  41. nexom-0.1.3/src/nexom/web/request.py +62 -0
  42. nexom-0.1.3/src/nexom/web/response.py +146 -0
  43. nexom-0.1.3/src/nexom/web/template.py +115 -0
  44. nexom-0.1.3/tests/test_buildtools.py +98 -0
  45. nexom-0.1.3/tests/test_http_status_codes.py +9 -0
  46. nexom-0.1.3/tests/test_middleware.py +46 -0
  47. nexom-0.1.3/tests/test_path_routing.py +47 -0
  48. nexom-0.1.3/tests/test_request.py +22 -0
  49. nexom-0.1.3/tests/test_response.py +30 -0
  50. nexom-0.1.3/tests/test_static.py +34 -0
nexom-0.1.3/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TouriAida
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
nexom-0.1.3/PKG-INFO ADDED
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: Nexom
3
+ Version: 0.1.3
4
+ Summary: Lightweight Python Web Framework (WSGI)
5
+ Author: TouriAida
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 TouriAida
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://nexom.ceez7.com
29
+ Project-URL: Repository, https://github.com/ait913/Nexom
30
+ Project-URL: Issues, https://github.com/ait913/Nexom/issues
31
+ Keywords: wsgi,web,framework
32
+ Requires-Python: >=3.10
33
+ Description-Content-Type: text/markdown
34
+ License-File: LICENSE
35
+ Dynamic: license-file
36
+
37
+
38
+ # Nexom
39
+ Lightweight Python Web Framework (WSGI)
40
+
41
+ Nexomは短いコードで最低限動作し、シンプルで理解のしやすい設計・構造を目指しています。
42
+ また細かい仕様も変更でき、多様な処理に対応します。
43
+
44
+ ## はじめる
45
+ 最初のサーバーを起動するには、3つの手順が必要です。
46
+
47
+ 1. ディレクトリを作成
48
+ 2. nexomをpipでインストール、サーバーのビルド
49
+ 3. 起動
50
+
51
+ ### 1.ディレクトリの作成
52
+ **準備**
53
+ 用意していない場合はディレクトリを作成し、仮想環境も準備てください
54
+ ```
55
+ mkdir sample
56
+ cd sample
57
+
58
+ python -m venv venv
59
+ source venv/bin/activate
60
+ ```
61
+ ### 2.npipでインストール、サーバーのビルド
62
+ **インストール**
63
+ nexomをインストールします。
64
+ ※まだベータ版のため、最新のバージョンを確認してください。
65
+ ```
66
+ pip install nexom==0.1.4
67
+ ```
68
+ **テンプレートサーバーのビルド**
69
+ サーバーを置きたいディレクトリ上で、以下のコマンドを実行してください(sampleは自由)
70
+ ```
71
+ python -m nexom build-server sample
72
+ ```
73
+
74
+ ### 3.起動
75
+ 以下のコマンドを起動します。
76
+ ```
77
+ gunicorn wsgi:app
78
+ ```
79
+ ブラウザからアクセスできるようになります。
80
+ デフォルトのポートは8080です。
81
+ [httpls://localhost:8080](httpls://localhost:8080)
82
+ ポートなどの設定は `config.py` から変更してください。
83
+
84
+ ## Nginx等使用して外部公開する
85
+ `config.py` で指定したポートにプロキシしてください。
86
+ ```
87
+ server {
88
+ listen 443 ssl;
89
+ server_name nexom.ceez7.com;
90
+
91
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92
+
93
+ location / {
94
+ proxy_pass http://localhost:8080;
95
+ }
96
+ }
97
+ ```
98
+
99
+ ## Systemdに登録して自動起動する
100
+ **Ubuntuの場合**
101
+ 1. `/etc/systemd/system` に、 `your_server_name.service` を作成します。
102
+ 2. `your_server_name.service` に以下を書き込みます。(これは一例です。環境に合わせて設定してください。)
103
+
104
+ サーバーのディレクトリが `/home/ubuntu/nexom` にある場合
105
+ ```
106
+ [Unit]
107
+ Description=Nexom Web Freamework
108
+ After=network.target
109
+
110
+ [Service]
111
+ User=www-data
112
+ 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
116
+ [Install]
117
+ WantedBy=multi-user.target
118
+ ```
119
+
120
+ 以下のコマンドを実行します
121
+ ```
122
+ sudo systemd daemon-reload
123
+ sudo systemd enable your_server_name
124
+ sudo systemd start your_server_name
125
+ ```
126
+
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 ファイルを一枚にまとめられます。
140
+
141
+ `/etc/systemd/system/banana-project@.service`
142
+ ```
143
+ [Unit]
144
+ Description=Nexom Web Server (%i)
145
+ After=network.target
146
+
147
+ [Service]
148
+ User=www-data
149
+ 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
153
+ [Install]
154
+ WantedBy=multi-user.target
155
+ ```
156
+ ```
157
+ sudo systemd daemon-reload
158
+
159
+ sudo systemd enable banana-project@banana1
160
+ sudo systemd enable banana-project@banana2
161
+ sudo systemd enable banana-project@banana3
162
+
163
+ sudo systemd start banana-project@banana1
164
+ sudo systemd start banana-project@banana2
165
+ sudo systemd start banana-project@banana3
166
+ ```
167
+
168
+ 2026 1/24
nexom-0.1.3/README.md ADDED
@@ -0,0 +1,132 @@
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
+ mkdir sample
20
+ cd sample
21
+
22
+ python -m venv venv
23
+ source venv/bin/activate
24
+ ```
25
+ ### 2.npipでインストール、サーバーのビルド
26
+ **インストール**
27
+ nexomをインストールします。
28
+ ※まだベータ版のため、最新のバージョンを確認してください。
29
+ ```
30
+ pip install nexom==0.1.4
31
+ ```
32
+ **テンプレートサーバーのビルド**
33
+ サーバーを置きたいディレクトリ上で、以下のコマンドを実行してください(sampleは自由)
34
+ ```
35
+ python -m nexom build-server sample
36
+ ```
37
+
38
+ ### 3.起動
39
+ 以下のコマンドを起動します。
40
+ ```
41
+ gunicorn wsgi:app
42
+ ```
43
+ ブラウザからアクセスできるようになります。
44
+ デフォルトのポートは8080です。
45
+ [httpls://localhost:8080](httpls://localhost:8080)
46
+ ポートなどの設定は `config.py` から変更してください。
47
+
48
+ ## Nginx等使用して外部公開する
49
+ `config.py` で指定したポートにプロキシしてください。
50
+ ```
51
+ server {
52
+ listen 443 ssl;
53
+ server_name nexom.ceez7.com;
54
+
55
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56
+
57
+ location / {
58
+ proxy_pass http://localhost:8080;
59
+ }
60
+ }
61
+ ```
62
+
63
+ ## Systemdに登録して自動起動する
64
+ **Ubuntuの場合**
65
+ 1. `/etc/systemd/system` に、 `your_server_name.service` を作成します。
66
+ 2. `your_server_name.service` に以下を書き込みます。(これは一例です。環境に合わせて設定してください。)
67
+
68
+ サーバーのディレクトリが `/home/ubuntu/nexom` にある場合
69
+ ```
70
+ [Unit]
71
+ Description=Nexom Web Freamework
72
+ After=network.target
73
+
74
+ [Service]
75
+ User=www-data
76
+ Group=www-data
77
+ WorkingDirectory=/home/ubuntu/nexom
78
+ Environment="/home/ubuntu/nexom/venv/bin"
79
+ ExecStart=/home/ubuntu/nexom/venv/bin/gunicorn wsgi:app
80
+ [Install]
81
+ WantedBy=multi-user.target
82
+ ```
83
+
84
+ 以下のコマンドを実行します
85
+ ```
86
+ sudo systemd daemon-reload
87
+ sudo systemd enable your_server_name
88
+ sudo systemd start your_server_name
89
+ ```
90
+
91
+ ### テンプレートユニットを活用して複数のサーバーを効率的に管理
92
+ 以下の構成でサーバーが建てられていたとします。
93
+ ```
94
+ /home/ubuntu/BananaProject/
95
+ └─ web/
96
+ ├─ banana1 (Nexomサーバー)/
97
+ │ └─ wsgi.py
98
+ ├─ banana2 (Nexomサーバー)/
99
+ │ └─ wsgi.py
100
+ └─ banana3 (Nexomサーバー)/
101
+ └─ wsgi.py
102
+ ```
103
+ この構成の場合、テンプレートユニットを活用し .service ファイルを一枚にまとめられます。
104
+
105
+ `/etc/systemd/system/banana-project@.service`
106
+ ```
107
+ [Unit]
108
+ Description=Nexom Web Server (%i)
109
+ After=network.target
110
+
111
+ [Service]
112
+ User=www-data
113
+ Group=www-data
114
+ WorkingDirectory=/home/ubuntu/BananaProject/web/%i
115
+ Environment="/home/ubuntu/BananaProject/web/%i/venv/bin"
116
+ ExecStart=/home/ubuntu/BananaProject/web/%i/venv/bin/gunicorn wsgi:app
117
+ [Install]
118
+ WantedBy=multi-user.target
119
+ ```
120
+ ```
121
+ sudo systemd daemon-reload
122
+
123
+ sudo systemd enable banana-project@banana1
124
+ sudo systemd enable banana-project@banana2
125
+ sudo systemd enable banana-project@banana3
126
+
127
+ sudo systemd start banana-project@banana1
128
+ sudo systemd start banana-project@banana2
129
+ sudo systemd start banana-project@banana3
130
+ ```
131
+
132
+ 2026 1/24
@@ -0,0 +1,39 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "Nexom"
7
+ version = "0.1.3"
8
+ description = "Lightweight Python Web Framework (WSGI)"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { file = "LICENSE" }
12
+ authors = [
13
+ { name = "TouriAida" }
14
+ ]
15
+ keywords = ["wsgi", "web", "framework"]
16
+
17
+ [project.urls]
18
+ Homepage = "https://nexom.ceez7.com"
19
+ Repository = "https://github.com/ait913/Nexom"
20
+ Issues = "https://github.com/ait913/Nexom/issues"
21
+
22
+ [project.scripts]
23
+ nexom = "nexom.__main__:main"
24
+
25
+ [tool.setuptools]
26
+ package-dir = {"" = "src"}
27
+ include-package-data = true
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
31
+ include = ["nexom*"]
32
+
33
+ [tool.setuptools.package-data]
34
+ nexom = ["assets/**/*"]
35
+
36
+ [project.optional-dependencies]
37
+
38
+ [tool.pytest.ini_options]
39
+ testpaths = ["tests"]
nexom-0.1.3/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: Nexom
3
+ Version: 0.1.3
4
+ Summary: Lightweight Python Web Framework (WSGI)
5
+ Author: TouriAida
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 TouriAida
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://nexom.ceez7.com
29
+ Project-URL: Repository, https://github.com/ait913/Nexom
30
+ Project-URL: Issues, https://github.com/ait913/Nexom/issues
31
+ Keywords: wsgi,web,framework
32
+ Requires-Python: >=3.10
33
+ Description-Content-Type: text/markdown
34
+ License-File: LICENSE
35
+ Dynamic: license-file
36
+
37
+
38
+ # Nexom
39
+ Lightweight Python Web Framework (WSGI)
40
+
41
+ Nexomは短いコードで最低限動作し、シンプルで理解のしやすい設計・構造を目指しています。
42
+ また細かい仕様も変更でき、多様な処理に対応します。
43
+
44
+ ## はじめる
45
+ 最初のサーバーを起動するには、3つの手順が必要です。
46
+
47
+ 1. ディレクトリを作成
48
+ 2. nexomをpipでインストール、サーバーのビルド
49
+ 3. 起動
50
+
51
+ ### 1.ディレクトリの作成
52
+ **準備**
53
+ 用意していない場合はディレクトリを作成し、仮想環境も準備てください
54
+ ```
55
+ mkdir sample
56
+ cd sample
57
+
58
+ python -m venv venv
59
+ source venv/bin/activate
60
+ ```
61
+ ### 2.npipでインストール、サーバーのビルド
62
+ **インストール**
63
+ nexomをインストールします。
64
+ ※まだベータ版のため、最新のバージョンを確認してください。
65
+ ```
66
+ pip install nexom==0.1.4
67
+ ```
68
+ **テンプレートサーバーのビルド**
69
+ サーバーを置きたいディレクトリ上で、以下のコマンドを実行してください(sampleは自由)
70
+ ```
71
+ python -m nexom build-server sample
72
+ ```
73
+
74
+ ### 3.起動
75
+ 以下のコマンドを起動します。
76
+ ```
77
+ gunicorn wsgi:app
78
+ ```
79
+ ブラウザからアクセスできるようになります。
80
+ デフォルトのポートは8080です。
81
+ [httpls://localhost:8080](httpls://localhost:8080)
82
+ ポートなどの設定は `config.py` から変更してください。
83
+
84
+ ## Nginx等使用して外部公開する
85
+ `config.py` で指定したポートにプロキシしてください。
86
+ ```
87
+ server {
88
+ listen 443 ssl;
89
+ server_name nexom.ceez7.com;
90
+
91
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92
+
93
+ location / {
94
+ proxy_pass http://localhost:8080;
95
+ }
96
+ }
97
+ ```
98
+
99
+ ## Systemdに登録して自動起動する
100
+ **Ubuntuの場合**
101
+ 1. `/etc/systemd/system` に、 `your_server_name.service` を作成します。
102
+ 2. `your_server_name.service` に以下を書き込みます。(これは一例です。環境に合わせて設定してください。)
103
+
104
+ サーバーのディレクトリが `/home/ubuntu/nexom` にある場合
105
+ ```
106
+ [Unit]
107
+ Description=Nexom Web Freamework
108
+ After=network.target
109
+
110
+ [Service]
111
+ User=www-data
112
+ 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
116
+ [Install]
117
+ WantedBy=multi-user.target
118
+ ```
119
+
120
+ 以下のコマンドを実行します
121
+ ```
122
+ sudo systemd daemon-reload
123
+ sudo systemd enable your_server_name
124
+ sudo systemd start your_server_name
125
+ ```
126
+
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 ファイルを一枚にまとめられます。
140
+
141
+ `/etc/systemd/system/banana-project@.service`
142
+ ```
143
+ [Unit]
144
+ Description=Nexom Web Server (%i)
145
+ After=network.target
146
+
147
+ [Service]
148
+ User=www-data
149
+ 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
153
+ [Install]
154
+ WantedBy=multi-user.target
155
+ ```
156
+ ```
157
+ sudo systemd daemon-reload
158
+
159
+ sudo systemd enable banana-project@banana1
160
+ sudo systemd enable banana-project@banana2
161
+ sudo systemd enable banana-project@banana3
162
+
163
+ sudo systemd start banana-project@banana1
164
+ sudo systemd start banana-project@banana2
165
+ sudo systemd start banana-project@banana3
166
+ ```
167
+
168
+ 2026 1/24
@@ -0,0 +1,48 @@
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/top_level.txt
9
+ src/nexom/__init__.py
10
+ src/nexom/__main__.py
11
+ src/nexom/assets/error_page/error.html
12
+ src/nexom/assets/server/config.py
13
+ src/nexom/assets/server/gunicorn.conf.py
14
+ src/nexom/assets/server/router.py
15
+ src/nexom/assets/server/wsgi.py
16
+ src/nexom/assets/server/pages/__init__.py
17
+ src/nexom/assets/server/pages/_templates.py
18
+ src/nexom/assets/server/pages/default.py
19
+ src/nexom/assets/server/pages/document.py
20
+ src/nexom/assets/server/pages/__pycache__/__init__.cpython-313.pyc
21
+ src/nexom/assets/server/static/dog.jpeg
22
+ src/nexom/assets/server/static/style.css
23
+ src/nexom/assets/server/templates/base.html
24
+ src/nexom/assets/server/templates/default.html
25
+ src/nexom/assets/server/templates/document.html
26
+ src/nexom/assets/server/templates/footer.html
27
+ src/nexom/assets/server/templates/header.html
28
+ src/nexom/buildTools/__init__.py
29
+ src/nexom/buildTools/build.py
30
+ src/nexom/core/__init__.py
31
+ src/nexom/core/error.py
32
+ src/nexom/engine/__init__.py
33
+ src/nexom/engine/object_html_render.py
34
+ src/nexom/web/__init__.py
35
+ src/nexom/web/cookie.py
36
+ src/nexom/web/http_status_codes.py
37
+ src/nexom/web/middleware.py
38
+ src/nexom/web/path.py
39
+ src/nexom/web/request.py
40
+ src/nexom/web/response.py
41
+ src/nexom/web/template.py
42
+ tests/test_buildtools.py
43
+ tests/test_http_status_codes.py
44
+ tests/test_middleware.py
45
+ tests/test_path_routing.py
46
+ tests/test_request.py
47
+ tests/test_response.py
48
+ tests/test_static.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ nexom = nexom.__main__:main
@@ -0,0 +1 @@
1
+ nexom
@@ -0,0 +1,19 @@
1
+ """
2
+ NEXOM - A lightweight Python web framework.
3
+
4
+ NEXOM provides a simple and flexible foundation for building
5
+ WSGI-based web applications with minimal overhead.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from nexom.web.request import Request
11
+ from nexom.web.response import Response
12
+
13
+ __all__ = [
14
+ "Request",
15
+ "Response",
16
+ "__version__",
17
+ ]
18
+
19
+ __version__ = "0.1.2"
@@ -0,0 +1,61 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import sys
5
+ from pathlib import Path
6
+
7
+ from nexom.buildTools.build import server as build_server
8
+ from nexom.buildTools.build import ServerBuildOptions
9
+
10
+
11
+ def main(argv: list[str] | None = None) -> None:
12
+ parser = argparse.ArgumentParser(
13
+ prog="nexom",
14
+ description="Nexom Web Framework CLI",
15
+ )
16
+ subparsers = parser.add_subparsers(dest="command", required=True)
17
+
18
+ # test
19
+ subparsers.add_parser("test", help="Test Nexom installation")
20
+
21
+ # build-server
22
+ p = subparsers.add_parser(
23
+ "build-server",
24
+ help="Create a Nexom server project",
25
+ )
26
+ p.add_argument("server_name", help="Server project name")
27
+ p.add_argument(
28
+ "--out",
29
+ default=".",
30
+ help="Output directory (default: current directory)",
31
+ )
32
+ p.add_argument("--address", default="0.0.0.0", help="Bind address (default: 0.0.0.0)")
33
+ p.add_argument("--port", type=int, default=8080, help="Bind port (default: 8080)")
34
+ p.add_argument("--workers", type=int, default=4, help="Gunicorn workers (default: 4)")
35
+ p.add_argument("--reload", action="store_true", help="Enable auto-reload (development)")
36
+
37
+ args = parser.parse_args(argv)
38
+
39
+ if args.command == "test":
40
+ print("Hello Nexom Web Framework!")
41
+ return
42
+
43
+ if args.command == "build-server":
44
+ options = ServerBuildOptions(
45
+ address=args.address,
46
+ port=args.port,
47
+ workers=args.workers,
48
+ reload=args.reload,
49
+ )
50
+ out_dir = build_server(Path(args.out), args.server_name, options=options)
51
+ print(f"Created Nexom server project at: {out_dir}")
52
+ return
53
+
54
+
55
+ if __name__ == "__main__":
56
+ try:
57
+ main()
58
+ except Exception as e:
59
+ # CLI では stacktrace よりまずメッセージ優先(必要なら後で --verbose とか足す)
60
+ print(f"Error: {e}", file=sys.stderr)
61
+ sys.exit(1)