Re: Apache and mod_wsgi on Ubuntu

2009-08-05 Thread Steve1234

Thanks, I got it working. I searched this forum and I even read the
page referenced but still missed the answer. Thanks again this forum
is very helpful.
The fix was to add one line to the django.wsgi file to end up with
this:

import os
import sys
sys.path.append('/home/steve)
sys.path.append('/home/steve/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Apache and mod_wsgi on Ubuntu

2009-08-04 Thread Graham Dumpleton



On Aug 5, 10:27 am, Malcolm Tredinnick 
wrote:
> On Tue, 2009-08-04 at 17:12 -0700, Steve1234 wrote:
> > I am trying to setup Apache and mod_wsgi on Ubuntu to run Django
> > content. I generated a minimum project using "django-admin.py
> > startproject mysite" creating the project in my home folder. Running
> > the development server works and shows the "get started" page.  But
> > the "production" setup returns "Internal Server Error".  The Apache
> > error.log file reports:
>
> > ImportError: Could not import settings 'mysite.settings' (Is it on
> > sys.path? Does it have syntax errors?): No module named
> > mysite.settings
>
> > My /etc/apache2/httpd.conf file has one line:
> > WSGIScriptAlias / /home/steve/mysite/apache/django.wsgi
>
> > And the file /home/steve/mysite/apache/django.wsgi has 6 lines:
> > import os
> > import sys
> > sys.path.append('/home/steve/mysite')
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
> > import django.core.handlers.wsgi
> > application = django.core.handlers.wsgi.WSGIHandler()
>
> > Any idea what I am doing wrong?
>
> You've set the Python path incorrectly.
>
> This is easily the most common error people make and I'm surprised you
> didn't find it in the searches you did in the archives before posting.
> This isn't anything Django specific. The Python path contains the
> directories from which imports are started. So if you want to import
> something called "mysite" it has to exist inside one of the directories
> on the Python path.

And it is highlighted in:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

What seems to happen though is people only look at the page in Django
documentation which isn't so clear, or rely on some arbitrary persons
blog to work out how to set it up. :-(

Graham
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Apache and mod_wsgi on Ubuntu

2009-08-04 Thread Malcolm Tredinnick

On Tue, 2009-08-04 at 17:12 -0700, Steve1234 wrote:
> I am trying to setup Apache and mod_wsgi on Ubuntu to run Django
> content. I generated a minimum project using "django-admin.py
> startproject mysite" creating the project in my home folder. Running
> the development server works and shows the "get started" page.  But
> the "production" setup returns "Internal Server Error".  The Apache
> error.log file reports:
> 
> ImportError: Could not import settings 'mysite.settings' (Is it on
> sys.path? Does it have syntax errors?): No module named
> mysite.settings
> 
> My /etc/apache2/httpd.conf file has one line:
> WSGIScriptAlias / /home/steve/mysite/apache/django.wsgi
> 
> And the file /home/steve/mysite/apache/django.wsgi has 6 lines:
> import os
> import sys
> sys.path.append('/home/steve/mysite')
> os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
> 
> Any idea what I am doing wrong?

You've set the Python path incorrectly.

This is easily the most common error people make and I'm surprised you
didn't find it in the searches you did in the archives before posting.
This isn't anything Django specific. The Python path contains the
directories from which imports are started. So if you want to import
something called "mysite" it has to exist inside one of the directories
on the Python path.

Regards,
Malcolm


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Apache and mod_wsgi on Ubuntu

2009-08-04 Thread Steve1234

I am trying to setup Apache and mod_wsgi on Ubuntu to run Django
content. I generated a minimum project using "django-admin.py
startproject mysite" creating the project in my home folder. Running
the development server works and shows the "get started" page.  But
the "production" setup returns "Internal Server Error".  The Apache
error.log file reports:

ImportError: Could not import settings 'mysite.settings' (Is it on
sys.path? Does it have syntax errors?): No module named
mysite.settings

My /etc/apache2/httpd.conf file has one line:
WSGIScriptAlias / /home/steve/mysite/apache/django.wsgi

And the file /home/steve/mysite/apache/django.wsgi has 6 lines:
import os
import sys
sys.path.append('/home/steve/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Any idea what I am doing wrong?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---