Search code examples
djangoapachedeploymentdreamhost

Django serving 500 errors for every view except root


So I am trying to deploy to my production environment and am getting 500 errors for every view except the root URL: http://5buckchuck.com/

The errors appear to apache errors, not the fancy django ones:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

per the server error logs:

[Thu Jul 07 22:04:53 2011] [error] [client my IP] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

Info:

  • debugging is set to true
  • I have tried syncdb, all up to date
  • I have connected to the db and all looks well there
  • urls.py seems to reflect all the urls in dev

I am not quite sure where to go here. Better logging would certainly help. Any help would be greatly appreciated.

Per request:

settings.py

DEBUG = True
TEMPLATE_DEBUG = DEBUG

TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
 #'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
)

ROOT_URLCONF = 'fivebuckchuck.urls'

TEMPLATE_DIRS = (
'/home/MyUserName/5buckchuck.com/fivebuckchuck/templates'

)

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',

#5BC Stuff
'winerater',

#all-auth apps,
'emailconfirmation',
'uni_form',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.twitter',
'allauth.openid',
)


TEMPLATE_CONTEXT_PROCESSORS = (
'allauth.context_processors.allauth',
'allauth.account.context_processors.account',
'django.core.context_processors.media',
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
)

and the urls.py

from django.conf.urls.defaults import *
from winerater.views import *
from settings import MEDIA_ROOT
from django.views.generic.simple import direct_to_template
from django.views.generic.simple import redirect_to

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Example:
# (r'^mobile_5BC/', include('mobile_5BC.foo.urls')),

# Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
# to INSTALLED_APPS to enable admin documentation:
(r'^admin/doc/', include('django.contrib.admindocs.urls')),

(r'^admin/', include(admin.site.urls)),
(r'^$', front_page),
(r'^user/(\w+)/$', user_page),
(r'^login/$', 'django.contrib.auth.views.login'),
(r'^login/success/$', direct_to_template,
{'template': 'front_page'}),    
#(r'^accounts/login/$', 'django.contrib.auth.views.login'),
 (r'^logout/$', logout_page),
  (r'^media/(?P<path>.*)$', 'django.views.static.serve',
   {'document_root': MEDIA_ROOT}),
  (r'^register/$', register_page),
  (r'^register/success/$', redirect_to,
   {'url': '/login/'}),
  (r'^save/$', wine_add_page),
  (r'detail/(\w+)/', wine_detail_page),
  (r'wine_image/(\w+)/$', wine_image),    
  (r'wines/([^\s]+)/$', wine_results),
  (r'review/(\w+)/$', wine_review_page),
  (r'^accounts/', include('allauth.urls')),
  (r'^accounts/profile/', front_page),
)

and the passenger_wsgi.py

import sys, os
INTERP = '/home/MyUserName/local/bin/python' # Is my actual username
if sys.executable != INTERP:
   os.execl(INTERP, INTERP, *sys.argv)
sys.path.append(os.getcwd())
sys.path.append(os.getcwd()+'/fivebuckchuck')
os.environ['DJANGO_SETTINGS_MODULE'] = "fivebuckchuck.settings"
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Solution

  • Issue ended up being Dreamhost writing an .htaccess file that had items for PHP in it, this subverted Django's URL reading scheme. Hope this might help other users.