Page Displaying Server Error (500)

I have a django restframework app that is using render postgreql database. The database is avaliable and i also used the webservice. i followed every instruction on how to do it and it was deployed without any errors. but when i want to access the url to see my api, i get the Server Error (500) displaying on the page. My logs dosent even have any errors.

Please what could be the issue and how can i make it work?

Hi

When a 500 error occurs, that will be an issue in your code, and this will usually show an error in the logs. However, we often see that Django’s default logging in production mode/Debug=False suppresses a lot of detail.

I’m not a Python/Django expert, and general code debugging is beyond the scope of our support, but based on this Stackoverflow post, maybe try adding more logging to the settings.py, temporarily to see if the error will appear in the logs, some like:

import sys

and a LOGGING declaration

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
            'datefmt' : "%d/%b/%Y %H:%M:%S"
        },
        'simple': {
            'format': '%(levelname)s %(message)s'
        },
    },
    'handlers': {
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'stream': sys.stdout,
            'formatter': 'verbose'
        },
    },
    'loggers': {
        'django': {
            'handlers':['console'],
            'propagate': True,
            'level':'DEBUG',
        },
        'MYAPP': {
            'handlers': ['console'],
            'level': 'DEBUG',
        },
    }
}

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.