Forums

ImportError: No module named 'mysite'

I deploy my app with django 1.10 and python3.5, but i got an error wich says

ImportError: No module named 'mysite'
File "/var/www/fatkur94_pythonanywhere_com_wsgi.py", line 25, in <module>
application = get_wsgi_application()

thats weird, cause my line just 17 lines where In _pythonanywhere_com_wsgi.py

import os
import sys

path = u"/home/fatkur94/mysite"

if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

i start in bash with python3.5 -i /var/www/fatkur94_pythonanywhere_com_wsgi.py everything work fine, im stuck with this for couple of hours

hi there, do you have a settings.py at /home/fatkur94/mysite/mysite/settings.py?

and did you reload your webapp?

hi conrad, yeah, my settings.py is /home/fatkur94/mysite/mysite/settings.py , i did reload it several time, but it still same result & error.

i try to cange the code to be

path='/home/fatkur94/mysite'
sys.path.insert(path)

it still not working

that's baffling!

try sys.path.insert(0, path) instead of sys.path.append?