django中的python模块未正确导入

时间:2022-05-26 23:15:11

While trying to use the RPi python module installed on RaspberryPi, using it in one of my request definition in views.py I get

在尝试使用RaspberryPi上安装的RPi python模块时,在views.py中的一个请求定义中使用它我得到

Module not imported correctly!

This is the traceback that I got. Note that I'm using this repo as a starting point.

这是我得到的追溯。请注意,我使用此回购作为起点。

What would be the right way to install RPi and use it properly in Django ? I need RPi because of my motion sensor, using this tutorial as a starting point for motion sensor but want to integrate it to a django view (page)

在Django中安装RPi并正确使用它的正确方法是什么?我需要RPi,因为我的运动传感器,使用本教程作为运动传感器的起点,但希望将其集成到django视图(页面)

1 个解决方案

#1


2  

After downloading the module, uncompress and unpack the downloaded file. Then, run the command "python setup.py install". This documentation on installing modules may be useful http://docs.python.org/2/install/.

下载模块后,解压缩并解压缩下载的文件。然后,运行命令“python setup.py install”。有关安装模块的文档可能很有用http://docs.python.org/2/install/。

As far as using the module with Django, I cannot really help with that. This page may help: https://docs.djangoproject.com/en/dev/intro/reusable-apps/.

至于在Django中使用该模块,我无法真正帮助它。此页面可能有所帮助:https://docs.djangoproject.com/en/dev/intro/reusable-apps/。

#1


2  

After downloading the module, uncompress and unpack the downloaded file. Then, run the command "python setup.py install". This documentation on installing modules may be useful http://docs.python.org/2/install/.

下载模块后,解压缩并解压缩下载的文件。然后,运行命令“python setup.py install”。有关安装模块的文档可能很有用http://docs.python.org/2/install/。

As far as using the module with Django, I cannot really help with that. This page may help: https://docs.djangoproject.com/en/dev/intro/reusable-apps/.

至于在Django中使用该模块,我无法真正帮助它。此页面可能有所帮助:https://docs.djangoproject.com/en/dev/intro/reusable-apps/。