DjanoRestFramework App无法找到名为'graphene_django'的模块

时间:2018-05-13 21:18:00

标签: python django python-3.x django-rest-framework graphene-python

我使用Django Rest Framework cookiecutter here来构建一个项目。除了设置virtualenv,安装需求和运行pip install graphene_django之外,我没有做任何更改。但是,当我向graphene_django添加INSTALLED_APPS时,我在尝试运行服务器时收到以下错误:

ModuleNotFoundError: No module named graphene_django

任何想法为什么?

回溯:

Traceback (most recent call last):
  File "manage.py", line 24, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
    django.setup()
  File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked

Pip Freeze:

aniso8601==3.0.0
appnope==0.1.0
backcall==0.1.0
blessings==1.6.1
boto3==1.7.19
botocore==1.10.19
certifi==2018.4.16
chardet==3.0.4
click==6.7
coverage==4.5.1
decorator==4.3.0
dj-database-url==0.5.0
Django==2.0.5
django-configurations==2.0
django-filter==1.1.0
django-model-utils==3.1.2
django-nose==1.4.5
django-oauth-toolkit==1.1.2
django-storages==1.6.6
django-unique-upload==0.2.1
djangorestframework==3.8.2
docutils==0.14
factory-boy==2.11.1
Faker==0.8.14
flake8==3.5.0
graphene==2.1
graphene-django==2.0.0
graphql-core==2.0
graphql-relay==0.4.5
gunicorn==19.8.1
idna==2.6
ipdb==0.11
ipython==6.4.0
ipython-genutils==0.2.0
iso8601==0.1.12
jedi==0.12.0
Jinja2==2.10
jmespath==0.9.3
livereload==2.5.2
Markdown==2.6.11
MarkupSafe==1.0
mccabe==0.6.1
mkdocs==0.17.3
mock==2.0.0
newrelic==3.2.0.91
nose==1.3.7
nose-progressive==1.5.1
oauthlib==2.0.7
parso==0.2.0
pbr==4.0.2
pexpect==4.5.0
pickleshare==0.7.4
promise==2.1
prompt-toolkit==1.0.15
psycopg2-binary==2.7.4
ptyprocess==0.5.2
pycodestyle==2.3.1
pyflakes==1.6.0
Pygments==2.2.0
python-dateutil==2.7.3
pytz==2018.4
PyYAML==3.12
requests==2.18.4
Rx==1.6.1
s3transfer==0.1.13
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.11.0
text-unidecode==1.2
tornado==4.5.3
traitlets==4.3.2
typing==3.6.4
urllib3==1.22
wcwidth==0.1.7

运行app的命令: docker-compose up

1 个答案:

答案 0 :(得分:0)

问题似乎与Docker有关(或者更具体地说,我对Docker不熟悉)。运行docker-compose up --build命令解决了该问题。希望这有助于其他人!