I have successfully installed trac 1.0 . It is running fine when in standalone mode .
I am getting the following error after doing the integration with Apache mod_wsgi
mod_wsgi (pid=23895): Exception occurred processing WSGI script '/var/www/cgi-bin/trac_pcbb.trac.wsgi'.
[Tue Sep 30 19:40:27 2014] [error] [client 192.168.10.218] Traceback (most recent call last):
[Tue Sep 30 19:40:27 2014] [error] [client 192.168.10.218] File "/var/www/cgi-bin/trac_pcbb.trac.wsgi", line 30, in application
[Tue Sep 30 19:40:27 2014] [error] [client 192.168.10.218] from trac.web.main import dispatch_request
[Tue Sep 30 19:40:27 2014] [error] [client 192.168.10.218] ImportError: No module named trac.web.main
Related
I am getting below error when I start the httpd server and access the app url -
[Tue Feb 21 22:01:51 2017] [error] [client 10.209.33.139] mod_wsgi (pid=15425): Target WSGI script '/scratch/gdudwadk/python-projects/newblog/app/wsgi.py' cannot be loaded as Python module.
[Tue Feb 21 22:01:51 2017] [error] [client 10.209.33.139] mod_wsgi (pid=15425): Exception occurred processing WSGI script '/scratch/gdudwadk/python-projects/newblog/app/wsgi.py'.
[Tue Feb 21 22:01:51 2017] [error] Traceback (most recent call last):
[Tue Feb 21 22:01:51 2017] [error] File "/scratch/gdudwadk/python-projects/newblog/app/wsgi.py", line 7, in <module>
[Tue Feb 21 22:01:51 2017] [error] from app import app as application
[Tue Feb 21 22:01:51 2017] [error] File "/scratch/gdudwadk/python-projects/newblog/app/app.py", line 1, in <module>
[Tue Feb 21 22:01:51 2017] [error] from flask import Flask
[Tue Feb 21 22:01:51 2017] [error] File "/scratch/gdudwadk/python-projects/newblog/venv/lib/python2.6/site-packages/flask/__init__.py", line 17, in <module>
[Tue Feb 21 22:01:51 2017] [error] from werkzeug.exceptions import abort
[Tue Feb 21 22:01:51 2017] [error] File "/scratch/gdudwadk/python-projects/newblog/venv/lib/python2.6/site-packages/werkzeug/__init__.py", line 17, in <module>
[Tue Feb 21 22:01:51 2017] [error] from types import ModuleType
[Tue Feb 21 22:01:51 2017] [error] ImportError: No module named types
This started happening after my machine was replaced with new one. Previously app was working fine.
I found one reference to python2.7 in /etc/httpd/conf.d/wsgi.conf and that's what was causing the issue. After removing that, the app was up and running.. Thanks!
I am getting "Internal Server Error" when I try to access the django website.
I am using Django 1.8, Python 2.7.10, centos 6.5 and apache.
In apache log I am getting the following error:
mod_wsgi (pid=23866): Target WSGI script '/abc/abc/abc/wsgi.py' cannot be loaded as Python module.
[Mon May 25 14:40:47 2015] [error] [client xyz] mod_wsgi (pid=23866): Exception occurred processing WSGI script '/abc/abc/abc/wsgi.py'.
[Mon May 25 14:40:47 2015] [error] [client xyz] Traceback (most recent call last):
[Mon May 25 14:40:47 2015] [error] [client xyz] File "/abc/abc/abc/wsgi.py", line 12, in <module>
[Mon May 25 14:40:47 2015] [error] [client xyz] from django.core.wsgi import get_wsgi_application
[Mon May 25 14:40:47 2015] [error] [client xyz] File "/abc/lib/python2.7/site-packages/django/__init__.py", line 1, in <module>
[Mon May 25 14:40:47 2015] [error] [client xyz] from django.utils.version import get_version
[Mon May 25 14:40:47 2015] [error] [client xyz] File "/abc/lib/python2.7/site-packages/django/utils/version.py", line 7, in <module>
[Mon May 25 14:40:47 2015] [error] [client xyz] from django.utils.lru_cache import lru_cache
[Mon May 25 14:40:47 2015] [error] [client xyz] File "/abc/lib/python2.7/site-packages/django/utils/lru_cache.py", line 28
[Mon May 25 14:40:47 2015] [error] [client xyz] fasttypes = {int, str, frozenset, type(None)},
[Mon May 25 14:40:47 2015] [error] [client xyz] ^
[Mon May 25 14:40:47 2015] [error] [client xyz] SyntaxError: invalid syntax
Thanks
Although you say you are running Python 2.7, this error indicates that in fact you are using 2.6, as set literals were only introduced in 2.7.
The issue is that mod_wsgi is compiled against a specific Python version, which in your case is the one that comes with Centos 6.5. You will need to recompile it for 2.7, or find a version already compiled against that.
You need to start using virtualenv for your django project. Here's a nice tutorial. For a makeshift solution, you can just run django with python 2.7 by using python2.7 manage.py runserver. However, it's highly recommended to look into virtualenv. Makes life much easier.
With regards to making mod_wsgi use python 2.7, you need to recompile it. For that, just download the source and execute:
$ ./configure
$ make
$ sudo make install
They have a quick installation guide that you can access here.
I have a django (1.7) app that works pretty well on a Centos7 server. Now i moving to production server RHEL 6 and still have some issues.
The problem is the mod_wsgi.
The server config:
RHEL6
Apache 2.2
Django 1.7
Python 2.6
the apache error log
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] mod_wsgi (pid=12827): Target WSGI script '/home/evtdb/FLWeb/FLWeb/wsgi.py' cannot be loaded as Python module.
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] mod_wsgi (pid=12827): Exception occurred processing WSGI script '/home/evtdb/FLWeb/FLWeb/wsgi.py'.
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] Traceback (most recent call last):
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] File "/home/evtdb/FLWeb/FLWeb/wsgi.py", line 21, in <module>
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] from django.core.wsgi import get_wsgi_application
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] ImportError: No module named django.core.wsgi
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] mod_wsgi (pid=12827): Target WSGI script '/home/evtdb/FLWeb/FLWeb/wsgi.py' cannot be loaded as Python module.
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] mod_wsgi (pid=12827): Exception occurred processing WSGI script '/home/evtdb/FLWeb/FLWeb/wsgi.py'.
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] Traceback (most recent call last):
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] File "/home/evtdb/FLWeb/FLWeb/wsgi.py", line 21, in <module>
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] from django.core.wsgi import get_wsgi_application
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] ImportError: No module named django.core.wsgi
the rest of the important files
flweb.conf
WSGIScriptAlias / /home/evtdb/FLWeb/FLWeb/wsgi.py
WSGIDaemonProcess localhost python-path=/home/evtdb/FLWeb:/usr/lib/python2.6/site-packages
WSGIProcessGroup localhost
<VirtualHost 127.0.0.1:8080>
<Directory /home/evtdb/FLWeb/FLWeb>
<Files wsgi.py>
Order allow,deny
Allow from all
</Files>
</Directory>
</VirtualHost>
wsgi.py
"""
WSGI config for FLWeb project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FLWeb.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
ldd modules/mod_wsgi.so
linux-vdso.so.1 => (0x00007fff6afff000)
libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00007fd69fc02000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd69f9e5000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fd69f7e0000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007fd69f5dd000)
libm.so.6 => /lib64/libm.so.6 (0x00007fd69f359000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd69efc4000)
/lib64/ld-linux-x86-64.so.2 (0x000000330aa00000)
I thought that a problem could be that mod_wsgi seems compiled with lib64, so I changed the python path on the flweb.conf to lib64 but it didn't worked
EDIT:
I realize the server has python 2.7 in /user/local/lib and that is the python version where django is installed. I changed the path in the conf file, but now I guess I need to rebuild the mod_wsgi
EDIT2:
Trying to rebuild mod_wsgi, have this problem
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
according to https://code.google.com/p/modwsgi/wiki/InstallationIssues is a conflict between python that was compiled to 32 bit and mod_wsgi to 64
Installed Python and Django on a Windows Server 2008 R2 Wamp Machine. Everything's fine, except a ported version of a django/python website which were on a LAMP machine previously.
500 internal server error when accessing the vhost via web browser
I get this error log from apache:
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] mod_wsgi (pid=1788): Exception occurred processing WSGI script 'C:/Wamp/www/mysite_com/mysite_com.wsgi'.
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] Traceback (most recent call last):
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] File "C:\\Python27\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line 255, in __call__
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] response = self.get_response(request)
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] File "C:\\Python27\\lib\\site-packages\\django\\core\\handlers\\base.py", line 178, in get_response
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] File "C:\\Python27\\lib\\site-packages\\django\\core\\handlers\\base.py", line 220, in handle_uncaught_exception
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] if resolver.urlconf_module is None:
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] File "C:\\Python27\\lib\\site-packages\\django\\core\\urlresolvers.py", line 342, in urlconf_module
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] self._urlconf_module = import_module(self.urlconf_name)
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] File "C:\\Python27\\lib\\site-packages\\django\\utils\\importlib.py", line 35, in import_module
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] __import__(name)
[Tue Aug 06 12:29:27 2013] [error] [client 127.0.0.1] ImportError: No module named urls
This is my .wsgi app:
import os, sys
sys.path.append('c:/Wamp/www/')
os.environ ['DJANGO_SETTINGS_MODULE'] = 'mysite_com.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
And my apache vhosts
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot "C:/Wamp/www/mysite_com/"
WSGIScriptAlias / "C:/Wamp/www/mysite_com/mysite_com.wsgi"
</VirtualHost>
folder structure
\www
\mysite_com
\__init__.py
\settings.py
\urls.py
\manage.py
\mysite_com.wsgi
Any advice?
Thanks
You're adding the site path to your system path wrong. See in Linux you would use forward slashes '/' while in windows (which you seem to be using) backward slashes '\'. Of course, you need to double them up so it won't be rendered as escape strings:
sys.path.append('C:\\wamp\\www')
of course, it would be much easier like this:
sys.path.append(r'C:\wamp\www')
And see - your server can find the wsgi application because you told apache where to find it, so it complains about the next module that it can't find (which just happens to be urls.py). I already answered in a comment but I thought an explanation of why you saw the error that specific way would help.
p.s.
If that still doesn't work you might need to append the path to your actual application:
sys.path.append(r'C:\Wamp\www\mysite_com')
I'm running into this error message while deploying django in apache2 using mod_wsgi and i cannot fix it:
tail -f /var/log/apache2/error.log
[Tue Dec 20 04:15:45 2011] [info] mod_wsgi (pid=3959): Adding '/usr/local/lib/python2.7/site-packages/' to path.
[Tue Dec 20 04:15:45 2011] [info] [client 80.226.1.7] mod_wsgi (pid=3959, process='', application='digitalchaot.de|/djangu'): Loading WSGI script '/home/webapps/digitalchaot/apache.wsgi'.
[Tue Dec 20 04:16:04 2011] [error] [client 80.226.1.7] mod_wsgi (pid=3959): Exception occurred processing WSGI script '/home/webapps/digitalchaot/apache.wsgi'.
[Tue Dec 20 04:16:04 2011] [error] [client 80.226.1.7] Traceback (most recent call last):
[Tue Dec 20 04:16:04 2011] [error] [client 80.226.1.7] File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 284, in __call__
[Tue Dec 20 04:16:04 2011] [error] [client 80.226.1.7] start_response(status, response_headers)
[Tue Dec 20 04:16:04 2011] [error] [client 80.226.1.7] TypeError: expected byte string object for status, value of type str found
[Tue Dec 20 04:16:04 2011] [error] [client 80.226.1.7] File does not exist: /htdocs
[Tue Dec 20 04:20:11 2011] [error] [client 207.46.13.206] File does not exist: /htdocs
[Tue Dec 20 04:20:57 2011] [error] [client 207.46.13.206] File does not exist: /htdocs
I'm running Debian with Python 2.7.2 with Django 1.3.1 and the current mod_wsgi. I compiled python, django and wsgi myself due to previous errors. Does anybody have a hint what the error might be ?
For the Python error, it looks like your mod_wsgi is compiled against Python 3.1 and not Python 2.7. You need to ensure that mod_wsgi which is installed was compiled against Python 2.7.
The clue is that error message is complaining that status is a byte string instead of text string. This can only occur in Python 3.X with mod_wsgi.
Go through the checks in this document:
http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation