django-rest-swagger tries to import settings on installation and fails if the setting file isn't in the path.
$ pip install django-rest-swagger
Downloading/unpacking django-rest-swagger
Running setup.py egg_info for package django-rest-swagger
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "[VIRTUALENV_PATH]/build/django-rest-swagger/setup.py", line 3, in <module>
from rest_framework_swagger import VERSION
File "rest_framework_swagger/__init__.py", line 14, in <module>
SWAGGER_SETTINGS = getattr(settings, 'SWAGGER_SETTINGS', DEFAULT_SWAGGER_SETTINGS)
File "[VIRTUALENV_PATH]/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "[VIRTUALENV_PATH]/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "[VIRTUALENV_PATH]/lib/python2.7/site-packages/django/conf/__init__.py", line 134, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'settings' (Is it on sys.path?): No module named settings
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "[VIRTUALENV_PATH]/build/django-rest-swagger/setup.py", line 3, in <module>
from rest_framework_swagger import VERSION
File "rest_framework_swagger/__init__.py", line 14, in <module>
SWAGGER_SETTINGS = getattr(settings, 'SWAGGER_SETTINGS', DEFAULT_SWAGGER_SETTINGS)
File "[VIRTUALENV_PATH]/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "[VIRTUALENV_PATH]/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "[VIRTUALENV_PATH]/lib/python2.7/site-packages/django/conf/__init__.py", line 134, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'settings' (Is it on sys.path?): No module named settings
Workaround: add the path where the project resides to the PYTHONPATH.