Copied django project to shared host from repo - can't find settings
Question: I setup Django successfully on my shared Bluehost account following the
tutorial below: <http://www.nyayapati.com/srao/2012/08/setup-python-2-7-and-
django-1-4-on-bluehost/>

I am now having problems with a Django project I have copied from a GitHub
repo to my Bluehost directory. I am getting this error when I run python
mysite.fcgi in my virtualenv

    
    
    go-1.5.1-py2.7.egg/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 'mysite.settings' (Is it on sys.path?): No module named settings
    

Any thoughts on where to look for errors? I have checked .htaccess and the
mysite.fcgi file in my www directory, the pointer to settings in my manage.py
and these seem as they should be. Running python manage.py runserver on the
project says there are no errors.

Lee


Answer: Thanks to sacrac on the django listserve I got the answer - I needed to make
my mysite.fcgi file in my www directory look like this:

    
    
    #!/home5/myorg/.virtualenvs/mydjango/bin/python
    import sys, os
    
    # Add a custom Python path.
    sys.path.insert(0, "/home/<user_name>/projects/")
    sys.path.insert(0, "/home/<user_name>/projects/yourproyect")
    
    from flup.server.fcgi import WSGIServer
    os.environ['DJANGO_SETTINGS_MODULE'] = '<project_name>.settings'
    from django.core.handlers.wsgi import WSGIHandler
    WSGIServer(WSGIHandler()).run()
    

Not sure why this works, but it did.

