âshîsh
Your welcome.
Poojitha
anyone know how to host django website without venv?
Mirco
anyone know how to host django website without venv?
Create the venv, it's always much better
Michael
Add also the protocol ( https )
Thanks but it's still not working
Michael
def verify_payment(self, ref, *args, **kwargs): path = f'transaction/verify{ref}' headers = { 'Authorization': f"Bearer {self.PAYSTACK_SECRET_KEY}", 'content-type': 'application/json' } url = self.base_url + path response = requests.get(url, headers=headers) if response.status_code == 200: response_data = response.json() return response_data['status'], response_data['data'] response_data = response.json() return response_data["status"], response_data["message"] This is my code here
Mirco
I keep getting this errors after successful payments
are u sure don't you need a / after verify and before ref ?
Mirco
I bet my 2 cents the url is /verify/<ref> following REST hence you receive the Connection Error due to wrong URL pattern
Mirco
and self.base_path + url can be converted to an f-string as well f"{self.base_path}{url}"
Michael
I appreciate your efforts man But it's still not working
Michael
ConnectionError at /verify/Kss45FotAtdjLAthoDzKeFme-YYoQAd_h0Jcc4sqf9NEpJaXmjMyaXAK-xx2RBpiqow/ HTTPSConnectionPool(host='api.paystack.cotransaction', port=443): Max retries exceeded with url:
Mirco
curl https://api.paystack.co/transaction/verify/:reference -H "Authorization: Bearer YOUR_SECRET_KEY" -X GET from Paystack API docs your URL -> https://api.paystack.cotransaction/veryfy/{ref} as u can see you miss a / between .co and transaction
Marcos
the url is wrong
Marcos
should be: https://api.paystack.co/transaction and you have: https://api.paystack.cotransaction
Mirco
based on your code, just change path = f'transaction/verify{ref}' to path = f'/transaction/verify/{ref}' and it will work
Mirco
I appreciate your efforts man But it's still not working
learn how to read documentation when using a 3rd party service man 😊
Marcos
ammm i think this is not a documentation error as he went through all the other details correctly but a silly typo error and mihael was confused because requests didn't told him that the URL was wrong, however requests does not guess which server are you trying to onnect to it only tries to connect but not able due to the typo and says connectionerror
Marcos
totally agree with you man, i guess michael will be starting using https://docs.python.org/3.7/library/urllib.parse.html since today, otherwise he did not learn anything from today
Michael
learn how to read documentation when using a 3rd party service man 😊
Thanks man I appreciate And yes I read the document but i don't really have much experience in development yet that's why
Doragonsureiyā
Thank you very much
You're welcome! 😊
Shanmukh
Hello, Why does From django.contrib.auth logout(request) Doesn't work ?? After running this still the user(used user model) doesn't get logout?? Thanks in Advance
Shanmukh
Check whether other views require authentication.
Yes it requires authentication for other views
Michael
JSONDecodeError at /3dMMlXI9v1r-VKlfaqfNc3P44jC560mZr1SZFbczSmG6pjqT9451P5Ob0f3THCVkEPY/ Expecting value: line 1 column 1 (char 0) Any idea on what's going on
Suleman
Hey Guyz. Does anybody get a chance to integrate bitpay with django. I got some issues related to it
Suleman
can anybody please help me out in this
Suleman
i need some guide to integrate through this
Suleman
thanks
ADI
Reverse for 'edit_movies' with arguments '('',)' not found. 1 pattern(s) tried: ['edit/(?P<id>[0-9]+)/$'] i am facing this error any one tell
GOPINATH
Can anyone help me with postman token authentication
GOPINATH
I am facing issues in connecting that
GOPINATH
I have provided the bearer token
GOPINATH
But still it shows unauthorised 401
GOPINATH
But I can able to connect through httpie with that token
GOPINATH
That token is created for superuser
Ash
Is the token a jwt token
GOPINATH
No
Riswandi
but I don't like it
Shruti
I am create a profile is shows default data but not show in take extra field data after sign up like city mobile and state can you help
pat
My celery can't run models from tasks.py.. Do I need signals to manipulate models in tasks.py with celery?? Halp
pat
I'm having headaches for 3days guys.. Pls
pat
My question is : how to pass models in tasks.py?
B
Good day, please I'd like to ask if anyone can send resources for Django and using websocket. Thanks
pat
Can anyone tell me how to import model in celery task.py
Same problem here.. Did you find the solution?
pat
I tried to run tasks in celery.py but i stumbled on import error my tasks in celery.py
I have the same problem importing my models in celery via tasks.py.. Did you find the solution?
Suleman
Hey Guyz. Does anybody get a chance to integrate bitpay with django. I got some issues related to it can anybody please help me out in this i need some guide to integrate through this
Michael
you are not sending raw data in json format so json can't return a python dict
if response.status_code == 200: response_data = response.json() return (response_data['status'], response_data['data']) response_data = response.json() return (response_data["status"], response_data['amount']) What did I do wrong here
Marcos
first instead of response.status_code you should use: if response.ok requests library behind the scene checks for diferent status codes like 200, 201, etc now the error here is that what you are receiving in response is not well formated as json you should check what response.content contains, it contains the raw response of the webserver, response.json() parses response.content into a python dict object
Ashu
Looking for freelancer on python & Django..pls ping me separately if anyone interested..
Michael
first instead of response.status_code you should use: if response.ok requests library behind the scene checks for diferent status codes like 200, 201, etc now the error here is that what you are receiving in response is not well formated as json you should check what response.content contains, it contains the raw response of the webserver, response.json() parses response.content into a python dict object
I made the corrections and still getting same error if response.ok: response_data = response.json() return response_data['status'], response_data['data'] response_data = response.json() return response_data["status"], response_data['amount']
Marcos
have you already checked what does the webserver is responding to you as i said above? what does response.content "contains" if response.content has the following => b'{"this_is_the key": "this is the value"}' requests library will be able to parse it successfuly and will return to you in response.json() the following => {'this_is_the_key': 'this is the value'} on the other hand if response.content 'contains' the following => b'this is another response bla bla bla' requests library will not be able to parse it as json is like you are trying to perform this: import json json.loads('bla bla') it will raise json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Marcos
Ok
Editing Name
Hello
Poojitha
Can anyone tell me how to resolve this error (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)") in windows
Doragonsureiyā
Can anyone tell me how to resolve this error (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)") in windows
Maybe anyone is here, yes, but they are not obliged to read everyone's message here neither to reply to everyone's message, if someone wants to reply to your message, they will do that, just don't try to draw attention to your message writing "anyone?" every 5 minutes, that will lead you to be warned for SPAM/Flood, just be patient or use Google/DuckDuckGo to research about your question instead of wasting time here waiting for people to do your work. Have a nice day 😊
VISHNU
In generic relationship in that content type field in admin panel can I able to restrict to show 2 models in drop-down which i need there are many model in that model so I need to show only 2 models can any one help me on this.
@𝑺𝒐𝒃𝒌𝒂
Hi guys. I'm novice in Django. I'm creating an admin user but when the command line prompts to the password, it doesn't accept any character. What should be a problem?
@𝑺𝒐𝒃𝒌𝒂
Thank you!!
âshîsh
Mention not
A
Can I use grapesjs works with django?
Anonymous
How to build django in Blog application