[modwsgi] win32 modwsgi error: ImportError: DLL load failed

2009-04-15 Thread chunlin

Apache Version :Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/
0.9.8e mod_autoindex_color mod_auth_sspi/1.0.4 SVN/1.4.3 mod_wsgi/2.4
Python/2.6.1 PHP/5.2.4

the mod_wsgi I am using is this one:
http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-win32-ap22py26-2.4.so

I have add these code to moin.wsgi but still same err

sys.path.insert(0, r'D:\Python26\Lib\site-packages')
sys.path.insert(0, r'D:\Python26\Lib\site-packages\MoinMoin')
sys.path.insert(0, r'D:\Python26\DLLs')


err message:
[error] mod_wsgi (pid=3056): Target WSGI script 'E:/Moin/moin/
moin.wsgi' cannot be loaded as Python module.
[error] mod_wsgi (pid=3056): Exception occurred processing WSGI script
'E:/Moin/moin/moin.wsgi'.
[error] Traceback (most recent call last):
[error]   File E:/Moin/moin/moin.wsgi, line 52, in module
[error] from MoinMoin.server.server_wsgi import WsgiConfig,
moinmoinApp
[error]   File D:\\Python26\\Lib\\site-packages\\MoinMoin\\server\
\__init__.py, line 14, in module
[error] from MoinMoin import log
[error]   File D:\\Python26\\Lib\\site-packages\\MoinMoin\\log.py,
line 92, in module
[error] import logging.config
[error]   File D:\\Python26\\lib\\logging\\config.py, line 30, in
module
[error] import sys, logging, logging.handlers, string, socket,
struct, os, traceback, types
[error]   File D:\\Python26\\lib\\logging\\handlers.py, line 30, in
module
[error] import logging, socket, types, os, string, cPickle,
struct, time, re
[error]   File D:\\Python26\\lib\\socket.py, line 46, in module
[error] import _socket
[error] ImportError: DLL load failed: The specified module could not
be found.

Thanks!!

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



[modwsgi] Re: Django virtualenv mod_wsgi, can't import django.*

2009-04-15 Thread Graham Dumpleton

2009/4/15 Alen Ribic alen.ri...@gmail.com:

 I've seen a few posts related to Django, virtualenv and mod_wsgi
 however still can't solve my problem.

 I keep getting ImportError: No module named
 django.core.handlers.wsgi in my apache error log no matter what I
 try.

Read:

  
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Access_Rights_Of_Apache_User

Apache runs as a special user . If you are using embedded mode, or
daemon mode but haven't set 'user' option to be your account, then may
not be able to read directories/files if permissions on them aren't
correct.

Try your command line test, but become the user that Apache runs as
first. If that fails you know this is the problem.

In your command line test from your account, also do:

  import django
  print django.__file__

Ensure that that is the version you want used. Then check that all the
files readable to others and that directories readable and searchable
to others. For directories, this includes directories back up the
hierarchy to root of file system.

Graham


 Here is the wsgi script:

  intrack.wsgi 
 import os, sys, site

 import logging

 #create logger
 logger = logging.getLogger(intrack_wsgi)

 logger.setLevel(logging.DEBUG)

 fh = logging.FileHandler(/tmp/InTrackWSGI.log)
 fh.setLevel(logging.DEBUG)

 formatter = logging.Formatter(%(asctime)s - %(name)s - %(levelname)s
 - %(message)s)

 fh.setFormatter(formatter)
 logger.addHandler(fh)

 sys.path.append('/home/intrack/intrack_pythonenv/projects')
 sys.path.append('/home/intrack/intrack_pythonenv/projects/InTrack')
 os.environ['DJANGO_SETTINGS_MODULE'] = 'InTrack.settings'

 ALLDIRS = ['/home/intrack/intrack_pythonenv/lib/python2.5/site-
 packages']

 # Remember original sys.path.
 prev_sys_path = list(sys.path)

 # Add each new site-packages directory.
 for directory in ALLDIRS:
  site.addsitedir(directory)

 # Reorder sys.path so new directories at the front.
 new_sys_path = []
 for item in list(sys.path):
    #logger.debug(sys.path item: %s % item)
    if item not in prev_sys_path:
        new_sys_path.append(item)
        sys.path.remove(item)
 sys.path[:0] = new_sys_path

 logger.debug(sys.path)
 logger.debug(exec_prefix: %s % sys.exec_prefix)
 logger.debug(version: %s % sys.version)

 import django.core.handlers.wsgi

 application = django.core.handlers.wsgi.WSGIHandler()

  end - intrack.wsgi 

  apache wsgi.conf
 #
 WSGIScriptAlias / /var/www/wsgi_scripts/InTrack.wsgi
  end - apache wsgi.conf
 

  apache error log 
 [Wed Apr 15 12:04:29 2009] [error] [client 10.10.0.47] Traceback (most
 recent call last):
 [Wed Apr 15 12:04:29 2009] [error] [client 10.10.0.47]   File /var/
 www/wsgi_scripts/InTrack.wsgi, line 44, in module
 [Wed Apr 15 12:04:29 2009] [error] [client 10.10.0.47]     import
 django.core.handlers.wsgi
 [Wed Apr 15 12:04:29 2009] [error] [client 10.10.0.47] ImportError: No
 module named django.core.handlers.wsgi
 [Wed Apr 15 12:04:32 2009] [error] [client 10.10.0.47] mod_wsgi
 (pid=3610): Target WSGI script '/var/www/wsgi_scripts/InTrack.wsgi'
 cannot be loaded as Python module.
 [Wed Apr 15 12:04:32 2009] [error] [client 10.10.0.47] mod_wsgi
 (pid=3610): Exception occurred processing WSGI script '/var/www/
 wsgi_scripts/InTrack.wsgi'.
 [Wed Apr 15 12:04:32 2009] [error] [client 10.10.0.47] Traceback (most
 recent call last):
 [Wed Apr 15 12:04:32 2009] [error] [client 10.10.0.47]   File /var/
 www/wsgi_scripts/InTrack.wsgi, line 44, in module
 [Wed Apr 15 12:04:32 2009] [error] [client 10.10.0.47]     import
 django.core.handlers.wsgi
 [Wed Apr 15 12:04:32 2009] [error] [client 10.10.0.47] ImportError: No
 module named django.core.handlers.wsgi
  end - apache error log
 

  wsgi script log 
 2009-04-15 12:14:13,938 - intrack_wsgi - DEBUG - ['/home/intrack/
 intrack_pythonenv/lib/python2.5/site-packages', '/usr/local/lib/
 python25.zip', '/usr/local/lib/python2.5', '/usr/local/lib/python2.5/
 plat-linux2', '/usr/local/lib/python2.5/lib-tk', '/usr/local/lib/
 python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/
 home/intrack/intrack_pythonenv/projects', '/home/intrack/
 intrack_pythonenv/projects/InTrack', '/home/intrack/intrack_pythonenv/
 projects', '/home/intrack/intrack_pythonenv/projects/InTrack', '/home/
 intrack/intrack_pythonenv/lib/python2.5/site-packages']
 2009-04-15 12:14:13,939 - intrack_wsgi - DEBUG - exec_prefix: /usr/
 local
 2009-04-15 12:14:13,939 - intrack_wsgi - DEBUG - version: 2.5.4
 (r254:67916, Apr 14 2009, 15:48:34)
 [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]
  end - wsgi script log
 

 I tried this, from the command shell, running the 

[modwsgi] Re: win32 modwsgi error: ImportError: DLL load failed

2009-04-15 Thread chunlin

I just check my python installation,found the directory is C:
\Documents and Settings\All Users\...\Python 2.6,so I chose All
Users.
And I always using a Administrator privilege account(a windows user's
usual habbit...).

So I had better turn back to python 2.5...:(

On Apr 15, 7:21 pm, Graham Dumpleton graham.dumple...@gmail.com
wrote:
 Hmmm, I tell a lie. SInce Python 2.6.2 only just got released, the
 Apache module must have been compiled against Python 2.6.1. Can't be
 bothered starting up Windows at the moment to check.

 Anyway, would suggest your problem is therefore likely to be due to
 Python not being installed so as to be available to all users. So,
 reinstall it as user with Administrator rights and install it for all
 users when prompted.

 Graham

 2009/4/15 Graham Dumpleton graham.dumple...@gmail.com:

  2009/4/15 chunlin zhangchun...@gmail.com:

  Apache Version :Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/
  0.9.8e mod_autoindex_color mod_auth_sspi/1.0.4 SVN/1.4.3 mod_wsgi/2.4
  Python/2.6.1 PHP/5.2.4

  the mod_wsgi I am using is this one:
 http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-win32...

  I have add these code to moin.wsgi but still same err
  
  sys.path.insert(0, r'D:\Python26\Lib\site-packages')
  sys.path.insert(0, r'D:\Python26\Lib\site-packages\MoinMoin')
  sys.path.insert(0, r'D:\Python26\DLLs')
  

  err message:
  [error] mod_wsgi (pid=3056): Target WSGI script 'E:/Moin/moin/
  moin.wsgi' cannot be loaded as Python module.
  [error] mod_wsgi (pid=3056): Exception occurred processing WSGI script
  'E:/Moin/moin/moin.wsgi'.
  [error] Traceback (most recent call last):
  [error]   File E:/Moin/moin/moin.wsgi, line 52, in module
  [error]     from MoinMoin.server.server_wsgi import WsgiConfig,
  moinmoinApp
  [error]   File D:\\Python26\\Lib\\site-packages\\MoinMoin\\server\
  \__init__.py, line 14, in module
  [error]     from MoinMoin import log
  [error]   File D:\\Python26\\Lib\\site-packages\\MoinMoin\\log.py,
  line 92, in module
  [error]     import logging.config
  [error]   File D:\\Python26\\lib\\logging\\config.py, line 30, in
  module
  [error]     import sys, logging, logging.handlers, string, socket,
  struct, os, traceback, types
  [error]   File D:\\Python26\\lib\\logging\\handlers.py, line 30, in
  module
  [error]     import logging, socket, types, os, string, cPickle,
  struct, time, re
  [error]   File D:\\Python26\\lib\\socket.py, line 46, in module
  [error]     import _socket
  [error] ImportError: DLL load failed: The specified module could not
  be found.

  This problem has been solved before by reinstalling Python, but using
  Python 2.6.2.

  When you install it, it must be installed from an account with
  Administrator privilege and you must select that it be installed for
  all users.

  Not sure yet whether it relates to fact that mod_wsgi precompiled
  module was built against Python 2.6.2, or that it is because of your
  existing Python installation not being installed as an account with
  Administrator privilege and/or not selecting that it be installed for
  all users.

  Would be nice if someone can indicate whether they are successfully
  using this precompiled mod_wsgi with Python 2.6.1 rather than newer
  Python 2.6.2.

  If you can say whether you installed your Python from an account with
  Administrator privilege and whether you selected install for all
  users, would also be useful.

  The reason that Python must be installed for all users is that Apache
  service runs as special user normally and not as you.

  Graham


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



[modwsgi] Re: Django virtualenv mod_wsgi, can't import django.*

2009-04-15 Thread Alen Ribic

Thank you Graham for your reply.

You are definitely right about the permissions.
Apache User and Group directives are both set to 'apache'.
My wsgi (django) application is in the /home/intrack which is the
'intrack' user.

I added the WSGIDaemonProcess directive:
#
WSGIDaemonProcess user=intrack group=intrack python-path=/home/intrack/
intrack_pythonenv/lib/python2.5/site-packages processes=2 threads=25
#
WSGIScriptAlias / /var/www/wsgi_scripts/InTrack.wsgi

That still gave me a same error  ImportError: No module named
django.core.handlers.wsgi

Question: who is the .wsgi script ran by? Apache special user? or the
one defined on WSGIDaemonProcess (in my case 'intrack' user)?

Also, am I on the right track here using WSGIDaemonProcess to set the
user I wish to run the application as? (I have fully tested the django
application using the 'intrack' user. By the way, /home/intrack has
the django app and the python virtual environment.)

I started the httpd service as root by the way.

Is perhaps the WSGIDaemonProcess not using the intrack user to run the
python process?

-Alen


On Apr 15, 12:35 pm, Graham Dumpleton graham.dumple...@gmail.com
wrote:
 2009/4/15 Alen Ribic alen.ri...@gmail.com:



  I've seen a few posts related to Django, virtualenv and mod_wsgi
  however still can't solve my problem.

  I keep getting ImportError: No module named
  django.core.handlers.wsgi in my apache error log no matter what I
  try.

 Read:

  http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Access_Rights...

 Apache runs as a special user . If you are using embedded mode, or
 daemon mode but haven't set 'user' option to be your account, then may
 not be able to read directories/files if permissions on them aren't
 correct.

 Try your command line test, but become the user that Apache runs as
 first. If that fails you know this is the problem.

 In your command line test from your account, also do:

   import django
   print django.__file__

 Ensure that that is the version you want used. Then check that all the
 files readable to others and that directories readable and searchable
 to others. For directories, this includes directories back up the
 hierarchy to root of file system.

 Graham



  Here is the wsgi script:

   intrack.wsgi 
  import os, sys, site

  import logging

  #create logger
  logger = logging.getLogger(intrack_wsgi)

  logger.setLevel(logging.DEBUG)

  fh = logging.FileHandler(/tmp/InTrackWSGI.log)
  fh.setLevel(logging.DEBUG)

  formatter = logging.Formatter(%(asctime)s - %(name)s - %(levelname)s
  - %(message)s)

  fh.setFormatter(formatter)
  logger.addHandler(fh)

  sys.path.append('/home/intrack/intrack_pythonenv/projects')
  sys.path.append('/home/intrack/intrack_pythonenv/projects/InTrack')
  os.environ['DJANGO_SETTINGS_MODULE'] = 'InTrack.settings'

  ALLDIRS = ['/home/intrack/intrack_pythonenv/lib/python2.5/site-
  packages']

  # Remember original sys.path.
  prev_sys_path = list(sys.path)

  # Add each new site-packages directory.
  for directory in ALLDIRS:
   site.addsitedir(directory)

  # Reorder sys.path so new directories at the front.
  new_sys_path = []
  for item in list(sys.path):
     #logger.debug(sys.path item: %s % item)
     if item not in prev_sys_path:
         new_sys_path.append(item)
         sys.path.remove(item)
  sys.path[:0] = new_sys_path

  logger.debug(sys.path)
  logger.debug(exec_prefix: %s % sys.exec_prefix)
  logger.debug(version: %s % sys.version)

  import django.core.handlers.wsgi

  application = django.core.handlers.wsgi.WSGIHandler()

   end - intrack.wsgi 

   apache wsgi.conf
  #
  WSGIScriptAlias / /var/www/wsgi_scripts/InTrack.wsgi
   end - apache wsgi.conf
  

   apache error log 
  [Wed Apr 15 12:04:29 2009] [error] [client 10.10.0.47] Traceback (most
  recent call last):
  [Wed Apr 15 12:04:29 2009] [error] [client 10.10.0.47]   File /var/
  www/wsgi_scripts/InTrack.wsgi, line 44, in module
  [Wed Apr 15 12:04:29 2009] [error] [client 10.10.0.47]     import
  django.core.handlers.wsgi
  [Wed Apr 15 12:04:29 2009] [error] [client 10.10.0.47] ImportError: No
  module named django.core.handlers.wsgi
  [Wed Apr 15 12:04:32 2009] [error] [client 10.10.0.47] mod_wsgi
  (pid=3610): Target WSGI script '/var/www/wsgi_scripts/InTrack.wsgi'
  cannot be loaded as Python module.
  [Wed Apr 15 12:04:32 2009] [error] [client 10.10.0.47] mod_wsgi
  (pid=3610): Exception occurred processing WSGI script '/var/www/
  wsgi_scripts/InTrack.wsgi'.
  [Wed Apr 15 12:04:32 2009] [error] [client 10.10.0.47] Traceback (most
  recent call last):
  [Wed Apr 15 12:04:32 2009] [error] [client 10.10.0.47]   File /var/
  www/wsgi_scripts/InTrack.wsgi, line 44, in module
  [Wed Apr 15 12:04:32 2009] [error] [client 10.10.0.47]     

[modwsgi] Re: Intermittent NoReverseMatch errors

2009-04-15 Thread Alex Robbins

I am seeing this same error. I tried a little bit of experimentation.
Does this give you any clues as to what might be happening?

I wrote a script that runs through the same list of urls (58) on my
site.
Every run produces different errors and different numbers of errors,
but some setups seem more error prone than others.

WSGIDaemonProcess project threads=2 maximum-requests=1
17 errors

WSGIDaemonProcess project threads=1 maximum-requests=1
0 errors

WSGIDaemonProcess project threads=2 maximum-requests=10
4 errors

WSGIDaemonProcess project threads=2 maximum-requests=100
0-1 error Depending on the run.

WSGIDaemonProcess project threads=20 maximum-requests=10
11 errors

WSGIDaemonProcess project threads=20 maximum-requests=1
29 errors and also 4 404s ???

Thanks,
Alex

On Mar 19, 12:58 am, Graham Dumpleton graham.dumple...@gmail.com
wrote:
 2009/3/19 Graham Dumpleton graham.dumple...@gmail.com:



  2009/3/19 Pete sgt.hu...@gmail.com:

  On Mar 18, 3:35 pm, Graham Dumpleton graham.dumple...@gmail.com
  wrote:

  This is not an error from mod_wsgi but from Django and has been
  encountered by various people and not just with mod_wsgi.

  Thanks Graham. I dug through a number of Django references before
  posting here. I'm on Django 1.0.X so Django ticket #8221 has been
  fixed and you'll notice that no arguments are being sent to the
  reverse (as expected) so it is not a regex urlresolver issue. I can
  view the same page w/ the same content hundreds of times without
  having an issue, but every day or 2 I get the error.

  The reason I bring it up here is that the only common thread I can
  find is the mod_wsgi activity in my Apache error log (pasted in the
  original email) about it loading the wsgi script at the same time the
  error occurs. Does mod_wsgi reload the script when 500s are
  encountered?

  No.

  But, by your configuration you have:

   maximum-requests=500 inactivity-timeout=600

  This means the daemon processes are restarted every 500 requests. This
  is a quite low value and wouldn't recommend it. One would only even
  use this option if your application has a problem with memory leaks,
  either explicit or through a poorly written caching system. So, why
  are you usingmaximum requestsoption?

  The inactivity timeout would only kick in after 10 minutes of no
  requests at all and if your application is used a lot, in practice
  shouldn't ever occur. What was your reasoning for setting the
  inactivity timeout?

  If not, is it possible for unexpected behavior to occur
  if we try to access the app during the wsgi script load process?

  No, not at least due to an access occurring while the reloading is
  happening, as requests will just be queued.

  Your problem could be though that you are missing a required import
  dependency. That is, something which maps strings to module/functions
  is being triggered without the module it requires to work not having
  been imported. It may work later in the life of the process because
  something has as a side effect later imported it. Thus you have an
  ordering issue and whether things works depends order URLs are
  requested. I give imports here as a possibility, may it may be some
  other form of initialisation.

 BTW, one way of checking for whether it is an issue with the order in
 which URLs are visited, is to use:

   WSGIDaemonProcess project processes=5 threads=1maximum-requests=1

 It may be slow, but it will result in every request being handled in
 new process, ie., CGI like. Use your application and see if you hit a
 specific URL which consistently fails with the error. That is, it is
 showing you problem URLs whose environment isn't set up properly for
 them to run properly.

 Graham

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



[modwsgi] Re: win32 modwsgi error: ImportError: DLL load failed

2009-04-15 Thread Graham Dumpleton

2009/4/15 chunlin zhangchun...@gmail.com:

 I just check my python installation,found the directory is C:
 \Documents and Settings\All Users\...\Python 2.6,so I chose All
 Users.

That isn't necessarily sufficient indication as there are registry
entries as well and is is those which are more of an issue as they
define the directories to look for stuff.

If you are going to reinstall anythng, install newer Python 2.6.2.
Don't go back to Python 2.5 as don't supply latest mod_wsgi.so for
that version of Python.

So, just try the reinstall of Python like suggested.

Graham

 And I always using a Administrator privilege account(a windows user's
 usual habbit...).

 So I had better turn back to python 2.5...:(

 On Apr 15, 7:21 pm, Graham Dumpleton graham.dumple...@gmail.com
 wrote:
 Hmmm, I tell a lie. SInce Python 2.6.2 only just got released, the
 Apache module must have been compiled against Python 2.6.1. Can't be
 bothered starting up Windows at the moment to check.

 Anyway, would suggest your problem is therefore likely to be due to
 Python not being installed so as to be available to all users. So,
 reinstall it as user with Administrator rights and install it for all
 users when prompted.

 Graham

 2009/4/15 Graham Dumpleton graham.dumple...@gmail.com:

  2009/4/15 chunlin zhangchun...@gmail.com:

  Apache Version :Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/
  0.9.8e mod_autoindex_color mod_auth_sspi/1.0.4 SVN/1.4.3 mod_wsgi/2.4
  Python/2.6.1 PHP/5.2.4

  the mod_wsgi I am using is this one:
 http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-win32...

  I have add these code to moin.wsgi but still same err
  
  sys.path.insert(0, r'D:\Python26\Lib\site-packages')
  sys.path.insert(0, r'D:\Python26\Lib\site-packages\MoinMoin')
  sys.path.insert(0, r'D:\Python26\DLLs')
  

  err message:
  [error] mod_wsgi (pid=3056): Target WSGI script 'E:/Moin/moin/
  moin.wsgi' cannot be loaded as Python module.
  [error] mod_wsgi (pid=3056): Exception occurred processing WSGI script
  'E:/Moin/moin/moin.wsgi'.
  [error] Traceback (most recent call last):
  [error]   File E:/Moin/moin/moin.wsgi, line 52, in module
  [error]     from MoinMoin.server.server_wsgi import WsgiConfig,
  moinmoinApp
  [error]   File D:\\Python26\\Lib\\site-packages\\MoinMoin\\server\
  \__init__.py, line 14, in module
  [error]     from MoinMoin import log
  [error]   File D:\\Python26\\Lib\\site-packages\\MoinMoin\\log.py,
  line 92, in module
  [error]     import logging.config
  [error]   File D:\\Python26\\lib\\logging\\config.py, line 30, in
  module
  [error]     import sys, logging, logging.handlers, string, socket,
  struct, os, traceback, types
  [error]   File D:\\Python26\\lib\\logging\\handlers.py, line 30, in
  module
  [error]     import logging, socket, types, os, string, cPickle,
  struct, time, re
  [error]   File D:\\Python26\\lib\\socket.py, line 46, in module
  [error]     import _socket
  [error] ImportError: DLL load failed: The specified module could not
  be found.

  This problem has been solved before by reinstalling Python, but using
  Python 2.6.2.

  When you install it, it must be installed from an account with
  Administrator privilege and you must select that it be installed for
  all users.

  Not sure yet whether it relates to fact that mod_wsgi precompiled
  module was built against Python 2.6.2, or that it is because of your
  existing Python installation not being installed as an account with
  Administrator privilege and/or not selecting that it be installed for
  all users.

  Would be nice if someone can indicate whether they are successfully
  using this precompiled mod_wsgi with Python 2.6.1 rather than newer
  Python 2.6.2.

  If you can say whether you installed your Python from an account with
  Administrator privilege and whether you selected install for all
  users, would also be useful.

  The reason that Python must be installed for all users is that Apache
  service runs as special user normally and not as you.

  Graham


 


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



[modwsgi] Re: Intermittent NoReverseMatch errors

2009-04-15 Thread Alex Robbins

Also, I get no errors if I remove the maximum-requests

On Apr 15, 3:45 pm, Alex Robbins alexander.j.robb...@gmail.com
wrote:
 I am seeing this same error. I tried a little bit of experimentation.
 Does this give you any clues as to what might be happening?

 I wrote a script that runs through the same list of urls (58) on my
 site.
 Every run produces different errors and different numbers of errors,
 but some setups seem more error prone than others.

 WSGIDaemonProcess project threads=2 maximum-requests=1
 17 errors

 WSGIDaemonProcess project threads=1 maximum-requests=1
 0 errors

 WSGIDaemonProcess project threads=2 maximum-requests=10
 4 errors

 WSGIDaemonProcess project threads=2 maximum-requests=100
 0-1 error Depending on the run.

 WSGIDaemonProcess project threads=20 maximum-requests=10
 11 errors

 WSGIDaemonProcess project threads=20 maximum-requests=1
 29 errors and also 4 404s ???

 Thanks,
 Alex

 On Mar 19, 12:58 am, Graham Dumpleton graham.dumple...@gmail.com
 wrote:

  2009/3/19 Graham Dumpleton graham.dumple...@gmail.com:

   2009/3/19 Pete sgt.hu...@gmail.com:

   On Mar 18, 3:35 pm, Graham Dumpleton graham.dumple...@gmail.com
   wrote:

   This is not an error from mod_wsgi but from Django and has been
   encountered by various people and not just with mod_wsgi.

   Thanks Graham. I dug through a number of Django references before
   posting here. I'm on Django 1.0.X so Django ticket #8221 has been
   fixed and you'll notice that no arguments are being sent to the
   reverse (as expected) so it is not a regex urlresolver issue. I can
   view the same page w/ the same content hundreds of times without
   having an issue, but every day or 2 I get the error.

   The reason I bring it up here is that the only common thread I can
   find is the mod_wsgi activity in my Apache error log (pasted in the
   original email) about it loading the wsgi script at the same time the
   error occurs. Does mod_wsgi reload the script when 500s are
   encountered?

   No.

   But, by your configuration you have:

    maximum-requests=500 inactivity-timeout=600

   This means the daemon processes are restarted every 500 requests. This
   is a quite low value and wouldn't recommend it. One would only even
   use this option if your application has a problem with memory leaks,
   either explicit or through a poorly written caching system. So, why
   are you usingmaximum requestsoption?

   The inactivity timeout would only kick in after 10 minutes of no
   requests at all and if your application is used a lot, in practice
   shouldn't ever occur. What was your reasoning for setting the
   inactivity timeout?

   If not, is it possible for unexpected behavior to occur
   if we try to access the app during the wsgi script load process?

   No, not at least due to an access occurring while the reloading is
   happening, as requests will just be queued.

   Your problem could be though that you are missing a required import
   dependency. That is, something which maps strings to module/functions
   is being triggered without the module it requires to work not having
   been imported. It may work later in the life of the process because
   something has as a side effect later imported it. Thus you have an
   ordering issue and whether things works depends order URLs are
   requested. I give imports here as a possibility, may it may be some
   other form of initialisation.

  BTW, one way of checking for whether it is an issue with the order in
  which URLs are visited, is to use:

    WSGIDaemonProcess project processes=5 threads=1maximum-requests=1

  It may be slow, but it will result in every request being handled in
  new process, ie., CGI like. Use your application and see if you hit a
  specific URL which consistently fails with the error. That is, it is
  showing you problem URLs whose environment isn't set up properly for
  them to run properly.

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



[modwsgi] Re: Intermittent NoReverseMatch errors

2009-04-15 Thread Ariel Mauricio Nunez Gomez
Pete,

That could happen if you are using GeoDjango, unhandled exceptions would
come up now and then if you are using multiple threads but they would be
masked out by reverse url errors in templates.

I cannot tell for sure because you masked out your site name with

 ServerName project.com

But your log:

[Tue Mar 17 01:07:44 2009] [info] mod_wsgi (pid=8162): Enable monitor
thread in process 'trailmapping'.

Led me to

http://trailmapping.com/

And I assume you do use GeoDjango.

The solution is to run single threaded, multiprocess.

Regards,

Ariel.

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



[modwsgi] Re: Intermittent NoReverseMatch errors

2009-04-15 Thread Ariel Mauricio Nunez Gomez
Bah, I didn't realize it was an old thread, the OP must have solved his
issue by now.

Alex, are you using any library that is not thread safe?

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



[modwsgi] Re: Need help with basic auth for WHM/cpanel server

2009-04-15 Thread David

That did the trick. Thanks very much!

To clarify for others, I ended up with:

Directory /PATH/TO/DIRECTORY_CONTAINING_WSGI_HANDLER_SCRIPT
AuthType Basic
AuthName  
AuthUserFile /PATH/TO/FILE_WITH_PASSWORDS_FOR_APACHE
Satisfy All
require valid-user
/Directory

On Apr 3, 4:10 pm, Graham Dumpleton graham.dumple...@gmail.com
wrote:
 2009/4/4 David davidebl...@gmail.com:





  Hi, I'm relatively new to Django and newer to mod_wsgi. I'm trying to
  do number 1 from Graham's post (Have Apache handle HTTP Basic
  authentication, with reference to a user database managed by Apache,
  such as htpasswd file).

  I can get it to work when I remove the configuration for my Django
  application. However, when the application is running, it seems to
  bypass the authentication process (the login dialog is never
  presented).

  As an aside, I was able to get option 3 in Graham's post working, but
  would rather use Apache for this basic auth (just to keep folks from
  seeing our dev in progress).

  My http.include for the vhost looks like this:

  VirtualHost 70.32.93.84:80
         ServerName   stage.odopod.com:80
         ServerAdmin  da...@odopod.com
         DocumentRoot /path/to/httpdocs
         CustomLog  /path/to/logs/access_log plesklog
         ErrorLog  /path/to/logs/error_log
  IfModule mod_userdir.c
         UserDir /path/to/web_users
  /IfModule
         IfModule mod_ssl.c
                 SSLEngine off
         /IfModule
         Directory /path/to/httpdocs
         IfModule sapi_apache2.c
                 php_admin_flag engine off
         /IfModule
         IfModule mod_php5.c
                 php_admin_flag engine off
         /IfModule
                 Options -Includes -ExecCGI
         /Directory
         Directory /path/to/web_users
         IfModule sapi_apache2.c
                 php_admin_flag engine off
         /IfModule
         IfModule mod_php5.c
                 php_admin_flag engine off
         /IfModule
         /Directory

         Directory /path/to/httpdocs
                 AuthType Basic
                 AuthName  
                 AuthUserFile /path/to/d..httpdocs
                 Satisfy All
                 require  valid-user
         /Directory

        # if I comment the below 3 lines, the above authentication
  works; with the three lines in place, I do not get the auth dialog.
         WSGIScriptAlias / /path/to/wsgi_handler.py

 The auth stuff above needs to be on the directory the WSGI script file
 is in. Since you have shown only example paths, can't tell for sure if
 that is what you are doing. But with paths as shown, would need:

        Directory /path/to
                AuthType Basic
                AuthName  
                AuthUserFile /path/to/d..httpdocs
                Satisfy All
                require  valid-user
        /Directory

 That is, one directory above where you had it.

 Graham

         WSGIDaemonProcess something user=apache group=apache processes=1
  threads=10
         WSGIProcessGroup something

  /VirtualHost

  On Feb 3, 6:23 pm, Graham Dumpleton graham.dumple...@gmail.com
  wrote:
  2009/2/3 michaelg michaelgodsh...@gmail.com:

   I'm using mod_wsgi to serve a couple django sites on a WHM/cpanel
   server.  I'd like to use basic auth to password protect the
   development server, but I'm having difficulty applying the
   instructions from this guide (http://code.google.com/p/modwsgi/wiki/
   AccessControlMechanisms).  I'm guessing I need to enter the info in my
   vhost include file, which looks like this:

   #/usr/local/apache/conf/userdata/std/2/account/dev.site.com/vhost.conf

   IfModule mod_alias.c
   Alias /robots.txt /home/account/public_html/dev/site/media/robots.txt
   Alias /media /home/account/public_html/dev/site/media
   Alias /admin_media /home/account/public_html/dev/site/media/
   admin_media
   /IfModule

   IfModule mod_wsgi.c
   WSGIScriptAlias / /home/account/public_html/test.wsgi
   WSGIDaemonProcess nobody processes=2 threads=5 display-name=%{GROUP}
   WSGIProcessGroup nobody
   WSGIApplicationGroup %{GLOBAL}
   /IfModule

   Please show me how to setup basic auth for this development site.

  Which of the following are you wanting to do:

  1. Have Apache handle HTTP Basic authentication, with reference to a
  user database managed by Apache, such as htpasswd file? If this, see
  Apache documentation:

   http://httpd.apache.org/docs/2.2/howto/auth.html

  See Apache 2.0 documentation of using older Apache as there are some
  differences in some cases.

  2. Have Apache handle HTTP Basic authentication, with Python code
  provided through mod_wsgi hooks to allow user database checks to be
  handled by your own custom code? If this, then covered by mod_wsgi
  documentation you have already been looking at:

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

  3. Allow a WSGI application to handle the HTTP Basic authentication?
  If this, then you just need to enable passing of authentication
  

[modwsgi] Re: win32 modwsgi error: ImportError: DLL load failed

2009-04-15 Thread Chunlin Zhang

On Thu, Apr 16, 2009 at 4:56 AM, Graham Dumpleton
graham.dumple...@gmail.com wrote:

 2009/4/15 chunlin zhangchun...@gmail.com:

 I just check my python installation,found the directory is C:
 \Documents and Settings\All Users\...\Python 2.6,so I chose All
 Users.

 That isn't necessarily sufficient indication as there are registry
 entries as well and is is those which are more of an issue as they
 define the directories to look for stuff.

 If you are going to reinstall anythng, install newer Python 2.6.2.
 Don't go back to Python 2.5 as don't supply latest mod_wsgi.so for
 that version of Python.

 So, just try the reinstall of Python like suggested.

But like you say before,the win32
build(mod_wsgi-win32-ap22py26-2.4.so) is for 2.6.1,no problem about
that?(Or I misunderstood?)

Ok,I will try it first(2.6.2),if back to 2.5 I will install too much
python module...


 Graham

 And I always using a Administrator privilege account(a windows user's
 usual habbit...).

 So I had better turn back to python 2.5...:(

 On Apr 15, 7:21 pm, Graham Dumpleton graham.dumple...@gmail.com
 wrote:
 Hmmm, I tell a lie. SInce Python 2.6.2 only just got released, the
 Apache module must have been compiled against Python 2.6.1. Can't be
 bothered starting up Windows at the moment to check.

 Anyway, would suggest your problem is therefore likely to be due to
 Python not being installed so as to be available to all users. So,
 reinstall it as user with Administrator rights and install it for all
 users when prompted.

 Graham

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



[modwsgi] Re: win32 modwsgi error: ImportError: DLL load failed

2009-04-15 Thread Graham Dumpleton

2009/4/16 Chunlin Zhang zhangchun...@gmail.com:

 On Thu, Apr 16, 2009 at 4:56 AM, Graham Dumpleton
 graham.dumple...@gmail.com wrote:

 2009/4/15 chunlin zhangchun...@gmail.com:

 I just check my python installation,found the directory is C:
 \Documents and Settings\All Users\...\Python 2.6,so I chose All
 Users.

 That isn't necessarily sufficient indication as there are registry
 entries as well and is is those which are more of an issue as they
 define the directories to look for stuff.

 If you are going to reinstall anythng, install newer Python 2.6.2.
 Don't go back to Python 2.5 as don't supply latest mod_wsgi.so for
 that version of Python.

 So, just try the reinstall of Python like suggested.

 But like you say before,the win32
 build(mod_wsgi-win32-ap22py26-2.4.so) is for 2.6.1,no problem about
 that?(Or I misunderstood?)

 Ok,I will try it first(2.6.2),if back to 2.5 I will install too much
 python module...

The patch revision (third number) of Python shouldn't matter, so that
module, although compiled against Python 2.6.1 should also work for
other Python 2.6.X versions.

I just want to see Python reinstalled and since 2.6.2 is latest, no
reason not to use that.

Graham


 Graham

 And I always using a Administrator privilege account(a windows user's
 usual habbit...).

 So I had better turn back to python 2.5...:(

 On Apr 15, 7:21 pm, Graham Dumpleton graham.dumple...@gmail.com
 wrote:
 Hmmm, I tell a lie. SInce Python 2.6.2 only just got released, the
 Apache module must have been compiled against Python 2.6.1. Can't be
 bothered starting up Windows at the moment to check.

 Anyway, would suggest your problem is therefore likely to be due to
 Python not being installed so as to be available to all users. So,
 reinstall it as user with Administrator rights and install it for all
 users when prompted.

 Graham

 


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



[modwsgi] Re: win32 modwsgi error: ImportError: DLL load failed

2009-04-15 Thread Chunlin Zhang

It is OK now!
I reinstall with python 2.6.2 and now works.
Thank you very much!

On Thu, Apr 16, 2009 at 9:33 AM, Graham Dumpleton
graham.dumple...@gmail.com wrote:

 2009/4/16 Chunlin Zhang zhangchun...@gmail.com:

 On Thu, Apr 16, 2009 at 4:56 AM, Graham Dumpleton
 graham.dumple...@gmail.com wrote:

 2009/4/15 chunlin zhangchun...@gmail.com:

 I just check my python installation,found the directory is C:
 \Documents and Settings\All Users\...\Python 2.6,so I chose All
 Users.

 That isn't necessarily sufficient indication as there are registry
 entries as well and is is those which are more of an issue as they
 define the directories to look for stuff.

 If you are going to reinstall anythng, install newer Python 2.6.2.
 Don't go back to Python 2.5 as don't supply latest mod_wsgi.so for
 that version of Python.

 So, just try the reinstall of Python like suggested.

 But like you say before,the win32
 build(mod_wsgi-win32-ap22py26-2.4.so) is for 2.6.1,no problem about
 that?(Or I misunderstood?)

 Ok,I will try it first(2.6.2),if back to 2.5 I will install too much
 python module...

 The patch revision (third number) of Python shouldn't matter, so that
 module, although compiled against Python 2.6.1 should also work for
 other Python 2.6.X versions.

 I just want to see Python reinstalled and since 2.6.2 is latest, no
 reason not to use that.

 Graham


 Graham

 And I always using a Administrator privilege account(a windows user's
 usual habbit...).

 So I had better turn back to python 2.5...:(

 On Apr 15, 7:21 pm, Graham Dumpleton graham.dumple...@gmail.com
 wrote:
 Hmmm, I tell a lie. SInce Python 2.6.2 only just got released, the
 Apache module must have been compiled against Python 2.6.1. Can't be
 bothered starting up Windows at the moment to check.

 Anyway, would suggest your problem is therefore likely to be due to
 Python not being installed so as to be available to all users. So,
 reinstall it as user with Administrator rights and install it for all
 users when prompted.

 Graham

 


 


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