Skip to main content

Lightweight Python Web Framework (WSGI)

Project description

Nexom

Lightweight Python Web Framework (WSGI)

Nexomは短いコードで最低限動作し、シンプルで理解のしやすい設計・構造を目指しています。 また細かい仕様も変更でき、多様な処理に対応します。

はじめる

最初のサーバーを起動するには、3つの手順が必要です。

  1. ディレクトリを作成
  2. nexomをpipでインストール、サーバーのビルド
  3. 起動

1.ディレクトリの作成

準備 用意していない場合はディレクトリを作成し、仮想環境も準備てください

mkdir sample
cd sample

python -m venv venv
source venv/bin/activate

2.npipでインストール、サーバーのビルド

インストール nexomをインストールします。 ※まだベータ版のため、最新のバージョンを確認してください。

pip install nexom==0.1.4

テンプレートサーバーのビルド サーバーを置きたいディレクトリ上で、以下のコマンドを実行してください(sampleは自由)

python -m nexom build-server sample

3.起動

以下のコマンドを起動します。

gunicorn wsgi:app

ブラウザからアクセスできるようになります。 デフォルトのポートは8080です。 httpls://localhost:8080 ポートなどの設定は config.py から変更してください。

Nginx等使用して外部公開する

config.py で指定したポートにプロキシしてください。

server {
    listen 443 ssl;
        server_name nexom.ceez7.com;

        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        location / {
                proxy_pass http://localhost:8080;
        }
}

Systemdに登録して自動起動する

Ubuntuの場合

  1. /etc/systemd/system に、 your_server_name.service を作成します。
  2. your_server_name.service に以下を書き込みます。(これは一例です。環境に合わせて設定してください。)

サーバーのディレクトリが /home/ubuntu/nexom にある場合

[Unit]
Description=Nexom Web Freamework
After=network.target

[Service]
User=www-data
Group=www-data
WorkingDirectory=/home/ubuntu/nexom
Environment="/home/ubuntu/nexom/venv/bin"
ExecStart=/home/ubuntu/nexom/venv/bin/gunicorn wsgi:app
[Install]
WantedBy=multi-user.target

以下のコマンドを実行します

sudo systemd daemon-reload
sudo systemd enable your_server_name
sudo systemd start your_server_name

テンプレートユニットを活用して複数のサーバーを効率的に管理

以下の構成でサーバーが建てられていたとします。

/home/ubuntu/BananaProject/
└─ web/
   ├─ banana1 (Nexomサーバー)/
   │  └─ wsgi.py
   ├─ banana2 (Nexomサーバー)/
   │  └─ wsgi.py
   └─ banana3 (Nexomサーバー)/
      └─ wsgi.py

この構成の場合、テンプレートユニットを活用し .service ファイルを一枚にまとめられます。

/etc/systemd/system/banana-project@.service

[Unit]
Description=Nexom Web Server (%i)
After=network.target

[Service]
User=www-data
Group=www-data
WorkingDirectory=/home/ubuntu/BananaProject/web/%i
Environment="/home/ubuntu/BananaProject/web/%i/venv/bin"
ExecStart=/home/ubuntu/BananaProject/web/%i/venv/bin/gunicorn wsgi:app
[Install]
WantedBy=multi-user.target
sudo systemd daemon-reload

sudo systemd enable banana-project@banana1
sudo systemd enable banana-project@banana2
sudo systemd enable banana-project@banana3

sudo systemd start banana-project@banana1
sudo systemd start banana-project@banana2
sudo systemd start banana-project@banana3

2026 1/24

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nexom-0.1.3.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nexom-0.1.3-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file nexom-0.1.3.tar.gz.

File metadata

  • Download URL: nexom-0.1.3.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for nexom-0.1.3.tar.gz
Algorithm Hash digest
SHA256 0b414d263213f37229a0488922bdd911a4b7b468cf213905ad105c123b5bed42
MD5 fcd59fcedad2a73d29a47b1bddcc7c2a
BLAKE2b-256 d07b91d86a2d371850d431aba740cb18793c0d3466cfce52e4a0a4ca92d5ea2c

See more details on using hashes here.

File details

Details for the file nexom-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: nexom-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for nexom-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7c985a63d1d2c08a88916a42f86b455b286e48bdb462854739954cae49cf2a06
MD5 be23cd1e38533ac5e354103e777ad05a
BLAKE2b-256 b24c8199bd13414e573522bb0d09c5ff808b39d51fab8fe61f53520509619ae5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page