Hello

I have been trying to get Django working with Hostmonster.com shared
webhosting with FCGI.

>From what I gather from the HM forums, this is possible, but I've been
hitting some issues.

I've installed Python 2.6.2 in my home directory, and by all accounts,
its working.

I've downloaded Django from SVN (revision 11375)

If I create a project, and an app, I can run it by
>> ~/local/bin/python manage.py runserver

This gives me a server running at 127.0.0.1:8000 ..  which I can get
to if I telnet locally (lynx is b0rked, dunno why, not really part of
this problem here).

Configure the FCGI app, and .htaccess, as described at
http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache
and elaborated on at 
http://www.hostmonsterforum.com/showpost.php?p=15030&postcount=4,
I can get it to generate an internal exception.

Run the fgci script at a shell, and I get:
timat...@host280:~/public_html/django$ ./mysite.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Traceback (most recent call last):
  File "/home2/timatlee/local/lib/python2.6/site-packages/
flup-1.0.3.dev_20090716-py2.6.egg/flup/server/fcgi_base.py", line 558,
in run
    protocolStatus, appStatus = self.server.handler(self)
  File "/home2/timatlee/local/lib/python2.6/site-packages/
flup-1.0.3.dev_20090716-py2.6.egg/flup/server/fcgi_base.py", line
1118, in handler
    result = self.application(environ, start_response)
  File "/home2/timatlee/djtrunk/django/core/handlers/wsgi.py", line
230, in __call__
    self.load_middleware()
  File "/home2/timatlee/djtrunk/django/core/handlers/base.py", line
33, in load_middleware
    for middleware_path in settings.MIDDLEWARE_CLASSES:
  File "/home2/timatlee/djtrunk/django/utils/functional.py", line 269,
in __getattr__
    self._setup()
  File "/home2/timatlee/djtrunk/django/conf/__init__.py", line 40, in
_setup
    self._wrapped = Settings(settings_module)
  File "/home2/timatlee/djtrunk/django/conf/__init__.py", line 75, in
__init__
    raise ImportError, "Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e)
ImportError: Could not import settings 'myproject.settings' (Is it on
sys.path? Does it have syntax errors?): No module named
myproject.settings

..  which is to say, it fails just the same as if I went to the
website.

mysite.fcgi looks like:
#!/home2/timatlee/local/bin/python
import sys, os

# Add a custom Python path.
# sys.path.insert(0, "/home/user/python")
sys.path.insert(0, "/home2/timatlee/local/bin/python")
sys.path.insert(0, "/home2/timatlee/local/lib/python2.6/site-packages/
flup-1.0.3.dev_20090716-py2.6.egg")
sys.path.insert(0, "/home2/timatlee/local/lib/python2.6")
sys.path.insert(0, "/home2/timatlee/djcode")
sys.path.insert(0, "/home2/timatlee/djcode/mysite")
sys.path.insert(0, "/home2/timatlee/djtrunk")

# Switch to the directory of your project. (Optional.)
os.chdir("/home2/timatlee/djcode/mysite")

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")



myproject.settings exists in /home2/timatlee/djcode/mysite, which from
what I can tell is on the path.

If I set os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings"
to be the absolute path of the file, I get the following as an error:
ImportError: Could not import settings '/home2/timatlee/djcode/mysite/
myproject.settings' (Is it on sys.path? Does it have syntax errors?):
Import by filename is not supported.


So if I truncate myproject.settings, I see no change.  If I make
myproject.settings a copy of settings.py (which is what I thought this
file was supposed to be), I'm at where I am right now.

I'm sure it's something plainly obvious, but I've overlooked...

Any help would be appreciated.

Thanks!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to