Forums

Problems with sys path .... I think

Hello,

I have made sure to provide the full path for my settings.py in the .wsgi file, however it still cannot be found on my system path. Am I doing something wrong here? I have been at this for quite awhile now ... here is my wsgi file:

import os 
import sys

path = '/home/jordanhourani/killed-animal-reporter/killedanimalreporter'

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

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

import django.core.handlers.wsgi 
application = django.core.handlers.wsgi.WSGIHandler()

That config will work if the path to your settings file is

/home/jordanhourani/killed-animal-reporter/killedanimalreporter/killedanimalreporter/settings.py

If it's just

/home/jordanhourani/killed-animal-reporter/killedanimalreporter/settings.py

then you need

path = '/home/jordanhourani/killed-animal-reporter'

because you're specifying the settings module as killedanimalreporter.settings...

yep, that was it. thank you I was going crazy over that! :)

no worries. sys.path and import issues are often tricky!