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