'Unble to query django model using regex on live web server

I am working on querying django models using react axios get method and using regular expression to get the desired results. There is strange behaviour when request is made by the react axios get method. So, when I test on my local enviroment it works fine but when I put it on live web server it gives me 500 Internal Server Error.

My tastypie resource:

class ReportEmployeeResource(ModelResource):

    class Meta(CommonMeta):
        queryset = Employee.objects.all()
        resource_name = 'report-employee'
        filtering = {
            'fname': ALL,
            'lname': ALL,
            'date': ALL
        }

My Django Model:

class Employee(models.Model):
    fname= models.CharField(max_length=50)
    lname = models.CharField(max_length=50)
    date = models.DateField(db_index=True)

    class Meta:
        db_table = 'employee'
        unique_together = ('date','fname')

My react axios get request:

axios.request({
            method: 'GET',
            url: generateUrl('report', 'report-employee', [
                { key: 'lname__regex', value: '^((?!\\w+).)*$' },
                { key: 'date', value: startDate.format('YYYY-MM-DD') },
            ]),
            headers: {
                'Content-Type': 'application/json',
            },
        }).then(response => {
                        console.log(response.data);
             });

I have to use regex to check if lname has no words present in it. The request is working on local perfectly, but after putting it on live server it does not work.

When I removed lname__regex from the url it returns the response.

I am using Django 3.1.13 version, react 16.12.0 version, Live server is AWS EC2 with nginx configured with WSGI.

I am not sure what exactly is the cause is?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source