Jump to content

[SOLVED] Django admin site


Alex Boyce

Recommended Posts

I don't understand what happened. On Thursday, I tested my site and everything was working. I was able to log into the Django admin site (www.klickfu.com/admin) and do everything. On Saturday, my colleague said that he couldn't get in. I checked and he was correct. All references to the admin site result in an exception which tries to display a 500.shtml page (which I didn't make, so it turns into a 404 error). None of the files changed, so I don't understand why it broke and I have no way to see the actual exception. The site error log simply states that the WSGI script threw an exception.

 

The only admin link that does work is www.klickfu.com/admin/logout. It seems to work and logs me out, and if I try to log in from the subsequent screen, I get the log in prompt. But as soon as I enter my credentials and click Login, I get the 500 error.

 

Any suggestions on how to figure this out?

Link to comment
Share on other sites

Please refer to the Solving Internal Server Errors wiki article for information about 500 errors.

 

Thanks for the reference, but none of it seems to be applicable to this situation.

1) Server load is less than 4

2) If don't have control over the permissions for the django folders, but they were correct two days ago and pieces of it work, so I assume they are still correct.

3) I am not running any other processes on my site.

 

What I really need is a way to get the actual exception thrown to be displayed in the error log or on the screen.

Link to comment
Share on other sites

Guest Geoff

Put this in your dispatch.wsgi:

 

try:
    #Old dispatch.wsgi code goes here (make sure it's tabbed in!).
    
except: 
    import traceback
    
    trace = traceback.format_exc()
    
    def application(environ, start_response):
    
        status = '500 Internal Server Error'
        output = trace
                        
        response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
        start_response(status, response_headers)
                
        return [output]

Link to comment
Share on other sites

Put this in your dispatch.wsgi:

 

try:
    #Old dispatch.wsgi code goes here (make sure it's tabbed in!).
    
except: 
    import traceback
    
    trace = traceback.format_exc()
    
    def application(environ, start_response):
    
        status = '500 Internal Server Error'
        output = trace
                        
        response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
        start_response(status, response_headers)
                
        return [output]

 

 

Thanks, this helped a lot!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...