polls on wagtail
Project description
django-on-hatch
目次
詳細
このリポジトリはHatchプロジェクトマネージャーを使ったDjangoプロジェクトの開発またはテスト(お試し)ツールです。
配布用としてDjangoアプリをアップロードする環境を自動構築または配布用としてアップロードされたDjangoアプリをこのDjangoプロジェクトに組み込んでテストすることができます。
使用方法は以下からご覧ください。
インストール
実行環境は「Windows Sybsystem for Linux 2」のUbuntuです。
Pythonの環境は任意です。
私はpyenvを使用してPython3.7の環境を設定しています。
$ pyenv local 3.7
$ python3 --version
Python 3.7.0
仮想環境を作成して有効にし、Hatchをインストールします。
$ python3 -m venv .venv && . .venv/bin/activate
$ pip install --upgrade pip
$ pip install hatch keyrings.alt
リポジトリを落として「wagtail-polls」ディレクトリに入ります。
$ git clone https://github.com/kenno-warise/wagtail-polls.git
$ cd wagtail-polls
hatchコマンドでデータベースの作成・スーパーユーザーの作成・サーバーの起動を行います。
$ hatch run makemigrations polls && hatch run migrate
$ hatch run createsuperuser
$ hatch run runserver
ショートカットとしてHatchの「run」コマンドで実行できるDjangoのコマンドはpyproject.tomlの「tool.hatch.envs.default.scripts」テーブルによって登録しています。
[tool.hatch.envs.default.scripts]
makemigrations = "python3 manage.py makemigrations {args}"
migrate = "python3 manage.py migrate"
createsuperuser = "python3 manage.py createsuperuser"
runserver = "python3 manage.py runserver"
startapp = "python3 manage.py startapp {args}"
shell = "python3 manage.py shell"
test = "python3 manage.py test {args}"
cov = "coverage run --include=app/* --omit=app/test*,app/__init__.py,app/migrations manage.py test {args}"
cov-report = "coverage report -m"
アップロード
Hatchの「version」コマンドでDjangoアプリのバージョン情報を確認できます。
$ hatch version
0.0.1
DjangoアプリをパッケージングしてPyPIにアップロードする。
pyproject.tomlに配布するファイルと配布しないファイルを設定できます。
[tool.hatch.build]
include = ["app_2/*"] # templatesとstaticも含まれます。
exclude = ["app_2/migrations/*"]
上記以外にあれば追記します。
バージョンを更新する場合は「version」コマンドを実行します。
$ hatch version micro
Old: 0.0.1
New: 0.0.2
ビルドを実行します。
$ hatch build
アーティファクトを公開します。
$ hatch publish
Djangoプロジェクトに設定(テスト)
アップロード済みのDjangoアプリを設定します。
myproject/settings.py
pkgの部分をDjangoアプリ名に当てはめます。
INSTALLED_APPS = [
...,
"pkg",
]
myproject/urls.py
pkgの部分をDjangoアプリ名に当てはめます。
...
from django.urls import path, include
urlpatterns = [
...,
path('', include('pkg.urls')),
]
requirements.txt
pkgの部分をDjangoアプリ名に当てはめます。
django==2.2.5
pkg
必要であればマイグレートとスーパーユーザーを作成します。
$ hatch run migrate
$ hatch run createsuperuser
サーバーを起動します。
$ hatch run runserver
License
django-on-hatch is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file warise_polls-0.0.2.tar.gz.
File metadata
- Download URL: warise_polls-0.0.2.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.24.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3da2322e70bdc8258a64a81b0cb9552f14e18a49b8b82b80a8694c65e9150237
|
|
| MD5 |
916dbbd40a2ee46ac30340bfaad798a1
|
|
| BLAKE2b-256 |
62ebee8ebb1e1ca2b81506d9a3a24a09a190401a37b3ba88f7c9248bca1b9cfd
|
File details
Details for the file warise_polls-0.0.2-py3-none-any.whl.
File metadata
- Download URL: warise_polls-0.0.2-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.24.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd577c1095b2d136d9038c0a24555497a9bff185990a56dd3503c6c9b3a69265
|
|
| MD5 |
a06af827dfae92ae2b734c10e68b9c3c
|
|
| BLAKE2b-256 |
d09715e984d189fb9e834e44478bdfb52ea1c82ccbe5e46a3ef06c98513d76d3
|