34👍
The error says ImportError: Could not import settings 'bookings.settings' (Is it on sys.path?): No module named unipath
So, is your path /Users/django_demo/godjango/bookings
within the python-sys.path?
Check it in your shell with:
$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for path in sys.path: print path
...
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/suds-0.4-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.6-intel.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/spyne-2.8.2_rc-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-3.0alpha2-py2.7-macosx-10.6-intel.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pytz-2012d-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django_debug_toolbar-0.9.4-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django_social_auth-0.7.7-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/python_openid-2.2.5-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2-1.5.211-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Django-1.4.1-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/httplib2-0.7.6-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
/Library/Python/2.7/site-packages
>>>
If not – you need to add it or simply move your bookings
app into one of the paths represented in your sys.path
14👍
Modify your wsgi.py file from
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bookings.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
to
import os, sys
sys.path.append(' /Users/Sreek/django_demo/godjango/bookings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bookings.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
- [Django]-How can I handle Exceptions raised by dango-social-auth?
- [Django]-Django 1.7 upgrade error: AppRegistryNotReady: Apps aren't loaded yet
- [Django]-Django template includes slow?
11👍
The significant part of the traceback here is right at the very end. It says “No module named unipath”. You’ve referred to that somewhere in your code, but you don’t seem to have it in your project – it’s not part of the standard library, so you’ll need to install it somewhere that Python can see it.
- [Django]-PyCharm: DJANGO_SETTINGS_MODULE is undefined
- [Django]-Caching query results in django
- [Django]-How to compare dates in Django templates
4👍
Alternatively, you can even pass the settings path at run time like so:
python manage.py syncdb --settings=bookings.settings --pythonpath=/Users/django_demo/godjango/bookings
This should override the environment variable (DJANGO_SETTINGS_MODULE)
- [Django]-Django, Models & Forms: replace "This field is required" message
- [Django]-Parsing unicode input using python json.loads
- [Django]-Best way to write an image to a Django HttpResponse()
1👍
Review hour /etc/apache2/httpd.conf file; you must include the WSGIPythonPath directive, to indicate the folder which contains your Django project (manage.py file), like:
WSGIPythonPath /home/user/Projects/Django/MyProject
also if you used some weird port in your VirtualHost, specify if for listening:
Listen 90
Hope this helps somebody
- [Django]-How to stream an HttpResponse with Django
- [Django]-Django {% static 'path' %} in javascript file
- [Django]-Django – Clean permission table
1👍
ImportError: Could not import settings 'settings' (Is it on sys.path? Is there an import error in the settings file?): No module named setting
In my case I was using __init__.py
to import other files and there was an error in it, so settings might actually exist but be flawed.
- [Django]-How to export virtualenv?
- [Django]-How to use python2.7 pip instead of default pip
- [Django]-Can't find msguniq. Make sure you have GNU gettext tools 0.15 or newer installed. (Django 1.8 and OSX ElCapitan)