Django server error 500 except for admin page

I'm getting a Server Error (500) when accessing any of the urls of my Django project, except for the /admin. I can access the admin page, and perform crud operations to my models as in development.

However, Server Error (500) appears when trying to access any of my urlpatterns. If I type a different url (not present in the, I get a different error:

Not Found
The requested resource was not found on this server.

I'm using docker-compose with nginx and wsgi and now testing on local machine. Why there are those diferences with the urls and what kind of error it can be? I'm just getting this logs in the terminal when server error message:

suii-app-1          | [pid: 14|app: 0|req: 8/18] () {56 vars in 1083 bytes} [Fri Jan 27 20:08:17 2023] GET / => generated 145 bytes in 91 msecs (HTTP/1.1 500) 7 headers in 240 bytes (1 switches on core 0)
suii-proxy-1        | - - [27/Jan/2023:11:08:17 +0000] "GET / HTTP/1.1" 500 145 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36" "-"

This is a snippet of some view:

def indice(request):
    return render(request, 'indice.html')

def index(request):
    sousei = Sousei.objects.latest()
    context = {
        'sousei': sousei,
    return render(request, 'index.html', context)

I created that first dummy view with a sample template with some static text and is showing correctly, however all the other paths are like that index view, and all retrieve information from the database. All of them are giving server error (even though the data is there as I can see it from the /admin).

And the urls of the project

urlpatterns = [
    path('', include('kansoku.urls', namespace='kansoku')),
    path('login/', LoginView.as_view(template_name='registration/login.html', redirect_authenticated_user=True), name='login')
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

For reference, error is showing also to login view. 'indice' view is showing at /indice which is inside kansoku app urls.

Back to Top