Forums

Import error with module settings

Hello every one I am getting an error while starting the wsgi. I have tried by editing settings in the wsgi file with project.settings and app.settings. But, its not working. Any help would be appreciated.

import os
import sys
path = os.path.expanduser('~/my-first-blog')
path = '/home/marcosjags/my-first-blog/speechrecognition/voicerecognition'
if path not in sys.path:
     sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'speechrecognition.settings'
from django.core.wsgi import get_wsgi_application
from django.contrib.staticfiles.handlers import StaticFilesHandler
application = StaticFilesHandler(get_wsgi_application())

[edited by admin: formatting]

See our help page for that: http://help.pythonanywhere.com/pages/DebuggingImportError/

I have used this. But, I am unable to resolve this error.

Is it compulsory to create a virtualenv here. Even if i have a virtaulenv in my git for example I have a virtual environment named as speech in my local machine. The moment i cloned the git here on bash. I did not create the virtual environment here.I am using the one named as Speech which was there on my local machine.

do you have a settings.py file at /home/marcosjags/my-first-blog/speechrecognition/voicerecognition/speechrecognition.settings?

No I have it in /home/marcosjags/my-first-blog/speechrecognition/speechrecognition

I have changed the path to this. But, then also i am getting this same error.

Then you need to change the path to /home/marcosjags/my-first-blog/speechrecognition/. You've already got the second speechrecognition in the module name of the settings.

Thanks a lot it works.