2017-12-11 24 views
-1

Adafruit MotorHat가 쌓인 RaspberryPi에서 제공되는 간단한 Flask 앱에서 작업 중이므로 Stepper Motors를 운전할 수 있습니다. 명령 줄에서 응용 프로그램을 실행할 때 모든 것이 잘 작동하고 모터는 Flask 웹 인터페이스를 통해 제어 할 수 있습니다. 그러나 mod_wsgi에를 통해 응용 프로그램을 배포하려고 할 때 나는 MotorHat 라이브러리에 관한 다음 아파치 오류를 얻을 :mod_wsgi의 Adafruit_MotorHAT에 대한 사용 권한이 거부되었습니다. Flask 앱

[Mon Dec 11 09:30:32.700209 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] mod_wsgi (pid=1583): Target WSGI script '/var/www/FlaskApp /flaskapp.wsgi' cannot be loaded as Python module. 
[Mon Dec 11 09:30:32.700330 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] mod_wsgi (pid=1583): Exception occurred processing WSGI script '/var/www/FlaskApp/flaskapp.wsgi'. 
[Mon Dec 11 09:30:32.700405 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] Traceback (most recent call last): 
[Mon Dec 11 09:30:32.700473 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] File "/var/www/FlaskApp/flaskapp.wsgi", line 7, in <module> 
[Mon Dec 11 09:30:32.700665 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416]  from FlaskApp import app as application 
[Mon Dec 11 09:30:32.700706 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] File "/var/www/FlaskApp/FlaskApp/__init__.py", line 3, in <module> 
[Mon Dec 11 09:30:32.700895 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416]  from newsFocus import * 
[Mon Dec 11 09:30:32.700933 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] File "/var/www/FlaskApp/FlaskApp/newsFocus.py", line 14, in <module> 
[Mon Dec 11 09:30:32.701313 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416]  from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_StepperMotor 
[Mon Dec 11 09:30:32.701362 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] File "build/bdist.linux-armv7l/egg/Adafruit_MotorHAT/__init__.py", line 1, in <module> 
[Mon Dec 11 09:30:32.701971 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] File "build/bdist.linux-armv7l/egg/Adafruit_MotorHAT/Adafruit_MotorHAT.py", line 3, in <module> 
[Mon Dec 11 09:30:32.702522 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] File "build/bdist.linux-armv7l/egg/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py", line 11, in <module> 
[Mon Dec 11 09:30:32.703070 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] File "build/bdist.linux-armv7l/egg/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py", line 35, in PWM 
[Mon Dec 11 09:30:32.703619 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] File "build/bdist.linux-armv7l/egg/Adafruit_MotorHAT/Adafruit_I2C.py", line 43, in __init__ 
[Mon Dec 11 09:30:32.704127 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416]  self.bus = smbus.SMBus(busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber()) 
[Mon Dec 11 09:30:32.704204 2017] [wsgi:error] [pid 1583] [client 192.168.0.10:38416] IOError: [Errno 13] Permission denied 

가 어떻게이 문제를 해결 할 수 있으며 mod_wsgi에를 통해 배포 갔지 어떤 사용자 것은 실제로 응용 프로그램을 실행을?

답변

1

Apache가 실행하는 사용자는 액세스하려는 파일에 액세스 할 수있는 권한이 없습니다. 참조 :

를는 경우가 여기에있다,하지만 당신은 절대 아닌 상대 경로 이름을 사용하는 경우 또 다른 일반적인 문제는 것처럼 보이지 않지만.

난 당신이 mod_wsgi에의 데몬 모드를 사용하고 있는지 확인 제안하고 사용자가 당신이하려는 파일 또는 장치에 액세스 할 수있는 무엇이든 할 수있는 데몬 프로세스에 대한 사용자/그룹을 설정 참조 접속하다. 또한 상대 경로를 사용하고 프로세스를 변경할 수없는 경우 프로세스의 홈 디렉토리 설정 옵션을 살펴보십시오. 참조 :