Supervisor - PYTHONPATH python skriptini ishga tushirish

Men python skriptini ishlatish uchun supervayzerdan foydalanaman:

[program:twitter_track]
autorestart = true
numprocs = 1
autostart = false
redirect_stderr = True
stopwaitsecs = 1
startsecs = 1
priority = 99
command = python /home/ubuntu/services/twitter.py track
startretries = 3
stdout_logfile = /home/ubuntu/logs/twitter_track.log

Biroq, jarayon boshlamaydi. Xato jurnalida nima deyilgan:

Traceback (most recent call last):
  File "/home/ubuntu/services/twitter.py", line 6, in 
    from mymodule.twitter.stream import TwitterStream
ImportError: No module named mymodule.twitter.stream
Traceback (most recent call last):
  File "/home/ubuntu/services/twitter.py", line 6, in 

Mimozni olishni istayman, lekin agar men o'zimning twitter.py-ni ishga tushirsam, hamma narsa yaxshi ishlaydi, men uni boshqaruvchidan boshqarganimda bu xatoni faqatgina tashlaydi.

~/.Profile faylida PYTHONPATH uchun mymodule qo'shgandim.

export PYTHONPATH=$PYTHONPATH:/home/ubuntu/lib

Buyruqlar terminali orqali ishga tushirilganda skript ishlashi uchun biron bir sabab bormi, lekin bu boshqaruvchidan foydalanilmaganda? Har qanday yordamni qadrlash kerak.

11

2 javoblar

PYTHONPATH ta'rifini supervisord konfiguratsiya faylida environment direktivasiga qo'shing. [program: twitter_track] bo'limiga o'ting, shunday qilib:

environment=PYTHONPATH=/home/ubuntu/lib/

Bu sizning python jarayoni boshqaruvchi ishga tushirilganda tegishli PYTHONPATH ni ko'rib turishini ta'minlaydi.

27
qo'shib qo'ydi

PYTHONPATH ta'rifini atrofga qo'shing:

[program:twitter_track]
command = python /home/ubuntu/services/twitter.py track
environment=PYTHONPATH=/home/ubuntu/lib
0
qo'shib qo'ydi