Re: Django Image and File

2020-02-27 Thread Robert Rajendra
Store only the path in DB and image file in server folder this is the best
practice,  save the file in some folder and forward the path to DB Object
so that your DB can remember the path of the file and you can load it in
the frontend,

here is a snippet that you can use


import  FileSystemStorage()
from django.core.files.storage import FileSystemStorage
function that will store the file
profile_pic_upload = request.FILES.get('profile_pic_upload', 'false')
if user:
if profile_pic_upload != 'false':
fs = FileSystemStorage()
profile_pic = compress_image(profile_pic_upload)
filename = fs.save(profile_pic_upload.name, profile_pic)
uploaded_file_url = fs.url(filename)
uploaded_file_url = uploaded_file_url.split("/")
original_url= uploaded_file_url[-1]
user_profile.profile_pic = original_url Here fs is the object of the
FileSystemStorege() class compress_image() is my custom function no need to
add that, you can directly pass the image object that you are getting from
request. then the origina_url will go to DB user_profile.profile_pic =
original_url
 also, it will add a randomly
generated value at the end of the file that will be very useful if you have
2 images with the same name NOTE make sure that you have a media folder
added to you your settings.py file or you can pass the path to where to
save the image like this fs = FileSystemStorage(location=
'media/rent_pictures/') Hope this helps another thing is that image is also
a file and treated the same way in the backend regards,

On Thu, 27 Feb 2020 at 11:56, Soumen Khatua 
wrote:

> Hi Folks,
>
> Actually I have one image filed called profile_pic and another is file
> field called  documents but I don't know what is best practise to store it.
> Most importantly how I can make each user details is unique.
>
> Thank you in advance
>
> Regards,
> Soumen
>
> --
> 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/CAPUw6WabzCG%2B4ARdyzdn-3DCckud%3D871RtOSxqRiRMLo6zbQuQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPUw6WabzCG%2B4ARdyzdn-3DCckud%3D871RtOSxqRiRMLo6zbQuQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 

*Robert Rajendra*

Associate Network/Server Support Engineer

IT Hands

P: +91 863.087.3094 <+91%2086308%2073094>

W: www.ITHands.com <http://www.ithands.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/CABbC_KHUHtuJRsGUFNqf%2BXK5CZy9oewdueTdjZ6r7A%3DQTTNDQg%40mail.gmail.com.


Re: I'm new to this django help me out

2020-05-06 Thread Robert Rajendra
state your question


On Tue, 5 May 2020 at 23:02, Sherif Adigun  wrote:

> what is your question?
>
> On Tuesday, May 5, 2020 at 6:25:48 PM UTC+1, sree lekha wrote:
>>
>> --
> 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/f432b7cc-a4f1-4f2a-a0af-39d918696c18%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f432b7cc-a4f1-4f2a-a0af-39d918696c18%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

*Robert Rajendra*

Associate Network/Server Support Engineer

ITH

P: +91 863.087.3094 <+91%2086308%2073094>

W: www.ITHands.com <http://www.ithands.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/CABbC_KHdUvk2_gc%3D0fQ7vXVnOeOt-6VVb2TjJKYhmPXj3rPoVg%40mail.gmail.com.


Re: Need to work with csv file

2020-05-06 Thread Robert Rajendra
for working with csv files you can get help from CSV module of python, you
can read the documents online about it

On Wed, 6 May 2020 at 13:19, sharu kuriakose 
wrote:

> Hi guys
> Iam a student...  doing a project in django.
> In my project i need to open an image, while clicking on that image i need
> to find the color of that pixel position.
> So i need to work with csv file.
> In my views. Py file i have a function.  In that function i need to open a
> csv file which already created and data stored
>
> --
> 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/3b4b013d-05c0-4bb2-8251-8e57441b47fd%40googlegroups.com
> .
>


-- 

*Robert Rajendra*

Associate Network/Server Support Engineer

ITH

P: +91 863.087.3094 <+91%2086308%2073094>

W: www.ITHands.com <http://www.ithands.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/CABbC_KHXrsRQMvwuWWd_Vw6_WKBz1KmNs8QeYBzwnr452kK%3DRg%40mail.gmail.com.


Re: python manage.py runserver error

2020-06-19 Thread Robert Rajendra
gt;>>>>>>> reloader.run(django_main_thread)
>>>>>>>>>   File
>>>>>>>>> "C:\Users\Chas\rp-portfolio\venv\lib\site-packages\django\utils\autoreload.py",
>>>>>>>>> line 290, in run
>>>>>>>>> self.run_loop()
>>>>>>>>>   File
>>>>>>>>> "C:\Users\Chas\rp-portfolio\venv\lib\site-packages\django\utils\autoreload.py",
>>>>>>>>> line 296, in run_loop
>>>>>>>>> next(ticker)
>>>>>>>>>   File
>>>>>>>>> "C:\Users\Chas\rp-portfolio\venv\lib\site-packages\django\utils\autoreload.py",
>>>>>>>>> line 336, in tick
>>>>>>>>> for filepath, mtime in self.snapshot_files():
>>>>>>>>>   File
>>>>>>>>> "C:\Users\Chas\rp-portfolio\venv\lib\site-packages\django\utils\autoreload.py",
>>>>>>>>> line 352, in snapshot_files
>>>>>>>>> for file in self.watched_files():
>>>>>>>>>   File
>>>>>>>>> "C:\Users\Chas\rp-portfolio\venv\lib\site-packages\django\utils\autoreload.py",
>>>>>>>>> line 251, in watched_files
>>>>>>>>> yield from iter_all_python_module_files()
>>>>>>>>>   File
>>>>>>>>> "C:\Users\Chas\rp-portfolio\venv\lib\site-packages\django\utils\autoreload.py",
>>>>>>>>> line 103, in iter_all_python_module_files
>>>>>>>>> return iter_modules_and_files(modules, frozenset(_error_files))
>>>>>>>>>   File
>>>>>>>>> "C:\Users\Chas\rp-portfolio\venv\lib\site-packages\django\utils\autoreload.py",
>>>>>>>>> line 138, in iter_modules_and_files
>>>>>>>>> if not path.exists():
>>>>>>>>>   File "C:\Python37\lib\pathlib.py", line 1346, in exists
>>>>>>>>> self.stat()
>>>>>>>>>   File "C:\Python37\lib\pathlib.py", line 1168, in stat
>>>>>>>>> return self._accessor.stat(self)
>>>>>>>>> OSError: [WinError 123] The filename, directory name, or volume
>>>>>>>>> label syntax is incorrect: ''
>>>>>>>>>
>>>>>>>> --
>>>>>>>> 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/2a2bc753-f7ee-4f85-be07-a35bd910620fo%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/django-users/2a2bc753-f7ee-4f85-be07-a35bd910620fo%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to a topic in
>>>>>>> the Google Groups "Django users" group.
>>>>>>> To unsubscribe from this topic, visit
>>>>>>> https://groups.google.com/d/topic/django-users/TGCTXTFbHFI/unsubscribe
>>>>>>> .
>>>>>>> To unsubscribe from this group and all its topics, 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/CAPcTzRYV_Ws-VgtK3dTkauYbtm7O2FKH1AJdewfDp0%2BPOuKOPw%40mail.gmail.com
>>>>>>> <https://groups.google.com/d/msgid/django-users/CAPcTzRYV_Ws-VgtK3dTkauYbtm7O2FKH1AJdewfDp0%2BPOuKOPw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>>> 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/CAJPMF7OXWJK1rbh_nof95VD4C2zJsmSe5j%2Bk-YCBLneAfm1YdQ%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/django-users/CAJPMF7OXWJK1rbh_nof95VD4C2zJsmSe5j%2Bk-YCBLneAfm1YdQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> 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/CAFO4Knza2PaX9svPH_tNiHnLL4xOZnQD4fjpi9CBmx1DHytPBw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAFO4Knza2PaX9svPH_tNiHnLL4xOZnQD4fjpi9CBmx1DHytPBw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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/CAF1kx9nXqoxe3Eh6o5PGt1u76iVbAfJjLd7eF9rF_qU9Q%3D%2B2Kw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAF1kx9nXqoxe3Eh6o5PGt1u76iVbAfJjLd7eF9rF_qU9Q%3D%2B2Kw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> --
>>> Thanks and Regards
>>>
>>> J. Ranga Bharath
>>> cell: 9110334114
>>>
>>> --
>>> 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/CAK5m314aNUsiyg%2BFyVhUCWio%3DFeubBYyj639vpReamT7%2BzxedQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAK5m314aNUsiyg%2BFyVhUCWio%3DFeubBYyj639vpReamT7%2BzxedQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CANvoF%2B9wV9vaAXV%3DqWp-FkB67F%2BxPBdc7UMypMuROD7V%3DSrzPA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CANvoF%2B9wV9vaAXV%3DqWp-FkB67F%2BxPBdc7UMypMuROD7V%3DSrzPA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
> Are you in the project directory?
>
> --
> 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/CAFcndAyME%3DYC3EBtvY1kPWrbOw2EWyfQkam_ndY6srQm9mQw2w%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFcndAyME%3DYC3EBtvY1kPWrbOw2EWyfQkam_ndY6srQm9mQw2w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 

*Robert Rajendra*

Associate Network/Server Support Engineer

ITH

P: +91 863.087.3094 <+91%2086308%2073094>

W: www.ITHands.com <http://www.ithands.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/CABbC_KEygRkyM5RyKk8mKMQVk5ZhuX%2B%3DpYrfRiJpUB-baUFn6g%40mail.gmail.com.


Re: help

2020-06-23 Thread Robert Rajendra
to configure virtual environment
1. python -m pip install virtualenv
2. go to project folder and type:- virtualenv 
3. source /bin/activate
4. Once it is activated you will see the name of your project in the left
corner of your terminal enclosed within ()
5. pip install 
6. make sure to create a requirements.txt file after finishing the project
so that you can Deploy and install the dependencies into the server as well

thanks

On Tue, 23 Jun 2020 at 17:05, Kasper Laudrup  wrote:

> Hi Peter,
>
> On 23/06/2020 13.15, Peter Kirieny wrote:
> > thank you
> > how do i activate virtual environment please?
> >
>
>
> https://hostadvice.com/how-to/how-to-create-a-virtual-environment-for-your-django-projects-using-virtualenv/
>
> Was the first result I could find on a Google search.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/e2af77bb-275e-e52b-6730-c72526825ebe%40stacktrace.dk
> .
>


-- 

*Robert Rajendra*

Associate Network/Server Support Engineer

ITH

P: +91 863.087.3094 <+91%2086308%2073094>

W: www.ITHands.com <http://www.ithands.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/CABbC_KH%3D4E2DaBb%3DovW9-hDBLgV2gBr%3Dax0ycktNFDtNtxtoZw%40mail.gmail.com.