Django Export XLS 【Windows安装】

今天在windows电脑上安装django-export-xls的时候报错了:

(venv) PS F:\Pycharm_Projects\Ruoyi-Energy> pip3 install django-export-xls                                                         
Collecting django-export-xls
  Using cached django-export-xls-0.1.1.tar.gz (3.2 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
obaby\AppData\Local\Temp\pip-pip-egg-info-u0lvqod1'
       cwd: C:\Users\obaby\AppData\Local\Temp\pip-install-xrhra6sx\django-export-xls_d72b66d322264c26b516fda785f307fd\
  Complete output (5 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\obaby\AppData\Local\Temp\pip-install-xrhra6sx\django-export-xls_d72b66d322264c26b516fda785f307fd\setup.py", line 4, in <module>
      README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
  UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 918: illegal multibyte sequence
  ----------------------------------------

Continue Reading

Django Export XLS

python读写csv是非常方便的,但是读写xls就稍微麻烦一些,涉及到行和列的问题。为了导出数据,搜了一下找到这么个插件:https://github.com/Daiech/django-export-xls,集成非常简单,只需要下面几步就ok了:

1. 安装::
      $ pip install django-export-xls
2. 将"export_xls" 添加到 INSTALLED_APPS::
      INSTALLED_APPS = (
          ...
          'export_xls',
      )
3. 修改以下两个路径MEDIA_ROOT 和MEDIA_URL eg::
      import os
      MEDIA_ROOT = os.sep.join([os.path.dirname(os.path.dirname(__file__)), 'media'])
      MEDIA_URL = '/media/'
4. 执行数据导出:
   定义以下几个数据:文件名、表头、导出数据

Continue Reading

mosquitto not authorised

Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.
The MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.
The Mosquitto project also provides a C library for implementing MQTT clients, and the very popular mosquitto_pub and mosquitto_sub command line MQTT clients.

最近需要用mqtt来实现消息处理,在windows上安装Mosquitto之后,不使用用户名密码提示connection refused: not authorised。结果添加用户名密码之后还是提示同样的错误。

Continue Reading