Discussion:
mod_wsgi can't find app to import..but I added path to wsgi file?!
Chris Seberino
2010-05-25 22:22:16 UTC
Permalink
I can successfully run a toy WSGI app with my Apache/mod_wsgi set up.

When I try to run my Django app with mod_wsgi it can't ever find the
modules to load and Apache's error.log gives ImportError's.

I tried adding paths to sys.path in the wsgi file.

Not what else to try.

cs
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Kenneth Gonsalves
2010-05-26 02:03:06 UTC
Permalink
Post by Chris Seberino
I tried adding paths to sys.path in the wsgi file.
you need to add the path to the *parent* directory of your project, and your
project should have __init__.py in every folder where there are python files
--
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Graham Dumpleton
2010-05-26 03:49:52 UTC
Permalink
Post by Kenneth Gonsalves
Post by Chris Seberino
I tried adding paths to sys.path in the wsgi file.
you need to add the path to the *parent* directory of your project, and your
project should have __init__.py in every folder where there are python files
And the directories/files must be readable by the user that Apache is
running the application as, ie., the Apache user, if you haven't used
daemon mode and run it as a different user.

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-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Chris Seberino
2010-05-27 15:06:30 UTC
Permalink
Post by Kenneth Gonsalves
you need to add the path to the *parent* directory of your project, and your
project should have __init__.py in every folder where there are python files
Thanks. I added __init__.py to an apache directory I created in my
project directory that includes the wsgi file.
Now Apache does NOT give me an error. Rather, now Apache just spins
and spins in some infinite loop never loading my django web page!?!?

No errors appear in the Apache error.log because it just spins waiting
to finish something.

....

Here is my wsgi file.....
================================================================

import sys
sys.path.append("/home/seb/MAIN")

import django.core.handlers.wsgi
import os

os.environ["DJANGO_SETTINGS_MODULE"] = "seoconquer.settings"
application =
django.core.handlers.wsgi.WSGIHandler()


Here is relevant part of my Apache config inside my vhosts......
================================================================

WSGIDaemonProcess seoconquer.com threads=25
WSGIProcessGroup seoconquer.com

WSGIScriptAlias /
\
/home/seb/MAIN/seoconquer/apache/
application.wsgi
<Directory /home/seb/MAIN/seoconquer/apache>
Order Allow,Deny
Allow from All
</Directory>


Any help still greatly appreciated as always.

Chris
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
backdoc
2010-05-27 15:20:40 UTC
Permalink
Check your apache logs.
Post by Chris Seberino
Post by Kenneth Gonsalves
you need to add the path to the *parent* directory of your project, and
your
Post by Kenneth Gonsalves
project should have __init__.py in every folder where there are python
files
Thanks. I added __init__.py to an apache directory I created in my
project directory that includes the wsgi file.
Now Apache does NOT give me an error. Rather, now Apache just spins
and spins in some infinite loop never loading my django web page!?!?
No errors appear in the Apache error.log because it just spins waiting
to finish something.
....
Here is my wsgi file.....
================================================================
import sys
sys.path.append("/home/seb/MAIN")
import django.core.handlers.wsgi
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "seoconquer.settings"
application =
django.core.handlers.wsgi.WSGIHandler()
Here is relevant part of my Apache config inside my vhosts......
================================================================
WSGIDaemonProcess seoconquer.com threads=25
WSGIProcessGroup seoconquer.com
WSGIScriptAlias /
\
/home/seb/MAIN/seoconquer/apache/
application.wsgi
<Directory /home/seb/MAIN/seoconquer/apache>
Order Allow,Deny
Allow from All
</Directory>
Any help still greatly appreciated as always.
Chris
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Chris Seberino
2010-05-27 15:20:22 UTC
Permalink
I fixed the path issue that was causing the spinning but now I'm back
to getting import errors even with __init__.py in my apache
directory. Here is the exact error from Apache's error.log.....

...
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]
_default = translation(settings.LANGUAGE_CODE)
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130] File "/
usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py",
line 194, in translation
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]
default_translation = _fetch(settings.LANGUAGE_CODE)
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130] File "/
usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py",
line 180, in _fetch
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130] app =
import_module(appname)
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130] File "/
usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in
import_module
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]
__import__(name)
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]
ImportError: No module named mvc
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Nuno Maltez
2010-05-27 15:51:12 UTC
Permalink
Post by Chris Seberino
ImportError: No module named mvc
What's the "mvc" module? Python can't seem to find it. Is it in your
python path?

Nuno
Post by Chris Seberino
I fixed the path issue that was causing the spinning but now I'm back
to getting import errors even with __init__.py in my apache
directory.  Here is the exact error from Apache's error.log.....
...
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]
_default = translation(settings.LANGUAGE_CODE)
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]   File "/
usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py",
line 194, in translation
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]
default_translation = _fetch(settings.LANGUAGE_CODE)
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]   File "/
usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py",
line 180, in _fetch
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]     app =
import_module(appname)
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]   File "/
usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in
import_module
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]
__import__(name)
[Thu May 27 10:18:18 2010] [error] [client 99.159.221.130]
ImportError: No module named mvc
--
You received this message because you are subscribed to the Google Groups "Django users" group.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Chris Seberino
2010-05-27 22:35:23 UTC
Permalink
Post by Nuno Maltez
Post by Chris Seberino
ImportError: No module named mvc
What's the "mvc" module? Python can't seem to find it. Is it in your
python path?
My project is called seoconquer.
My app is called mvc.
My absolute directory path to mvc is /home/seb/MAIN/seoconquer/mvc.

I have /home/seb/MAIN added to path in the wsgi file. (See above.)

I'm trying to load the mvc app in my settings file with INSTALLED_APPS
= (...., "seoconquer.mvc")

Here is my settings.py..

# Contains the configuration settings.

import os

DEBUG = True

DATABASE_NAME = "seoconquer"
DATABASE_USER = "seb"
DATABASE_ENGINE = "django.db.backends.mysql"
TEMPLATE_DIRS = ("/home/seb/MAIN/seoconquer/mvc/views",)
ROOT_URLCONF = DATABASE_NAME + "." + "urls"
LOGIN_URL = "sign_in"
INSTALLED_APPS = ("django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"seoconquer.mvc")

cs
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Graham Dumpleton
2010-05-27 23:56:50 UTC
Permalink
Post by Chris Seberino
Post by Nuno Maltez
Post by Chris Seberino
ImportError: No module named mvc
What's the "mvc" module? Python can't seem to find it. Is it in your
python path?
My project is called seoconquer.
My app is called mvc.
My absolute directory path to mvc is /home/seb/MAIN/seoconquer/mvc.
I have /home/seb/MAIN added to path in the wsgi file.  (See above.)
You also need to add '/home/seb/MAIN/seoconquer'. Read:

http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html

The __init__.py file in 'apache' subdirectory where WSGI script file
is not needed and will not do anything.

Graham
Post by Chris Seberino
I'm trying to load the mvc app in my settings file with INSTALLED_APPS
= (...., "seoconquer.mvc")
Here is my settings.py..
# Contains the configuration settings.
import os
DEBUG = True
DATABASE_NAME   = "seoconquer"
DATABASE_USER   = "seb"
DATABASE_ENGINE = "django.db.backends.mysql"
TEMPLATE_DIRS   = ("/home/seb/MAIN/seoconquer/mvc/views",)
ROOT_URLCONF    = DATABASE_NAME + "." + "urls"
LOGIN_URL       = "sign_in"
INSTALLED_APPS  = ("django.contrib.auth",
                   "django.contrib.contenttypes",
                   "django.contrib.sessions",
                   "seoconquer.mvc")
cs
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Chris Seberino
2010-05-28 21:19:48 UTC
Permalink
 http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
I tried both versions of the wsgi script on your blog. And I still get
this same error.....

ImportError: No module named mvc

I think the problem is this line in settings.py where it can't find
seoconquer.mvc to load.

I printed the vars on your blog from withing my settings.py if that
helps...

__name__ =seoconquer.settings
__file__ =/home/seb/MAIN/seoconquer/settings.py
os.getcwd() =/home/www
os.curdir =.
sys.path =['/home/seb/MAIN', '/home/seb/MAIN/seoconquer',...etc.]
sys.modules.keys() =['django.utils.text', 'decimal',
'django.core.django',...etc.]
sys.modules.has_key('seoconquer') =True

Notice that both necessary paths are in sys.path?!?!!?

cs
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Graham Dumpleton
2010-05-28 21:52:40 UTC
Permalink
In '/home/seb/MAIN/seoconquer', can you do:

ls -las

ls -las mvc

and post the output.

If you are concerned about revealing details send it to my email
direct.

Graham
Post by Chris Seberino
 http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
I tried both versions of the wsgi script on your blog. And I still get
this same error.....
ImportError: No module named mvc
I think the problem is this line in settings.py where it can't find
seoconquer.mvc to load.
I printed the vars on your blog from withing my settings.py if that
helps...
__name__ =seoconquer.settings
__file__ =/home/seb/MAIN/seoconquer/settings.py
os.getcwd() =/home/www
os.curdir =.
sys.path =['/home/seb/MAIN', '/home/seb/MAIN/seoconquer',...etc.]
sys.modules.keys() =['django.utils.text', 'decimal',
'django.core.django',...etc.]
sys.modules.has_key('seoconquer') =True
Notice that both necessary paths are in sys.path?!?!!?
cs
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Loading...