user7804233
user7804233

Reputation:

Django 500 server error only in one URL

I have a Django project in production and when I try to access /calendar endpoint it shows me a 500 error.

In local development all the urls work fine, and in production too except this one.

Where and how can I check why this endpoint throws an 500 error?

views.py

def calendar_view(request):
    if request.user:
        events = Event.objects.filter(owner=request.user)
    else:
        events = Event.objects.filter(author='anonymous')
    js_data = serialize('json', events)
    return render(request, 'calendar/calendar.html', {'js_data': js_data, 'events': events})

More information

In the admin site, I can't access to Event model. I obtain 500 server error too.

Upvotes: 1

Views: 702

Answers (1)

user7804233
user7804233

Reputation:

I've found the answer.

I've changed debug=True in production and I could see that a migration was not applied and it breaks the model.

Upvotes: 1

Related Questions