I added this to my urls.py:

import sys, os
try:
    admin.autodiscover()
except:
    e = sys.exc_info()[0]
    print >> sys.stderr, e

and got this in the apache log -

[core:notice] [pid 19280] AH00052: child pid 19284 exit signal Segmentation
fault (11)

The site loads correctly except for the admin part. I get the admin login
page and can login as superuser, but none of the tables are visible and I
get the error message "You don't have permission to edit anything."

In the apache log for the site (not the top level apache log) I get this
with an django exception (see below). Not sure what it means.

[Wed Jan 29 08:48:00.796858 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of Require all granted: granted
[Wed Jan 29 08:48:00.796992 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of <RequireAny>: granted
[Wed Jan 29 08:48:00.797266 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of Require all granted: granted
[Wed Jan 29 08:48:00.797290 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of <RequireAny>: granted
[Wed Jan 29 08:48:00.820475 2014] [:info] [pid 23572] mod_wsgi (pid=23572):
Create interpreter 'beagle:7000|/mom'.
[Wed Jan 29 08:48:00.823940 2014] [:info] [pid 23572] mod_wsgi (pid=23572):
Adding '/var/www/mom/' to path.
[Wed Jan 29 08:48:00.825088 2014] [:info] [pid 23572] mod_wsgi (pid=23572):
Adding '/var/www/mom/inventory/' to path.
[Wed Jan 29 08:48:00.826026 2014] [:info] [pid 23572] mod_wsgi (pid=23572):
Adding '/var/www/mom/inventory_project/' to path.
[Wed Jan 29 08:48:00.827011 2014] [:info] [pid 23572] mod_wsgi (pid=23572):
Adding '/var/lib/django-venv/site-packages/' to path.
[Wed Jan 29 08:48:00.828701 2014] [:info] [pid 23572] [client
192.168.25.150:16823] mod_wsgi (pid=23572, process='mom',
application='beagle:7000|/mom'): Loading WSGI script
'/var/www/mom/inventory_project/wsgi.py'.
[Wed Jan 29 08:48:01.663370 2014] [:error] [pid 23572] <class
'django.core.exceptions.ImproperlyConfigured'>
[Wed Jan 29 08:48:01.853667 2014] [deflate:debug] [pid 23573]
mod_deflate.c(764): [client 192.168.25.150:60286] AH01384: Zlib: Compressed
4574 to 948 : URL /mom/admin/
[Wed Jan 29 08:48:02.315233 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of Require all granted: granted
[Wed Jan 29 08:48:02.315602 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of <RequireAny>: granted
[Wed Jan 29 08:48:02.315869 2014] [core:info] [pid 23573] [client
192.168.25.150:60286] AH00128: File does not exist: /var/www/favicon.ico
[Wed Jan 29 08:48:02.552416 2014] [:info] [pid 23635] mod_wsgi (pid=23635):
Attach interpreter ''.
[Wed Jan 29 08:48:02.553199 2014] [:info] [pid 23635] mod_wsgi (pid=23635):
Adding '/var/www/mom/' to path.
[Wed Jan 29 08:48:02.554206 2014] [:info] [pid 23635] mod_wsgi (pid=23635):
Adding '/var/www/mom/inventory/' to path.
[Wed Jan 29 08:48:02.555206 2014] [:info] [pid 23635] mod_wsgi (pid=23635):
Adding '/var/www/mom/inventory_project/' to path.
[Wed Jan 29 08:48:02.556151 2014] [:info] [pid 23635] mod_wsgi (pid=23635):
Adding '/var/lib/django-venv/site-packages/' to path.
[Wed Jan 29 08:48:05.496267 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of Require all granted: granted
[Wed Jan 29 08:48:05.496361 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of <RequireAny>: granted
[Wed Jan 29 08:48:05.496474 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of Require all granted: granted
[Wed Jan 29 08:48:05.496493 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of <RequireAny>: granted
[Wed Jan 29 08:48:05.521001 2014] [:info] [pid 23571] mod_wsgi (pid=23571):
Create interpreter 'beagle:7000|/mom'.
[Wed Jan 29 08:48:05.524888 2014] [:info] [pid 23571] mod_wsgi (pid=23571):
Adding '/var/www/mom/' to path.
[Wed Jan 29 08:48:05.525911 2014] [:info] [pid 23571] mod_wsgi (pid=23571):
Adding '/var/www/mom/inventory/' to path.
[Wed Jan 29 08:48:05.526883 2014] [:info] [pid 23571] mod_wsgi (pid=23571):
Adding '/var/www/mom/inventory_project/' to path.
[Wed Jan 29 08:48:05.528751 2014] [:info] [pid 23571] mod_wsgi (pid=23571):
Adding '/var/lib/django-venv/site-packages/' to path.
[Wed Jan 29 08:48:05.530493 2014] [:info] [pid 23571] [client
192.168.25.150:16823] mod_wsgi (pid=23571, process='mom',
application='beagle:7000|/mom'): Loading WSGI script
'/var/www/mom/inventory_project/wsgi.py'.
*[Wed Jan 29 08:48:06.330505 2014] [:error] [pid 23571] <class
'django.core.exceptions.ImproperlyConfigured'>*
[Wed Jan 29 08:48:06.665242 2014] [deflate:debug] [pid 23573]
mod_deflate.c(764): [client 192.168.25.150:60286] AH01384: Zlib: Compressed
8575 to 1622 : URL /mom/inventory/
[Wed Jan 29 08:48:07.176850 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of Require all granted: granted
[Wed Jan 29 08:48:07.176945 2014] [authz_core:debug] [pid 23573]
mod_authz_core.c(802): [client 192.168.25.150:60286] AH01626: authorization
result of <RequireAny>: granted
[Wed Jan 29 08:48:07.177011 2014] [core:info] [pid 23573] [client
192.168.25.150:60286] AH00128: File does not exist: /var/www/favicon.ico
[Wed Jan 29 08:48:07.556573 2014] [:info] [pid 23655] mod_wsgi (pid=23655):
Attach interpreter ''.
[Wed Jan 29 08:48:07.557411 2014] [:info] [pid 23655] mod_wsgi (pid=23655):
Adding '/var/www/mom/' to path.
[Wed Jan 29 08:48:07.558362 2014] [:info] [pid 23655] mod_wsgi (pid=23655):
Adding '/var/www/mom/inventory/' to path.
[Wed Jan 29 08:48:07.559354 2014] [:info] [pid 23655] mod_wsgi (pid=23655):
Adding '/var/www/mom/inventory_project/' to path.
[Wed Jan 29 08:48:07.560297 2014] [:info] [pid 23655] mod_wsgi (pid=23655):
Adding '/var/lib/django-venv/site-packages/' to path.

If I remove the try/except block and run with admin.autodiscover(), then I
get this error:

The included urlconf inventory_project.urls doesn't have any patterns in it


and the site does not load. I get this in the apache log for the site -

[Wed Jan 29 08:57:26.822396 2014] [authz_core:debug] [pid 24023]
mod_authz_core.c(802): [client 192.168.25.150:60417] AH01626: authorization
result of Require all granted: granted
[Wed Jan 29 08:57:26.822537 2014] [authz_core:debug] [pid 24023]
mod_authz_core.c(802): [client 192.168.25.150:60417] AH01626: authorization
result of <RequireAny>: granted
[Wed Jan 29 08:57:26.823270 2014] [authz_core:debug] [pid 24023]
mod_authz_core.c(802): [client 192.168.25.150:60417] AH01626: authorization
result of Require all granted: granted
[Wed Jan 29 08:57:26.823520 2014] [authz_core:debug] [pid 24023]
mod_authz_core.c(802): [client 192.168.25.150:60417] AH01626: authorization
result of <RequireAny>: granted
[Wed Jan 29 08:57:26.846489 2014] [:info] [pid 24020] mod_wsgi (pid=24020):
Create interpreter 'beagle:7000|/mom'.
[Wed Jan 29 08:57:26.850035 2014] [:info] [pid 24020] mod_wsgi (pid=24020):
Adding '/var/www/mom/' to path.
[Wed Jan 29 08:57:26.851103 2014] [:info] [pid 24020] mod_wsgi (pid=24020):
Adding '/var/www/mom/inventory/' to path.
[Wed Jan 29 08:57:26.852029 2014] [:info] [pid 24020] mod_wsgi (pid=24020):
Adding '/var/www/mom/inventory_project/' to path.
[Wed Jan 29 08:57:26.852957 2014] [:info] [pid 24020] mod_wsgi (pid=24020):
Adding '/var/lib/django-venv/site-packages/' to path.
[Wed Jan 29 08:57:26.854627 2014] [:info] [pid 24020] [client
192.168.25.150:16823] mod_wsgi (pid=24020, process='mom',
application='beagle:7000|/mom'): Loading WSGI script
'/var/www/mom/inventory_project/wsgi.py'.
[Wed Jan 29 08:57:28.674884 2014] [authz_core:debug] [pid 24022]
mod_authz_core.c(802): [client 192.168.25.150:60418] AH01626: authorization
result of Require all granted: granted
[Wed Jan 29 08:57:28.675007 2014] [authz_core:debug] [pid 24022]
mod_authz_core.c(802): [client 192.168.25.150:60418] AH01626: authorization
result of <RequireAny>: granted
[Wed Jan 29 08:57:28.675198 2014] [core:info] [pid 24022] [client
192.168.25.150:60418] AH00128: File does not exist: /var/www/favicon.ico
[Wed Jan 29 08:57:29.195442 2014] [:info] [pid 24084] mod_wsgi (pid=24084):
Attach interpreter ''.
[Wed Jan 29 08:57:29.196270 2014] [:info] [pid 24084] mod_wsgi (pid=24084):
Adding '/var/www/mom/' to path.
[Wed Jan 29 08:57:29.197220 2014] [:info] [pid 24084] mod_wsgi (pid=24084):
Adding '/var/www/mom/inventory/' to path.
[Wed Jan 29 08:57:29.198163 2014] [:info] [pid 24084] mod_wsgi (pid=24084):
Adding '/var/www/mom/inventory_project/' to path.
[Wed Jan 29 08:57:29.199169 2014] [:info] [pid 24084] mod_wsgi (pid=24084):
Adding '/var/lib/django-venv/site-packages/' to path.

My wsgi.py file:

"""
WSGI config for inventory_project 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.6/howto/deployment/wsgi/
"""

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"inventory_project.settings.dev")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

and my top level urls.py:

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"inventory_project.settings.dev")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
root@beagle:/var/www/mom# cat inventory_project/urls.py
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
import inventory_project.settings.dev as setttings
#import debug_toolbar
from django.contrib import admin
import sys, os
#try:
admin.autodiscover()
#    0/0
#except:
#    e = sys.exc_info()[0]
#    print >> sys.stderr, e

urlpatterns = patterns('',
    url(r'^inventory/', include('inventory.urls')),
    url(r'^admin/', include(admin.site.urls)),
)

#if settings.DEBUG:
#    urlpatterns += patterns('django.views.static',
#        (r'media/(?P<path>.*)', 'serve', {'document_root':
settings.MEDIA_ROOT}),
#    )
#    urlpatterns += patterns('django.views.static',
#        (r'static/(?P<path>.*)', 'serve', {'document_root':
settings.STATIC_ROOT}),
#    )
#    urlpatterns += patterns('',
#        url(r'^__debug__/', include(debug_toolbar.urls)),
#    )

Thanks for any help you can give!

Mark

On Wed, Jan 29, 2014 at 3:16 AM, Babatunde Akinyanmi
<[email protected]>wrote:

> Response inline
>
> On 29 Jan 2014 07:22, "Mark Phillips" <[email protected]> wrote:
> >
> > I have a site built using django 1.6. It runs as expected with runserver
> on my Debian laptop in a virtual env based on Python 2.7 (development
> machine). I copied the site to another Debian server (production), created
> the same virtual environment, and am trying to use Apache and mod-wsgi to
> serve the site. I have run into a wierd (for me, a django beginner) problem.
> >
> > In my top level urls.py, I have
> >
> > from django.contrib import admin
> > admin.autodiscover()
> >
> > which works just as expected when I use runserver in my development
> machine. I can access the admin pages as superuser and edit the data.
> >
> > When I run the same site on the production machine using apache and wsgi
> I either get a segmentation fault or, if I comment out the
> line admin.autodiscover() I can run the site without errors. However, when
> I log into the admin part of the site, my superuser account does not have
> permission to change any of the tables, nor do any of the tables appear in
> the admin site (although the login is correct and the page looks like an
> admin page).
> >
> > Any suggestions on the cause of the problem and a possible fix? I am not
> sure what other information to provide.
>
> Can you give the exact errors you are getting? Segmentation fault raises a
> red flag for apache in my mind though.
> >
> > Thanks,
> >
> > Mark
> >
> > --
> > 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 [email protected].
> > To post to this group, send email to [email protected].
> > 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/CAEqej2MaQ9NGHBEp8EQ3_O8nPAJTD8EV5S_uwMT%2BGwAG60dKHQ%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/CA%2BWjgXO2NdLnh6iCdSChZMcVQ87jAtEEej4XSd15mkbkY7Ff7Q%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CAEqej2P0NagSKVNDfbj5mK7hb_nXAL0t8kKfx2GhsZqQJVYJEw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to