Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3875540
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:16:43+00:00 2026-05-19T22:16:43+00:00

I have a Django app running django-piston for the first time. I’ve got a

  • 0

I have a Django app running django-piston for the first time.

I’ve got a handler configured for a model and it’s rigged for GET and POST.

GET works fine. Tried and true.

POST however is sucking. When I post data to it, I am getting this error

Responded: Piston/0.2.3rc1 (Django 1.2.4) crash report:

Method signature does not match.

Resource does not expect any parameters.

Exception was: cannot concatenate 'str' and 'dict' objects

I’m really not a pro at Python but some basic Googling reveals that this seems to be a rather generic Python TypeError

So here’s some code.

urls.py (relevant parts)

auth = DjangoAuthentication()
ad = { 'authentication': auth }

word_handler = Resource(handler = WordHandler, **ad)

urlpatterns = patterns(
    url(r'^word/(?P<word_id>[^/]+)/', word_handler),
    url(r'^words/', word_handler),
)

handlers.py (relevant parts)

class WordHandler(BaseHandler):
    allowed_methods = ('GET','POST',)
    model = Word

    fields = ('string', 'id', 'sort_order', ('owner', ('id',)),)

    def read(self, request, word_id = None):
        """
        Read code goes here
        """

    def create(self, request):

        if request.content_type:
            data = request.data

            print("Words Data: " + data)

            existing_words = Word.objects.filter(owner = request.user)

            for word in data['words']:

                word_already_exists = False

                for existing_word in existing_words:

                    if word["string"] == existing_word.string:
                        word_already_exists = True
                        break


                if not word_already_exists:
                    Word(string = word["string"], owner = request.user).save()

            return rc.CREATED

Basically it’s not even getting to create() at all, or at least it seems not to. It just craps out with the aforementioned error, so I can’t even see how it’s receiving the data.

And just for the hell of it, here’s the data I am trying to POST

{"words":[{"owner":{"id":1,"tags":null,"password":null,"words":null,"email":null,"firstname":null,"lastname":null,"username":null},"id":1,"sort_order":0,"tags":null,"string":"Another Test"},{"owner":{"id":1,"tags":null,"password":null,"words":null,"email":null,"firstname":null,"lastname":null,"username":null},"id":2,"sort_order":0,"tags":null,"string":"Here's a test"},{"owner":null,"id":0,"sort_order":0,"tags":null,"string":"Tampa"}]}

Any information at all would be extremely helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T22:16:44+00:00Added an answer on May 19, 2026 at 10:16 pm

    I solved this for myself.

    The relevant cause of the error is this line in the create method

    if request.content_type:
    

    which does not evaluate as True as I think the creators of the django-piston documentation intended. Even if the value is a string with a value.

    Removing this line solved it. And I’m sure you can probably just do a string evaluation.

    Not really sure what they were thinking there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Django app running on apache server (mod_python) on a windows machine
I have configured my Django app to run under Apache+FastCGI on Linux (Ubuntu, if
I have a simple django app that is using only the admin. This is
I have a django app that uses MySQL as the database backend. It's been
I have written a Django app that makes use of Python threading to create
I have a running django project and i want to integrate Satchmo with that
I'm working on a django app for a site that requires an image gallery.
I'm using django.core.mail.EmailMultiAlternatives when sending e-mails from my django app in an attempt to
I am writing a Python/Django web application that uses OAuth (for the TwitterAPI, not
I followed the Djangoappengine instructions. I used their django-testapp and copied the following folders

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.