مريم خالد
How I populate the social account provided by allauth to my custom user model. with social applications Google for a flutter application with allauth + dj_rest_auth. since i only get the token from google social auth , how can i get the other field in my custom user when the user log in using google
Careful
and I used the class {{form|crispy}}
you should use {% crispy form %}
Careful
and in your forms.py you should add classes and style for the fields
Careful
Ok thanks
https://simpleisbetterthancomplex.com/tutorial/2018/11/28/advanced-form-rendering-with-django-crispy-forms.html
Careful
look at this
Careful
I had some issues with crispy now using django widgets tweak
Aby
I am making a chatbot , need to scrap data from FAQs of the same website and return as replies to bots Is it possible ( getting error as both webpage and django is using same port for running)
Suryo Adhy Chandra
Postgresql
i think it depend on your pc that used to serve the database. if you have low RAM and serve thousands data, it will be leaking.
The Inspired
I am making a chatbot , need to scrap data from FAQs of the same website and return as replies to bots Is it possible ( getting error as both webpage and django is using same port for running)
Yes. you can change the port that django runs on by typing python manage.py runserver (port_number_here) e.g. python manage.py runserver 8001
Lalit
i think it depend on your pc that used to serve the database. if you have low RAM and serve thousands data, it will be leaking.
I am showing only 10 rows using pagination. But before the pagination I am filtering the data. At the time of filter its fetching all tha data. Because there is a column where I have to show filter data. I am showing only 10 rows of data.
Lalit
Anyone have any idea
Suren
Hi everybody, please help to solve, when I enter command django-admin makemessages -l en -e html get below error message CommandError: Can't find msguniq. Make sure you have GNU gettext tools 0.15 or newer installed.
Suren
And have you tried to do what the error says?
yes. when I tried command "pip install gettext" it gives me another error "ERROR: Could not find a version that satisfies the requirement gettext (from versions: none)" "ERROR: No matching distribution found for gettext"
Suren
And have you tried to do what the error says?
everywhere there is a manual to this error for ruby, but I am working on project locally in windows
Mohammad Hossein
Hi everyone I want to deploy a project on a server. Do you have any instruction for it? Is runserver command enough?
Adzmely
Hi everyone I want to deploy a project on a server. Do you have any instruction for it? Is runserver command enough?
For development runserver will be enough, but the best and production to have a full stacks of web and application server, you can use nginx for web, and uwsgi as the application server for your python/django project
Mh
Suggest a youtube tutorial for learning django rest framework
Bekhruzbek
Learn how to upload a video for a movie website
.
In serializers.py file I'm getting an error in 1st line. "import rest_framework could not be resolved". Any suggestions on this ? How to solve this error ?
.
Issue resolved. It was showing error bcz of virtual env.
Mohammad Hossein
What is the main different between APIView and a normal djago view?
cj
What is the main different between APIView and a normal djago view?
one is for an API view, the other one for a "normal" view
Mohammad Hossein
cj
What if we use them as each other?
you can, but that's nonsense, you can wear pants on your arms, right? yes you can, but is it worth to do that? does it make sense? no right, that you can do things doesn't mean that you should do them
cj
Do you mean function based view?
read his question again until you understand it, and you'll get your answer
Jairaj
I think he meant a function?
cj
I think he meant a function?
what did make you think that?
Mulünur
Hello! I'm new to django. I'm trying to upload an image from react-native to django, but the image is not coming to the ImageField. In /api/views.py I'm using ModelViewSet: class ItemsViewSet(viewsets.ModelViewSet): queryset = Items.objects.all() serializer_class = ItemsModelSerializer parser_classes = (MultiPartParser, FormParser) On the server side, the error is "POST /api/items/ HTTP/1.1" 400 85 In react-native, I use FormData to submit an image. formData.append('image', image?.uri, "image_test.jpg") The header for 'POST' is 'multipart/form-data' so on the front side i catch the error: RESPONCE FROM POST{"image":["The submitted data was not a file. Check the encoding type on the form."]} my uri is looking like : "uri": "file:///var/mobile/Containers/Data... serializers.py contains ordinary Meta class and this code: class ItemsModelSerializer(serializers.ModelSerializer): image = serializers.ImageField(use_url=True) I don't understand what could be wrong with image uri. I'm stuck in a swamp. Thank you for your attention!
Mulünur
i take a picture with a camera and get an object like this [ {"assetId": null, "base64": null, "duration": null, "exif": null, "fileName": null, "fileSize": 608752, "height": 4032, "type": "image", "uri": "file:///var/mobile/Containers/Data/Application/236D8E4D-C15C-47B8-8D0F-BD9BE29BC951/Library/Caches/ExponentExperienceData/%2540anonymous%252FNarniaApp-f3a3e2c5-afae-4102-a8a2-13f0b986914d/ImagePicker/5267C0FB-888D-4437-AA57-4562650A2A2E.jpg", "width": 3024} ] after I take assets[0] - this is my picture. I think I need to send uri field to the backend. If i try to send whole assets[0], like you said — app crashed. If i try to send assets[0].uri without field 'image' i get this error: RESPONCE FROM POST{"image":["No file was submitted."]} Because for a formData with file you need to 3 parameters
Mulünur
Seems like it's validation error. Can you send your full header?
my request is: const response = await fetch(`${HOST_WITH_PORT}/api/items/`, { method: 'POST', headers: { 'Content-Type': 'multipart/form-data' }, body: formData }) const data = await response.json() console.log("RESPONSE FROM POST" + JSON.stringify(data)) i tried to use FileUploadParser instead of FormParser (FormParser is for web, and i think my pictures from camera is raw). But no results
Anonymous
Try to send request without optional chaining
Anonymous
Also check type of object your camera returns
Mulünur
formData.append('image', image?.uri, "image_test.jpg") Could be that your image?.uri returns not object but undefined and you don't know about it because it does not throwing error
Thank you for your responsiveness. I think this is not possible, because the photo immediately appears in the Image component, where I specify the received uri as the source. But it can't be sent to the backend.
Mulünur
Try to send request without optional chaining
if i send fetch only to specified address, without anything else, then get request works
Jairaj
Your model serializer doesn't have class meta
Jairaj
Maybe you should try it from postman first
Mulünur
Your model serializer doesn't have class meta
it is, it's just an ordinary code and I decided not to insert it
Anonymous
it is, it's just an ordinary code and I decided not to insert it
Try to specify model in serializers meta class
Anonymous
class ImageSerializer(serializers.ModelSerializer): image = ImageField( max_length=None, use_url=True, ) class Meta: model = Image fields = ("id", 'image', 'owner', 'time_created', )
Brutus
i started learning channels but getting error in setting up websocket connection, tried google n all but no help WebSocket connection to 'ws://127.0.0.1:8000/ws/' failed: this is what i'm getting in console, checked all settings i know about no help
Mulünur
class ImageSerializer(serializers.ModelSerializer): image = ImageField( max_length=None, use_url=True, ) class Meta: model = Image fields = ("id", 'image', 'owner', 'time_created', )
Thank you, I set max_length, but no result class ItemsModelSerializer(serializers.ModelSerializer): image = serializers.ImageField(use_url=True, max_length=None) class Meta: model = Items fields = ('image', 'category', 'color', 'id', 'rmbg_image') i tried just to fetch response from image uri and make it blob, but it also without luck, I get "network fail error"
Jairaj
If network error is coming, that's means there is problem with code
Александр
Hello, how can I get data from a table created with django models from an application without django? when i try to get data i get an error: django.core.exceptions.ImproperlyConfigured: Requested settings, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
jūdê
I’m experiencing a “Register.__init__() got an unexpected keyword argument ‘refresh_token’” in the response body While trying to register a user using django-graphql-auth package Please if you’ve integrated this before, please help me out
Mulünur
I solved my problem with help of some wonderful person, who once again directed my attention to this link Tl;dr — use base64 https://stackoverflow.com/questions/64452063/how-to-upload-an-image-from-a-react-native-app-expo-to-a-django-server
bestmem
Can anyone recommend the django3.2 program for practice
Rohan
3.2 was LTS if I remember correctly.
kiran
When i upload a file in django it works perfectly in local host
kiran
But in server it gives a error 500 internal server erroe on in case of large files.. is there any to upload large files without erroe
Baba
I'm trying to upload image from django admin panel in Pythonanywhere but it shows me this error. from PIL import Image ModuleNotFoundError: No module named 'PIL' I even installed pillow in my virtualenv but still not working
Nishanth Siraj
In shell, run: pip install Pillow Attention: PIL is deprecated, and pillow is the successor
Nishanth Siraj
From pillow import ...
Baba
From pillow import ...
Do I need to change the django default code to this? I've already run "pip intall Pillow", still not working
Baba
But I don't have a requirement.txt file. I just install directly
Baba
Tell me the steps plss, thanks
Charly
Tell me the steps plss, thanks
Or you can check pythonanywhere documentation
Om
Can anyone tell me why to drf if I can just direct submit the data using post request