downloading image files from django template

2020-07-25 Thread Teaching Tech
How can I download an image file that is shown to the template in Django? 
I'm new to Django. This might be a silly question. But I need to know for 
my existing project.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/441320b3-f6cc-4390-b04e-0ef03abe10a5o%40googlegroups.com.


Shell script dynamic execution from app

2020-07-25 Thread ashish goyal
Hi guys, i have built an app for collecting various stats of environment. Its 
working.
Now i wanted to integrate it with all the utilities or shell scripts which are 
present on application server. So its like all scripts names as a list on 
django app and one click run pf those script. Currently those scripts are 
scheduled with control-m. I wanted to have a dynamic design of those scripts so 
that this all could be possible. Any leads?

Thanks
Ashish

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2DE1B9C9-9964-438B-AEF3-5C2DD31FE960%40gmail.com.


Re: help with my api and JWT

2020-07-25 Thread Robson Andrade
Hello friend,

I noticed that you are using the standard token authentication system. 
However, this method does not correspond to JWT.

Since you want to use authentication through JWT with DRF, you must use:

1) A JWT library that implements this type of authentication which helps 
you to create a login route to obtain the access token, route to the 
refresh token, or other routes and resources you need. I can recommend you: 
Simple JWT (my favorite) 
https://github.com/SimpleJWT/django-rest-framework-simplejwt or REST 
framework JWT Auth - https://jpadilla.github.io/django-rest-framework-jwt /

2) Next, you must correctly configure these Django modules.

3) When everything is properly configured, you must first obtain the access 
token and refresh token through a previously created user login.

4) Once you have the access token, you must send it to the request head as 
follows, for example:
 {Authorization: "Bearer 
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU5NTYwMzIyNSwianRpIjoiY2QxYTRiYWJiZTgzNDVhMjlkMGJmYTIzNTc0Zjk0ZjEiLCJ1c2VyX2lkIjo4fQ.i6bmtiqFyWyxo7mMuZxQjN9RvM-DjaiOwRVxeRBdiwM"}

5) Every 5 minutes you must request a new access token through the refresh 
token, but now in the body of the request:
 { "Refresh", 
"ppADdAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU5NTYwMzIyNSwianRpIjoiY2QxYTRiYWJiZTgzNDVhMjlkMGJmYTIzNTc0Zjk0ZjEiLCJ1c2VyX2lkIjo4fQ.i6bmtiqFyWyxo7mMuZxQjN9RvM-DjaiOwRVxeRBccdSA"}

Read this article: 
https://simpleisbetterthancomplex.com/tutorial/2018/12/19/how-to-use-jwt-authentication-with-django-rest-framework.html

Hope this helps!

See you later!

Em sábado, 25 de julho de 2020 16:52:38 UTC-3, ola neat escreveu:
>
> hey guy i got an issue implementing jwt in my drf project, i've got it 
> installed and when the user signs up or login the token get generated but 
> when i use the same token to test other end point i get 
> i've got my code and response attached 
> {
> "detail": "Authentication credentials were not provided."
> }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/069d7c8c-3aba-457c-ba7c-b047779a5f29o%40googlegroups.com.


Re: Import csv file on django view

2020-07-25 Thread Ronaldo Mata
Hi  Naresh Jonnala.

Yes, it's work to detect delimiter on csv file, But still I don't know how
to detect what is the current encoding of csv file 樂

I need to know how to implement a good uploading csv file  view on django

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%3DoziSPwdGc7UYn_WrJBqLM8sL-BZV5DjtUnu7eumsgcP0jsQ%40mail.gmail.com.


Re: Import csv file on django view

2020-07-25 Thread Naresh Jonnala
Hi,

I am not sure this will help or not, Still i want add a peace of code.

sniffer = csv.Sniffer()
dialect = sniffer.sniff()

dialect.__dict__
mappingproxy({'__module__': 'csv', '_name': 'sniffed', 'lineterminator': '\r\n',
'quoting': 0, '__doc__': None, 'doublequote': False, 'delimiter': ',',
'quotechar': '"', 'skipinitialspace': False})


lineterminator = dialect.lineterminator
quoting = dialect.quoting
doublequote = dialect.doublequote
delimiter = dialect.delimiter
quotechar = dialect.quotechar
skipinitialspace = dialect.skipinitialspace


csv.DictReader(self.file_open, **dialect)


Try this.

-
Naresh Jonnala
Hindustan.


On Saturday, July 25, 2020 at 8:03:44 AM UTC+5:30, Liu Zheng wrote:
>
> Yes. You are right. Pandas' default behavior is as following:
>
> encoding = sys.getsystemencoding() or "utf-8"
>
> I tried to open a simple csv encoded into "utf16-LE" (popular on windows), 
> and got the following error:
>
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: 
> invalid start byte
>
> On Sat, Jul 25, 2020 at 5:13 AM Ronaldo Mata  > wrote:
>
>> Hi Pandas require knows the encoding and delimiter previously when you 
>> use pd.read_csv(filepath, encoding=" ", delimiter=" ") I think that is the 
>> same 樂
>>
>> El vie., 24 de julio de 2020 3:42 p. m., Jani Tiainen > > escribió:
>>
>>> Hi,
>>>
>>> I highly can recommend to use pandas to read csv. It does pretty good 
>>> job to guess a lot of things without extra config. 
>>>
>>> Of course it's one more extra dependency. 
>>>
>>>
>>> pe 24. heinäk. 2020 klo 17.09 Ronaldo Mata >> > kirjoitti:
>>>
 Yes, I will try it. Anythin I will let you know

 El mié., 22 de julio de 2020 12:24 p. m., Liu Zheng <
 firstd...@gmail.com > escribió:

> Hi, 
>
> Are you sure that the file used for detection is the same as the file 
> opened and decoded and gave you incorrect information?
>
> By the way, ascii is a proper subset of utf-8. If chardet said it 
> ascii, decoding it using utf-8 should always work.
>
> If your file contains non-ascii UTF-8 bytes, maybe it’s a bug in 
> chardet? You can try it directly, without mixing it with django’s 
> requests 
> first. Make sure you can detect and decode the file locally in a test 
> program. Then put it into the app.
>
> If you share the file, i’m also glad to help you try it.
>
> On Thu, 23 Jul 2020 at 12:04 AM, Ronaldo Mata  > wrote:
>
>> Hi Kovy, this is not solved. Liu Zheng but using 
>> chardet(request.FILES['file'].read()) return encoding "ascii" is not 
>> correct, I've uploaded a file using utf-7 as encoding for example and 
>> the 
>> result is wrog. and then I tried 
>> request.FILES['file'].read().decode('ascii') and not work return bad 
>> data. 
>> Example for @ string return "+AEA-" string.
>>
>> El mié., 22 jul. 2020 a las 11:16, Kovy Jacob (> >) escribió:
>>
>>> I’m confused. I don’t know if I can help.
>>>
>>> On Jul 22, 2020, at 11:11 AM, Liu Zheng >> > wrote:
>>>
>>> Hi, glad you solved the problem. Yes, both the request.FILES[‘file’] 
>>> and the chardet file handler are binary handlers. Binary handler 
>>> presents 
>>> the raw data. chardet takes a sequence or raw data and then detect the 
>>> encoding format. With its prediction, if you want to open that puece of 
>>> data in text mode, you can use the .decode() method of 
>>> bytes object to get a python string.
>>>
>>> On Wed, 22 Jul 2020 at 11:04 PM, Kovy Jacob >> > wrote:
>>>
 That’s probably not the proper answer, but that’s the best I can 
 do. Sorry :-(


 On Jul 22, 2020, at 10:46 AM, Ronaldo Mata >>> > wrote:

 Yes, the problem here is that the files will be loaded by the user, 
 so I don't know what delimiter I will receive. This is not a base 
 command 
 that I am using, it is the logic that I want to incorporate in a view

 El mié., 22 jul. 2020 a las 10:43, Kovy Jacob (>>> >) escribió:

> Ah, so is the problem that you don’t always know what the 
> delimiter is when you read it? If yes, what is the use case for this? 
> You 
> might not need a universal solution, maybe just put all the info into 
> a csv 
> yourself, manually.
>
> On Jul 22, 2020, at 10:39 AM, Ronaldo Mata  > wrote:
>
> Hi Kovy, I'm using csv module, but I need to handle the delimiters 
> of the files, sometimes you come separated by "," others by ";" and 
> rarely 
> by "|" 
>
> El mié., 22 jul. 2020 a las 10:28, Kovy Jacob ( >) escribió:
>
>> Could you just use the standard python csv module?
>>
>> On Jul 22, 2020, at 10:25 AM, Ronaldo Mata > > wrote:

Re: Python-django project

2020-07-25 Thread Manoj Kumar Singh
Interested

On Sat, 25 Jul, 2020, 8:22 am Andi Setyawan,  wrote:

> Goodluck
>
> Pada tanggal 24 Jul 2020 10:08 AM, "Parampal Singh" <
> parampalsingh...@gmail.com> menulis:
>
>> 藍藍 best of luck brother 
>>
>> On Fri, 24 Jul, 2020, 7:19 am Sreenivasulu Boggala, 
>> wrote:
>>
>>> I am also interested
>>>
>>> On Fri, 24 Jul, 2020, 2:19 am Himanshi Dhanwadhiya, 
>>> wrote:
>>>
 Interested

 On Tue, 21 Jul, 2020, 8:39 am learn code, 
 wrote:

> Hi everyone,
>
> I am learning python and django, like to work on the projects to
> improve more.If any one interested to join with me to work on the
> projects,plz send me a email.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e7116e9b-9458-4f49-a638-135c4b5874e0o%40googlegroups.com
> .
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAK%2B6XsCzaXtAcCY_pKw%2Bc3n%3DJbB%2Beu3NF6wEbDDTYGwc6_wfiw%40mail.gmail.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAH%2BGg%3DyxT6rXad2vv5dma9OEnbZziz1TX5X4wzmS72XXw1dUag%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CANYMdQLAiPuU%3Dspxv0nBUOq3%3DwV_0xiuQvgK3gOdR7cJMdj%3DYg%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAG_zNb_L4Cr04WMZU9OXxnBtLDCinxbMHOd-heGW67sOAL4SVA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKfuDkU6oy%2BNkvxhrmeX3oSXx4jxEEQUv3RkeqCcyeWjH1rhOw%40mail.gmail.com.


Re: Error in sending mail

2020-07-25 Thread MUGOYA DIHFAHSIH
i think it is repeating it cos the email you put in the settings.py is the
same email you used for clients to send to contact you through.
What i mean is a person contacting you sends the email to
rubymoti...@gmail.com and it is the same email you used i the settings.py
to permit django app send email.


On Sat, 25 Jul 2020 at 11:35, Nikola Tesla  wrote:

> *Someone from Django's creators to help me*
> *I have noticed that when the user who sends me a message through the
> contact form, the information that arrives in my mail... arrives in a wrong
> way *
> *I've attached a picture of the error, I want to know how to correct it
> please *
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/afc4aea3-2cd8-4a02-a358-6ddee98aae10n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%3DJD9y_TPZmyNjLQHXULfopm4AKiQsn2P5GjWQQqCLZKGvL1w%40mail.gmail.com.


Error in sending mail

2020-07-25 Thread Nikola Tesla
*Someone from Django's creators to help me*
*I have noticed that when the user who sends me a message through the 
contact form, the information that arrives in my mail... arrives in a wrong 
way *
*I've attached a picture of the error, I want to know how to correct it 
please *

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/afc4aea3-2cd8-4a02-a358-6ddee98aae10n%40googlegroups.com.