Using RPi.GPIO with django
up vote
-1
down vote
favorite
I have django project set on my pc and copy of that project on Raspberry pi 3. I deploy changes through pyCharm to raspi. Raspberry is my server where I host my website. I wanted to play with led light through web app. In my app I've imported import RPI.GPIO as GPIO
but after server run there was ImportError: No module named 'RPi'. I've managed to install only gpio on pc (No matching distribution found for RPi), but there is still ImportError : No module named 'gpio'. Here is my code in views.py
import gpio
LED_PIN = 18
def turnOn(request):
gpio.setmode(gpio.BOARD)
gpio.output(LED_PIN, 1)
return HttpResponse('')
Is there any possibility to use RPi.GPIO in django on pc?
python django raspberry-pi gpio remote-control
add a comment |
up vote
-1
down vote
favorite
I have django project set on my pc and copy of that project on Raspberry pi 3. I deploy changes through pyCharm to raspi. Raspberry is my server where I host my website. I wanted to play with led light through web app. In my app I've imported import RPI.GPIO as GPIO
but after server run there was ImportError: No module named 'RPi'. I've managed to install only gpio on pc (No matching distribution found for RPi), but there is still ImportError : No module named 'gpio'. Here is my code in views.py
import gpio
LED_PIN = 18
def turnOn(request):
gpio.setmode(gpio.BOARD)
gpio.output(LED_PIN, 1)
return HttpResponse('')
Is there any possibility to use RPi.GPIO in django on pc?
python django raspberry-pi gpio remote-control
2
You cannot get RPi.GPIO on your pc, there are different io connections. However, if you deploy the code to your raspberry pi and run you can use RPi.GPIO.
– Arnav Chawla
Nov 10 at 22:25
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have django project set on my pc and copy of that project on Raspberry pi 3. I deploy changes through pyCharm to raspi. Raspberry is my server where I host my website. I wanted to play with led light through web app. In my app I've imported import RPI.GPIO as GPIO
but after server run there was ImportError: No module named 'RPi'. I've managed to install only gpio on pc (No matching distribution found for RPi), but there is still ImportError : No module named 'gpio'. Here is my code in views.py
import gpio
LED_PIN = 18
def turnOn(request):
gpio.setmode(gpio.BOARD)
gpio.output(LED_PIN, 1)
return HttpResponse('')
Is there any possibility to use RPi.GPIO in django on pc?
python django raspberry-pi gpio remote-control
I have django project set on my pc and copy of that project on Raspberry pi 3. I deploy changes through pyCharm to raspi. Raspberry is my server where I host my website. I wanted to play with led light through web app. In my app I've imported import RPI.GPIO as GPIO
but after server run there was ImportError: No module named 'RPi'. I've managed to install only gpio on pc (No matching distribution found for RPi), but there is still ImportError : No module named 'gpio'. Here is my code in views.py
import gpio
LED_PIN = 18
def turnOn(request):
gpio.setmode(gpio.BOARD)
gpio.output(LED_PIN, 1)
return HttpResponse('')
Is there any possibility to use RPi.GPIO in django on pc?
python django raspberry-pi gpio remote-control
python django raspberry-pi gpio remote-control
asked Nov 10 at 22:11
Aleksandra Skoczypiec
415
415
2
You cannot get RPi.GPIO on your pc, there are different io connections. However, if you deploy the code to your raspberry pi and run you can use RPi.GPIO.
– Arnav Chawla
Nov 10 at 22:25
add a comment |
2
You cannot get RPi.GPIO on your pc, there are different io connections. However, if you deploy the code to your raspberry pi and run you can use RPi.GPIO.
– Arnav Chawla
Nov 10 at 22:25
2
2
You cannot get RPi.GPIO on your pc, there are different io connections. However, if you deploy the code to your raspberry pi and run you can use RPi.GPIO.
– Arnav Chawla
Nov 10 at 22:25
You cannot get RPi.GPIO on your pc, there are different io connections. However, if you deploy the code to your raspberry pi and run you can use RPi.GPIO.
– Arnav Chawla
Nov 10 at 22:25
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
RPi.GPIO is Raspberry-specific and you really cannot use it on your computer - it even has no GPIO ports. You should deploy your code to RPi and use it there.
add a comment |
up vote
0
down vote
I found a solution. With help of wiringPi and subprocess I could execute command.
def turnOn(request):
subprocess.call(['gpio', '-g', 'mode', '3', 'out'])
subprocess.call(['gpio', '-g', 'write', '3', '1'])
return HttpResponse('')
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
RPi.GPIO is Raspberry-specific and you really cannot use it on your computer - it even has no GPIO ports. You should deploy your code to RPi and use it there.
add a comment |
up vote
0
down vote
RPi.GPIO is Raspberry-specific and you really cannot use it on your computer - it even has no GPIO ports. You should deploy your code to RPi and use it there.
add a comment |
up vote
0
down vote
up vote
0
down vote
RPi.GPIO is Raspberry-specific and you really cannot use it on your computer - it even has no GPIO ports. You should deploy your code to RPi and use it there.
RPi.GPIO is Raspberry-specific and you really cannot use it on your computer - it even has no GPIO ports. You should deploy your code to RPi and use it there.
answered Nov 10 at 23:19
Martin Urbanec
2818
2818
add a comment |
add a comment |
up vote
0
down vote
I found a solution. With help of wiringPi and subprocess I could execute command.
def turnOn(request):
subprocess.call(['gpio', '-g', 'mode', '3', 'out'])
subprocess.call(['gpio', '-g', 'write', '3', '1'])
return HttpResponse('')
add a comment |
up vote
0
down vote
I found a solution. With help of wiringPi and subprocess I could execute command.
def turnOn(request):
subprocess.call(['gpio', '-g', 'mode', '3', 'out'])
subprocess.call(['gpio', '-g', 'write', '3', '1'])
return HttpResponse('')
add a comment |
up vote
0
down vote
up vote
0
down vote
I found a solution. With help of wiringPi and subprocess I could execute command.
def turnOn(request):
subprocess.call(['gpio', '-g', 'mode', '3', 'out'])
subprocess.call(['gpio', '-g', 'write', '3', '1'])
return HttpResponse('')
I found a solution. With help of wiringPi and subprocess I could execute command.
def turnOn(request):
subprocess.call(['gpio', '-g', 'mode', '3', 'out'])
subprocess.call(['gpio', '-g', 'write', '3', '1'])
return HttpResponse('')
answered Nov 12 at 14:47
Aleksandra Skoczypiec
415
415
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243937%2fusing-rpi-gpio-with-django%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
You cannot get RPi.GPIO on your pc, there are different io connections. However, if you deploy the code to your raspberry pi and run you can use RPi.GPIO.
– Arnav Chawla
Nov 10 at 22:25