Git Product home page Git Product logo

django-rest-imageupload-example's People

Contributors

anx-ckreuzberger avatar christiankreuzberger avatar colinpade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-rest-imageupload-example's Issues

Sample Images might be too big.

Thank you for putting together this tutorial. However 18MB of sample images is unnecessary. Not a big deal, just a suggestion.

Make a relationship to User Model

I have 2 question hope you make me clear.

  1. I follow your instruction to make a relationship to User Model. User can upload his / her avatar to album photo and have a CURRENT PHOTO like Facebook. But I've been failed. How can I make a field: Current Photo with your instruction.
  2. If I use Sorl Thumbnail. Is it better than Pillow package you make?

Need to add app_name in urls.py for step 3

Environment:

Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) 

Django==2.1.7
django-filter==2.1.0
djangorestframework==3.9.1
Markdown==3.0.1
Pillow==5.4.1
pytz==2018.9

Error in step 3 when adding the API urls to the backend for browsing:

File "/.../django-rest-imageupload-example/venv/lib/python3.6/site-packages/django/urls/conf.py", line 39, in include
    'Specifying a namespace in include() without providing an app_name '
django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.

ref: https://code.djangoproject.com/ticket/28691

fix is to add the line app_name="imageupload_rest" to imageupload_rest/urls.py

from django.conf.urls import url, include
from rest_framework import routers

app_name="imageupload_rest"

router = routers.DefaultRouter()

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    url(r'^', include(router.urls)),
]

How to Post image using API

I have cloned and am using the framework.
I am not able to figure out how to upload an image via a POST request.

IOError: [Errno 2] No such file or directory:

Is it necessary for to create directory first?

below my tracetack.:

Internal Server Error: /api/images/ Traceback (most recent call last): File "C:\anwar\poken-psp-venv1\lib\site-packages\django\core\handlers\exception.py", line 41, in inner response = get_response(request) File "C:\anwar\poken-psp-venv1\lib\site-packages\django\core\handlers\base.py", line 187, in _get_respo nse response = self.process_exception_by_middleware(e, request) File "C:\anwar\poken-psp-venv1\lib\site-packages\django\core\handlers\base.py", line 185, in _get_respo nse response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\anwar\poken-psp-venv1\lib\site-packages\django\views\decorators\csrf.py", line 58, in wrapped_ view return view_func(*args, **kwargs) File "C:\anwar\poken-psp-venv1\lib\site-packages\rest_framework\viewsets.py", line 83, in view return self.dispatch(request, *args, **kwargs) File "C:\anwar\poken-psp-venv1\lib\site-packages\rest_framework\views.py", line 483, in dispatch response = self.handle_exception(exc) File "C:\anwar\poken-psp-venv1\lib\site-packages\rest_framework\views.py", line 443, in handle_exceptio n self.raise_uncaught_exception(exc) File "C:\anwar\poken-psp-venv1\lib\site-packages\rest_framework\views.py", line 480, in dispatch response = handler(request, *args, **kwargs) File "C:\anwar\poken-psp-venv1\lib\site-packages\rest_framework\mixins.py", line 21, in create self.perform_create(serializer) File "C:\anwar\poken-psp-venv1\lib\site-packages\rest_framework\mixins.py", line 26, in perform_create serializer.save() File "C:\anwar\poken-psp-venv1\lib\site-packages\rest_framework\serializers.py", line 214, in save self.instance = self.create(validated_data) File "C:\anwar\poken-psp-venv1\lib\site-packages\rest_framework\serializers.py", line 906, in create instance = ModelClass.objects.create(**validated_data) File "C:\anwar\poken-psp-venv1\lib\site-packages\django\db\models\manager.py", line 85, in manager_meth od return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\anwar\poken-psp-venv1\lib\site-packages\django\db\models\query.py", line 393, in create obj.save(force_insert=True, using=self.db) File "C:\anwar\lat\django-rest-imageupload-example\django_rest_imageupload_backend\imageupload\models.p y", line 78, in save self.thumbnail = create_thumbnail(self.image) File "C:\anwar\lat\django-rest-imageupload-example\django_rest_imageupload_backend\imageupload\models.p y", line 47, in create_thumbnail image.save(os.path.join(settings.MEDIA_ROOT, new_filename)) File "C:\anwar\poken-psp-venv1\lib\site-packages\PIL\Image.py", line 1823, in save fp = builtins.open(filename, "w+b") IOError: [Errno 2] No such file or directory: 'C:\\anwar\\lat\\django-rest-imageupload-example\\django_re st_imageupload_backend\\..\\uploaded_media\\28dc9166-8b83-4cd1-8a67-3cea6b31cfa7_thumb.jpg' [02/Aug/2017 18:03:59] "POST /api/images/ HTTP/1.1" 500 19024

Extension of this project

This is not an issue, but I am trying to extend this project by adding few more functionalities to it like:
1)I want to add one more button for every image called segment(see image)
2)on clicking this button that corresponding image should be passed to my view(python script).this python script returns four values(x,y,w,h) and i want to render these coordinates as a bounding box on the corresponding image.

Can you point me to the right resources to learn about this and implement it.

Chapter 3?

Hi, I've followed along and want to thank you so much. Did you ever create chapter 3?
Cheers
Wayne

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.