Code Monkey home page Code Monkey logo

galaxeek-backend's Introduction

galaxeek-backend

The final project of CS7314 (IoT Theory and Technology). The backend implemented by Django framework.

Notes

数据库的重新迁移

当整个model发生较大调整时,可能要删除所有数据库中现有的整个表,然后重新生成。以下方式可以安全的进行remake 而不引发未知错误:

  1. 运行python manage.py migrate api zero,撤销所有migration。
  2. 删除.\api\migrations目录下的0001_initial.py
  3. 运行python manage.py makemigrations api以及python manage.py migrate来重新迁移。

Serializer的使用

serializer.save()调用之前如果要调用serializer.data会报错。因为保存之后data中会多出主键id。 需要改为使用serializer.validated_data来提前获取数据进行相关操作。

华为云IOTDA Python SDK相关

  • 下发设备命令

DeviceCommandRequest的构造参数paras需要输入一个字典变量,而不是转换后的JSON字符串。否则 会导致报错:MQTT接口参数错误。推测是该类自带了一个JSON的render, 自动对输入的字典转换为JSON格式。而官网的API Explorer中生成的代码是输入一个JSON字符串,很有误导性。

Reference

galaxeek-backend's People

Contributors

frederickszk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.