-
Notifications
You must be signed in to change notification settings - Fork 187
DELETE causes 403 Forbidden errors #14
Comments
I have not been able to reproduce the "forbidden" error, but deletion of file has been prioritised until now. Delete should work now. But maybe you'll still be stuck in the "forbidden"? I'm closing it as delete now works nice on my side, using runserver in a virtualenv. |
That's so weird.... I did a pull and re-ran it: [30/Jun/2012 11:46:36] "GET /static/img/loading.gif HTTP/1.1" 200 3897 This is in a virtualenv (no site packages) with: Django==1.4 I deactivated the virtualenv and tried to run with my system-level django, AND IT WORKED JUST FINE! Am I forgetting some trivial dependency in my virtualenv? Would you mind sharing your pip requirements setting? |
Thank you so far. When checking the installed packages in the virtualenv, I saw I had an old django (1.3.1). After upgrading I now have the same "forbidden" error. It seems we have some changes to how CSRF is working in 1.4. I'll keep you posted! |
I added a csrf.js that will add a csrf header to all ajax requests. Fixed in commit 297bc51 |
Just for the record, my virtualenv now contains: Django==1.4 |
Everything works great now -- awesome. Thanks man, you rock! |
Thanks! Glad we got this working. |
I experience this same issue with the latest code base. Here are dpastes of settings/configs/etc. csrf: http://dpaste.org/fgb5p/ html: http://dpaste.org/AdBaS/ rendered page source: http://dpaste.org/wkFQq/ views: http://dpaste.org/wQTRw/ error: http://dpaste.org/f5L7v/ docs: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/ https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#django.views.decorators.csrf.ensure_csrf_cookie At this point I believe it has something to do with the template, I'm just not sure how/why. I have this in another Django project and it works just fine. Current project's packages: http://dpaste.org/IHfO7/ Working Django Project's Packages: dpaste.org/BPOOX/ |
Perhaps jquery isn't being loaded. Looking at your rendered page source, you're missing "http:"
|
I downloaded jquery.min.js locally: <script src="{{ STATIC_URL }}js/jquery.min.js"></script>Same behavior. |
Somehow, your rendered HTML has duplicated code:
I just ran it locally, and that shouldn't happen. Furthermore, the first instance of this code is proceeded by csrf include. The second version is not.... so the csrf protection is (probably) not getting called on the superceedeing (final) include....? |
You're correct. I had picture_form.html which included these files. But it inherited from base.html (from my project) which also included these same files. Removing these links in picture_form.html fixed my issue. |
Initial install works fine for adding. Deleting removes the image from the client side, but the server throws 403 forbidden error and never reaches PictureDetailView.delete (so the database record does not get deleted):
[29/Jun/2012 23:02:22] "DELETE /upload/delete/11 HTTP/1.1" 403 2294
Any pointers greatly appreciated.
This is using basic "manage.py runserver" (rather than nginx) on Django 1.4.
The text was updated successfully, but these errors were encountered: