python - Debian 7 + django + gunicorn + virtualenv : site-packages egg-link not in pythonpath -


context :

  • debian 7
  • gunicorn (installed debian package in order use /etc/gunicorn.d configuration)
  • project dependencies installed via pip in virtualenv

dependencies installed using pip install -r requirements.txt in file have 3 packages comes github repository.

eg.

-e git+https://github.com/truc/bidule.git#egg=bidule-master 

here gunicorn.d configuration :

config = {     'mode': 'django',     'environment': {         'pythonpath': '/path/to/my/django/project/:/path/to/virtualenv/lib/python2.7/site-packages/',     'production': '1',      },     'working_dir': '/path/to/my/django/project/',     'user': 'user',     'group': 'group',     'args': (         '--bind=127.0.0.1:8090',         '--workers=3',         # '--worker-class=egg:gunicorn#sync',         #'--timeout=30',     #'--preload',     'myproject.settings'     ), } 

but 3 github packages not in /path/to/virtualenv/lib/python2.7/site-packages/ modules not found in path. i've noticed there file : bidule.egg-link contain path /path/to/virtualenv/src/bidule-master

for moment workaround found add manually path theses packages in pythonpath in gunicorn.d conf.

'pythonpath': '/path/to/my/django/project/:/path/to/virtualenv/src/bidule-master/:/path/to/virtualenv/lib/python2.7/site-packages/', 

my question there way not have put each github package manually in pythonpath ?

thanks

first of all, django-specific mode of gunicorn deprecated, , doesn't work anymore django 1.7. see https://github.com/benoitc/gunicorn/issues/705 , https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/gunicorn/

for specific problem, instead of tweaking $pythonpath, try setting 'python' key python binary in virtualenv. should work out automatically modules located.

complete config django 1.7:

config = {     # default mode wsgi     'working_dir': '/path/to/my/django/project/',     'python': '/path/to/virtualenv/bin/python',     'user': 'user',     'group': 'group',     'args': (         '--bind=127.0.0.1:8090',         '--workers=3',         # '--worker-class=egg:gunicorn#sync',         #'--timeout=30',         #'--preload',         'myproject.wsgi'     ), } 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -