docker-compose up -d
docker-compose exec web python manage.py loaddata api_health/fixtures/DataSources.json
curl http://35.236.167.20/api/accel/ -X POST -H "Content-Type: application/json" -d "[{\"data_source\": \"iphone 8\", \"values\": {\"x\": 0.021, \"y\": 0.00213, \"z\": 0.00234}}]"
djangoのshellに入る
docker-compose exec web python manage.py shell
shell内で
>>> from api_health.models import Acceleration, DataSource, EnvSensor, ActSensor, Label
>>> Acceleration.objects.all()
返り値が<QuerySet [<Acceleration: Acceleration object (1)>]>
のようになればOK.
マイグレーションファイル作成
python manage.py makemigrations api_health
マイグレーション
python manage.py migrate
サーバーのコードの更新時に行う手順
sudo -i
cd /home/makeffort134/health
git pull origin api
# conflictの解消
cd docker-django/web
docker-compose exec web python manage.py migrate
docker-compose down
docker-compose up -d
# shellで確認
docker-compose exec web python manage.py shell