Re: mod_wsgi setup
The "Requested setting DEBUG" says you've requested DEBUG but it's not setup. I don't think you would want DEBUG in production, so try to turn that off in the settings file.
On Friday, 15 November 2013 11:34:58 UTC+2, tino wrote:
-- On Friday, 15 November 2013 11:34:58 UTC+2, tino wrote:
Hello,I am trying to setup a python 2.7 + Django + virtualenv + mod_wsgi environment in my centos 6.3 server to run my python application through apache.But I am getting internal error while trying to access the application through apache. The error log shows the following.============[Fri Nov 15 04:20:30 2013] [error] [client 117.201.194.54] mod_wsgi (pid=20361): Target WSGI script '/var/www/html/djangosites/spark.wsgi' cannot be loaded as Python module. [Fri Nov 15 04:20:30 2013] [error] [client 117.201.194.54] mod_wsgi (pid=20361): Exception occurred processing WSGI script '/var/www/html/djangosites/spark.wsgi'. Fri Nov 15 04:20:30 2013] [error] [client 117.201.194.54] ImproperlyConfigured: Requested setting DEBUG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.============It is working fine when running as a test server.======(virtualenv)[root@lampserver spark]# python manage.py runserver 0.0.0.0:8080Validating models...0 errors foundNovember 15, 2013 - 09:15:19Django version 1.6, using settings 'spark.settings'Starting development server at http://0.0.0.0:8080/Quit the server with CONTROL-C.====spark.wsgi file looks like the following.===========import sysimport siteimport osvepath = '/var/www/html/virtualenv/lib/python2.7/site-packages' prev_sys_path = list(sys.path)site.addsitedir(vepath)sys.path.append('/var/www/html/djangosites') new_sys_path = [p for p in sys.path if p not in prev_sys_path]for item in new_sys_path:sys.path.remove(item)sys.path[:0] = new_sys_pathfrom django.core.handlers.wsgi import WSGIHandleros.environ['DJANGO_SETTINGS_MODULE'] = 'spark.settings' application = WSGIHandler()==============Entries for wsgi in apache conf looks like the following============[root@lampserver djangosites]# cat /etc/httpd/conf.d/django.confLoadModule wsgi_module modules/mod_wsgi.soAddHandler wsgi-script .wsgiWSGIScriptAlias / /var/www/html/djangosites/spark.wsgi WSGIDaemonProcess spark processes=5 threads=15 display-name=%{GROUP}WSGIProcessGroup sparkWSGIApplicationGroup %{GLOBAL}WSGISocketPrefix /var/run/wsgi=================Apache is running as user "apache".My project files and permissions are shown below.===========root@lampserver djangosites]# pwdvar/www/html/djangosites[root@lampserver djangosites]# lsspark spark.wsgi[root@lampserver djangosites]# lltotal 8drwxr-xr-x 3 apache apache 4096 Nov 15 02:38 spark-rwxrwxrwx 1 apache apache 535 Nov 15 03:16 spark.wsgi[root@lampserver djangosites]# cd spark/manage.py spark/[root@lampserver spark]# lltotal 8-rwxr-xr-x 1 apache apache 248 Nov 15 02:38 manage.pydrwxr-xr-x 2 apache apache 4096 Nov 15 03:05 spark[root@lampserver spark]# cd spark/[root@lampserver spark]# lltotal 28-rw-r--r-- 1 apache apache 0 Nov 15 02:38 __init__.py-rw-r--r-- 1 apache apache 136 Nov 15 02:40 __init__.pyc-rw-r--r-- 1 apache apache 1969 Nov 15 02:38 settings.py-rw-r--r-- 1 apache apache 2142 Nov 15 02:40 settings.pyc-rw-r--r-- 1 apache apache 296 Nov 15 02:38 urls.py-rw-r--r-- 1 apache apache 416 Nov 15 02:40 urls.pyc-rwxr-xr-x 1 apache apache 385 Nov 15 02:38 wsgi.py-rw-r--r-- 1 apache apache 589 Nov 15 02:40 wsgi.pyc==================Can anybody please identify the problem with my settings?Regards
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3594a141-c38c-4efa-850a-be2f75dafaf7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home