I've installed djangorestframework
with markdown
and django filter
using pip in virtualenv in django docker container, checked via pip freeze
. The absolute path in OS X is /Users/user/project/denv/lib/python2.7/site-packages
. Added 'rest_framework',
in settings.py but still after docker-compose up
get the following error. I guess it has something to do with wrong path, but have no idea how to fix that.
Traceback (most recent call last):
web_1 | File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
web_1 | fn(*args, **kwargs)
web_1 | File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 113, in inner_run
web_1 | autoreload.raise_last_exception()
web_1 | File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
web_1 | six.reraise(*_exception)
web_1 | File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
web_1 | fn(*args, **kwargs)
web_1 | File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
web_1 | apps.populate(settings.INSTALLED_APPS)
web_1 | File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
web_1 | app_config = AppConfig.create(entry)
web_1 | File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
web_1 | module = import_module(entry)
web_1 | File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
web_1 | __import__(name)
web_1 | ImportError: No module named rest_framework
EDIT2: docker-compose.yml
version: '2'
services:
db:
image: postgres
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
EDIT2: I suppose that error is because of application actually using docker's python not virtualenv python.
Is it possible? How to either install djangorestframework to docker's python packages or better make django application use own python ?