whoisearth
whoisearth

Reputation: 4170

why am I getting a 500 response?

I'm including below snippets from all the files. I'm simply doing an import on all in all the various files for the models/serializers/views/etc. I have other views based off of model serializers and they work fine but this one seems to be causing me grief and I don't know why.

My urls.py -

url(r'^deploy/resource/$', DeployResourceFilterView.as_view(), name='DeployResourceFilterView'),

views.py

class DeployResourceFilterView(generics.ListAPIView):
    serializer_class = ResourceSerializer

    def get_queryset(self):
        resname = self.request.GET.get('name')
        queryset = Resmst.objects.db_manager('Admiral').filter(resmst_name=resname)
        if queryset:
            return queryset
        else:
            raise Http404

serializers.py

class ResourceSerializer(serializers.ModelSerializer):

    class Meta:
        model = Resmst
        resource_name = 'resmst'
        depth = 1

models.py

class Resmst(models.Model):
    resmst_id = models.IntegerField(primary_key=True, db_column='resmst_id')
    resmst_name = models.CharField(max_length=30, blank=True)
    resmst_desc = models.TextField(blank=True)
    resmst_limit = models.IntegerField(blank=True, null=True)
    resmst_inuse = models.IntegerField(blank=True, null=True)
    resmst_active = models.CharField(max_length=1, blank=True)
    resmst_lstchgtm = models.DateTimeField(blank=True, null=True)
    resmst_prntid = models.IntegerField(blank=True, null=True)
    resmst_owner = models.ForeignKey(Owner, db_column='owner_id', verbose_name='owner')
    resmst_public = models.CharField(max_length=1, blank=True)
    resmst_locked = models.IntegerField(blank=True, null=True)
    resmst_offline = models.IntegerField(blank=True, null=True)
    class Meta:
        managed = False
        db_table = 'resmst'

I'm trying to hit http://localhost:9001/deploy/resource/?name=thisisthename

Something is being overlooked but I can't find what it could be.

Upvotes: 0

Views: 71

Answers (1)

Carlos Calla
Carlos Calla

Reputation: 6706

It is hard to debug at this point because the code seems to be right and you should give Django error page information.

I would recommend to set the variable DEBUG = True in the settings.py so you can see the Django error page information and start troubleshooting from there.

Post the errors you get so I can update my answer and give you better help.

Upvotes: 1

Related Questions