I am using Apache 2.2.14 (from source) ./configure --enable-so --with-
mpm=worker --with-apr=/usr/local/bin/apr-1-config
apr-1.3.9 (from source) ./configure --prefix=/usr/local --enable-
threads
apr-util-1.3.9 (from source)./configure --with-apr=/usr/local/bin/
apr-1-config
Python 2.6.4 (from source) ./configure --with-threads --enable-shared
--prefix=/usr/local
mod_wsgi 3.1 (from source) ./configure --with-python=/usr/local/bin/
python2.6 --with-apxs=/usr/local/apache2/bin/apxs
on Centos 5.4.
Below I have the relevant apache config file and the error log.
If I use any other user than myuser ( which is the user that owns the
myurl project ) I get "ImportError: No module named
django.core.handlers.wsgi". I would like to be able to use other users
that do not have shell access or home directories.
What are the files and directories that need to have permissions set
to that of the daemon process user? I am assuming that this is a
permissions problem, since when I change user=myuser in the
WSGIDaemonProcess directive, my site works.
I have read:
http://code.google.com/p/modwsgi/wiki/ApplicationIssues
But I do not know how to set up permissions to get my site working
with daemon mode using other users that do not have home directories
or shell access, including the apache User- in this case 'beet'.
Any hints would be greatly appreciated.
####### WSGI script
import sys, os
sys.path.append('/var/www/django-projects')
sys.path.append('/var/www/django-projects/myurl')
os.environ['DJANGO_SETTINGS_MODULE'] = 'myurl.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
########### APACHE CONFIG
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User beet
Group beet
</IfModule>
</IfModule>
LoadModule wsgi_module /usr/local/apache2/modules/mod_wsgi.so
WSGIPythonHome /usr/local
ServerLimit 16
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
WSGISocketPrefix /var/run/wsgi
<VirtualHost 123.123.123.123:80>
ServerName myurl.com
DocumentRoot /var/www/myurl_htdocs/
WSGIDaemonProcess myurl processes=2 threads=15 display-name=%
{GROUP} user=beet
WSGIProcessGroup myurl
WSGIScriptAlias / /var/www/myurl_htdocs/myurl/apache/django.wsgi
<Directory /var/www/django-projects/myurl/apache>
Options -Indexes
Order allow,deny
Allow from all
</Directory>
###################
############ error_log
[Sat Dec 26 02:31:05 2009] [notice] Apache/2.2.14 (Unix) mod_wsgi/3.1
Python/2.6.4 configured -- resuming normal operations
[Sat Dec 26 02:31:05 2009] [info] Server built: Dec 24 2009 23:11:42
[Sat Dec 26 02:31:05 2009] [debug] worker.c(1740): AcceptMutex:
sysvsem (default: sysvsem)
[Sat Dec 26 02:31:05 2009] [info] mod_wsgi (pid=15262): Attach
interpreter ''.
[Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321] mod_wsgi
(pid=15259): Target WSGI script '/var/www/django-projects/myurl/
apache/
django.wsgi' cannot be loaded as Python module.
[Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321] mod_wsgi
(pid=15259): Exception occurred processing WSGI script '/var/www/
django-projects/myurl/apache/django.wsgi'.
[Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321] Traceback
(most recent call last):
[Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321] File "/
var/www/django-projects/myurl/apache/django.wsgi", line 13, in
<module>
[Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321] import
django.core.handlers.wsgi
[Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321]
ImportError: No module named django.core.handlers.wsgi
All I can really do is suggest you read up on how UNIX user/group
permissions work for file system access. Perhaps start with:
http://en.wikipedia.org/wiki/File_system_permissions
The user that applications runs as under Apache must have adequate
read/search permission to the file system directories down to where
the application and any modules it depends on are stored, as well as
having read permission to the files in the directory. If the
application needs to write data, the user that applications runs as
under Apache would also need write access to the directories where the
data needs to be written.
Beyond that can't tell you want to do as you don't say anything about
what your directories/files permissions are set to currently.
Graham
> ###########
> # error_log
>
> [Sat Dec 26 02:31:05 2009] [notice] Apache/2.2.14 (Unix) mod_wsgi/3.1
> Python/2.6.4 configured -- resuming normal operations
> [Sat Dec 26 02:31:05 2009] [info] Server built: Dec 24 2009 23:11:42
> [Sat Dec 26 02:31:05 2009] [debug] worker.c(1740): AcceptMutex:
> sysvsem (default: sysvsem)
> [Sat Dec 26 02:31:05 2009] [info] mod_wsgi (pid=15262): Attach
> interpreter ''.
> [Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321] mod_wsgi
> (pid=15259): Target WSGI script '/var/www/django-projects/myurl/apache/
> django.wsgi' cannot be loaded as Python module.
> [Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321] mod_wsgi
> (pid=15259): Exception occurred processing WSGI script '/var/www/
> django-projects/myurl/apache/django.wsgi'.
> [Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321] Traceback
> (most recent call last):
> [Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321] File "/
> var/www/django-projects/myurl/apache/django.wsgi", line 13, in
> <module>
> [Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321] import
> django.core.handlers.wsgi
> [Sat Dec 26 02:31:15 2009] [error] [client 321.321.321.321]
> ImportError: No module named django.core.handlers.wsgi
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "modwsgi" group.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to modwsgi+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
>
>
>
/usr/local/lib/python2.6/site-packages/django was a symlink to a
django-trunk directory in /home/myuser/
obviously, other users cannot read or search for files in that users
home directory. Buy myuser could; that is why it worked for
user=myuser and that is why wsgi scripts not importing django would
work as well.
I changed /usr/loca/lib/python2.6/site-packages/django to a hard copy
of the contents of django-trunk.
On Dec 26, 1:56 am, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> 2009/12/26 stuntgoat <hyperne...@gmail.com>: