ImportError: No module named services Django

匿名 (未验证) 提交于 2019-12-03 09:17:17

问题:

I installed python 2.7 alongside my mac. I have a project running using Django v1.9.4. Unfortunately manage.py runserver is throwing an error while running failed because it couldn't find module named services.

From a shell:

Traceback (most recent call last):   File "./manage.py", line 10, in <module>     execute_from_command_line(sys.argv)   File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line     utility.execute()   File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 327, in execute     django.setup()   File "/Library/Python/2.7/site-packages/django/__init__.py", line 18, in setup     apps.populate(settings.INSTALLED_APPS)   File "/Library/Python/2.7/site-packages/django/apps/registry.py", line 85, in populate     app_config = AppConfig.create(entry)   File "/Library/Python/2.7/site-packages/django/apps/config.py", line 90, in create     module = import_module(entry)   File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module     __import__(name) ImportError: No module named services 

I'm wondering what should be done here to install this module.

回答1:

It seems that 'services' is your project's module. Maybe you should set the PYTHONPATH environment to make python find your module. If the module is in current directory, you can run the project like this: export PYTHONPATH=.:$PYTHONPATH manage.py runserver



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!