0

I'm try run development server byt I recive error like this:

Unhandled exception in thread started by <function wrapper at 0x807ad8848>
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 229, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run
    autoreload.raise_last_exception()
  File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 252, in raise_last_exception
    six.reraise(*_exception)
  File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 229, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 86, in create
    module = import_module(entry)
  File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named avatar

I'm using virtualenv and I actived it and project using it and I installed django-avatar there.

django-avatar

On my local server this module work normally :)

You have some idea what is wrong?

Thaian
  • 1,215
  • 2
  • 20
  • 30
  • Did you check whether the venv really has the package installed: `(your_venv)terminal$ pip list` must show the avatar package you installed. – Cajetan Rodrigues Feb 28 '16 at 12:59
  • @CajetanRodrigues Yes, I do: django-avatar (2.2.1) – Thaian Feb 28 '16 at 13:01
  • OK, and I assume your venv was setup properly? `which python` and `which pip` point to the corresponding installations inside the venv and not your default system installations? – Cajetan Rodrigues Feb 28 '16 at 13:08
  • @CajetanRodrigues command python return: Python 3.5.1 (default, Feb 16 2016, 21:54:13). Pip version is 8.0.3 (read from pip list). I created my virtualenv using command "virtualenv env_name -p /usr/local/bin/python3.5.1" - it's a server command which created this env. – Thaian Feb 28 '16 at 13:20
  • if you've instructed `virtualenv` to use `python 3.5.1` from the system, why does your stack trace show `python 2.7`? What commands are you using to run the project on your local server v/s the dev server ? – Cajetan Rodrigues Feb 28 '16 at 13:28
  • On my local server I'm using PyCharm just python manage.py runserver and in serttings I have patch to my env. On the dev server I'm using passenger to run server. – Thaian Feb 28 '16 at 13:39
  • Could you confirm that `python manage.py runserver` works without problems on the dev server? That'll isolate the problem to your Passenger configuration. – Cajetan Rodrigues Feb 28 '16 at 13:53

1 Answers1

0

I solved my problem using absolute path to python in my enviroment that resolve it. And add after that manage.py.

/usr/home/login/virtualenvs/env_name/bin/python passenger_wsgi.py

/usr/home/login/virtualenvs/env_name/bin/python manage.py
Thaian
  • 1,215
  • 2
  • 20
  • 30