Django security releases issued: 4.0.2, 3.2.12, and 2.2.27

2022-01-31 Thread Mariusz Felisiak

Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2022/feb/01/security-releases/

--
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/4f6f73a3-1066-8081-3950-fe0aa7634d11%40gmail.com.


Re: how to Display images other than from static folder.

2022-01-31 Thread ramsha azhar
yes, I set check the attached settings.py file
 just want to know In template page how I set the path od
back directory folder where tree.png is placed.

On Mon, Jan 31, 2022 at 8:55 PM DJANGO DEVELOPER 
wrote:

> have you set up the static files in settings.py ?
>
> On Mon, Jan 31, 2022 at 8:49 PM ramsha azhar 
> wrote:
>
>> I just want to display the attached Tree.png image on the HTML page but
>> this image is created each time new according to the user input file. guide
>> me how to set the path of this mage on an HTML page or how to display this
>> tree.png as a user output image.
>>
>> On Mon, Jan 31, 2022 at 8:36 PM DJANGO DEVELOPER 
>> wrote:
>>
>>> tell me what you want to get as a result? do you want to display
>>> multiple images on HTML template?
>>>
>>> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar 
>>> wrote:
>>>
 So guide me the write way ...

 On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, 
 wrote:

> you are doing it the wrong way. totally the wrong way. I am not being
> rude.
>
> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
> wrote:
>
>> Gide me Django develpers. I just want to display my pictures that are
>> created each time new.
>> My mages are created in my project folder, not in the static folder.
>> how I display images on the HTML page by using the path of my project
>> folder.
>>
>> views.py
>>
>> def Image_display(request):
>>   BASE_DIR =
>> os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>   filename = 'Tree.jpg'
>>   filepath = BASE_DIR + '//' + filename
>>   images = Image.objects.all('filepath')
>>   return render(request, "xyz.html", {'images': images})
>>
>> url.py
>> path('Image_display/', views.Image_display, name="Image_display"),
>>
>> HTML page
>> 
>> 
>> 
>> 
>>
>> --
>> 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/8da245ea-ea90-4730-83c0-accafc93b86bn%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/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%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/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%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/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%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/CAMyb2%3Dh18EtBixgvyLF2wn-eLNA-uvwejxszEMeu9-kqyVL5xQ%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> 

Re: how to Display images other than from static folder.

2022-01-31 Thread DJANGO DEVELOPER
have you set up the static files in settings.py ?

On Mon, Jan 31, 2022 at 8:49 PM ramsha azhar 
wrote:

> I just want to display the attached Tree.png image on the HTML page but
> this image is created each time new according to the user input file. guide
> me how to set the path of this mage on an HTML page or how to display this
> tree.png as a user output image.
>
> On Mon, Jan 31, 2022 at 8:36 PM DJANGO DEVELOPER 
> wrote:
>
>> tell me what you want to get as a result? do you want to display multiple
>> images on HTML template?
>>
>> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar 
>> wrote:
>>
>>> So guide me the write way ...
>>>
>>> On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, 
>>> wrote:
>>>
 you are doing it the wrong way. totally the wrong way. I am not being
 rude.

 On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
 wrote:

> Gide me Django develpers. I just want to display my pictures that are
> created each time new.
> My mages are created in my project folder, not in the static folder.
> how I display images on the HTML page by using the path of my project
> folder.
>
> views.py
>
> def Image_display(request):
>   BASE_DIR =
> os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>   filename = 'Tree.jpg'
>   filepath = BASE_DIR + '//' + filename
>   images = Image.objects.all('filepath')
>   return render(request, "xyz.html", {'images': images})
>
> url.py
> path('Image_display/', views.Image_display, name="Image_display"),
>
> HTML page
> 
> 
> 
> 
>
> --
> 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/8da245ea-ea90-4730-83c0-accafc93b86bn%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/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%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/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%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/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%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/CAMyb2%3Dh18EtBixgvyLF2wn-eLNA-uvwejxszEMeu9-kqyVL5xQ%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/CAKPY9pmoTLTnt_5i%3DNeWtRSSS1BjfyVZ%2BL%3DCSALwnOnZwu6zGw%40mail.gmail.com.


Re: how to Display images other than from static folder.

2022-01-31 Thread Ammar Mohammed
This topic solves your problem .

https://djangocentral.com/managing-media-files-in-django/

Ammar Mohammed
Tel: 0113075979
On 31 Jan 2022, 17:36 +0200, DJANGO DEVELOPER , wrote:
> tell me what you want to get as a result? do you want to display multiple 
> images on HTML template?
>
> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar  wrote:
> > So guide me the write way ...
> >
> > On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER,  
> > wrote:
> > > you are doing it the wrong way. totally the wrong way. I am not being 
> > > rude.
> > >
> > > On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar  
> > > wrote:
> > > > Gide me Django develpers. I just want to display my pictures that are 
> > > > created each time new.
> > > > My mages are created in my project folder, not in the static folder.
> > > > how I display images on the HTML page by using the path of my project 
> > > > folder.
> > > >
> > > > views.py
> > > >
> > > > def Image_display(request):
> > > >   BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
> > > >   filename = 'Tree.jpg'
> > > >   filepath = BASE_DIR + '//' + filename
> > > >   images = Image.objects.all('filepath')
> > > >   return render(request, "xyz.html", {'images': images})
> > > >
> > > > url.py
> > > > path('Image_display/', views.Image_display, name="Image_display"),
> > > >
> > > > HTML page
> > > > 
> > > > 
> > > > 
> > > > 
> > > >  --
> > > > 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/8da245ea-ea90-4730-83c0-accafc93b86bn%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/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%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/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%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/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%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/c0a72401-90b1-4900-b2b7-b5dee6ea0c9f%40Spark.


Re: how to Display images other than from static folder.

2022-01-31 Thread Lunga Baliwe
i think you want to use MEDIA_URL, see
https://learndjango.com/tutorials/django-file-and-image-uploads-tutorial
and also check https://docs.djangoproject.com/en/3.2/topics/files/ static
files are things like logos, css and maybe some javascript.

On Mon, Jan 31, 2022 at 5:36 PM DJANGO DEVELOPER 
wrote:

> tell me what you want to get as a result? do you want to display multiple
> images on HTML template?
>
> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar 
> wrote:
>
>> So guide me the write way ...
>>
>> On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, 
>> wrote:
>>
>>> you are doing it the wrong way. totally the wrong way. I am not being
>>> rude.
>>>
>>> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
>>> wrote:
>>>
 Gide me Django develpers. I just want to display my pictures that are
 created each time new.
 My mages are created in my project folder, not in the static folder.
 how I display images on the HTML page by using the path of my project
 folder.

 views.py

 def Image_display(request):
   BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
   filename = 'Tree.jpg'
   filepath = BASE_DIR + '//' + filename
   images = Image.objects.all('filepath')
   return render(request, "xyz.html", {'images': images})

 url.py
 path('Image_display/', views.Image_display, name="Image_display"),

 HTML page
 
 
 
 

 --
 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/8da245ea-ea90-4730-83c0-accafc93b86bn%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/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%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/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%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/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%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/CANDnEWee3Dp3B55RFDtwjmcNTz%2BNd%2BrGiufNfv%3DC7%2Bh6KeaYBQ%40mail.gmail.com.


Re: how to Display images other than from static folder.

2022-01-31 Thread DJANGO DEVELOPER
tell me what you want to get as a result? do you want to display multiple
images on HTML template?

On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar 
wrote:

> So guide me the write way ...
>
> On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, 
> wrote:
>
>> you are doing it the wrong way. totally the wrong way. I am not being
>> rude.
>>
>> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
>> wrote:
>>
>>> Gide me Django develpers. I just want to display my pictures that are
>>> created each time new.
>>> My mages are created in my project folder, not in the static folder.
>>> how I display images on the HTML page by using the path of my project
>>> folder.
>>>
>>> views.py
>>>
>>> def Image_display(request):
>>>   BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>>   filename = 'Tree.jpg'
>>>   filepath = BASE_DIR + '//' + filename
>>>   images = Image.objects.all('filepath')
>>>   return render(request, "xyz.html", {'images': images})
>>>
>>> url.py
>>> path('Image_display/', views.Image_display, name="Image_display"),
>>>
>>> HTML page
>>> 
>>> 
>>> 
>>> 
>>>
>>> --
>>> 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/8da245ea-ea90-4730-83c0-accafc93b86bn%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/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%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/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%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/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%40mail.gmail.com.


Re: how to Display images other than from static folder.

2022-01-31 Thread ramsha azhar
So guide me the write way ...

On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, 
wrote:

> you are doing it the wrong way. totally the wrong way. I am not being rude.
>
> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
> wrote:
>
>> Gide me Django develpers. I just want to display my pictures that are
>> created each time new.
>> My mages are created in my project folder, not in the static folder.
>> how I display images on the HTML page by using the path of my project
>> folder.
>>
>> views.py
>>
>> def Image_display(request):
>>   BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>   filename = 'Tree.jpg'
>>   filepath = BASE_DIR + '//' + filename
>>   images = Image.objects.all('filepath')
>>   return render(request, "xyz.html", {'images': images})
>>
>> url.py
>> path('Image_display/', views.Image_display, name="Image_display"),
>>
>> HTML page
>> 
>> 
>> 
>> 
>>
>> --
>> 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/8da245ea-ea90-4730-83c0-accafc93b86bn%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/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%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/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%40mail.gmail.com.


Re: how to Display images other than from static folder.

2022-01-31 Thread DJANGO DEVELOPER
you are doing it the wrong way. totally the wrong way. I am not being rude.

On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
wrote:

> Gide me Django develpers. I just want to display my pictures that are
> created each time new.
> My mages are created in my project folder, not in the static folder.
> how I display images on the HTML page by using the path of my project
> folder.
>
> views.py
>
> def Image_display(request):
>   BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>   filename = 'Tree.jpg'
>   filepath = BASE_DIR + '//' + filename
>   images = Image.objects.all('filepath')
>   return render(request, "xyz.html", {'images': images})
>
> url.py
> path('Image_display/', views.Image_display, name="Image_display"),
>
> HTML page
> 
> 
> 
> 
>
> --
> 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/8da245ea-ea90-4730-83c0-accafc93b86bn%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/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com.


how to Display images other than from static folder.

2022-01-31 Thread ramsha azhar
Gide me Django develpers. I just want to display my pictures that are 
created each time new.
My mages are created in my project folder, not in the static folder.
how I display images on the HTML page by using the path of my project 
folder.

views.py

def Image_display(request):
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  filename = 'Tree.jpg'
  filepath = BASE_DIR + '//' + filename
  images = Image.objects.all('filepath')
  return render(request, "xyz.html", {'images': images})

url.py
path('Image_display/', views.Image_display, name="Image_display"),

HTML page
 
 



-- 
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/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com.


Secure web app locally

2022-01-31 Thread SAHRAOUI KHALED IBN EL WALID
Hello 
In our company I work with, we started developping an app for manage our 
company, and we affraid our database will stollen, 
I have a question, is there any way to secure our locall web app ?  
have any idea how to secure our Django project, and databases ? 
Is there any way to start running Django project on NAS manager ? 
Thank you for your service, and hope give us an advice 
thank you 

-- 
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/657680df-696f-4fa2-9ffc-d2c5bd03daabn%40googlegroups.com.


TypeError: 'module' object is not iterable - django 4

2022-01-31 Thread muwaga micheal
Hi 
Team,
 I am getting the above error, it has persisted long enough than at this 
point i really need help.
I am using pickle to load an ML model, POST to get user input. Below is the 
error, my urls.py file and the views.py file. 
Any Help will be highly appreciated.

*** Error Message ***

(python10_env) D:\Online 
Drives\MDigital\CIT-Letures\python10_env\smart_health_consult>python 
manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "D:\Online 
Drives\MDigital\CIT-Letures\python10_env\lib\site-packages\django\urls\resolvers.py",
 
line 634, in url_patterns
iter(patterns)
TypeError: 'module' object is not iterable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File 
"C:\Users\USER\AppData\Local\Programs\Python\Python310\lib\threading.py", 
line 1009, in _bootstrap_inner
self.run()
  File 
"C:\Users\USER\AppData\Local\Programs\Python\Python310\lib\threading.py", 
line 946, in run
self._target(*self._args, **self._kwargs)
  File "D:\Online 
Drives\MDigital\CIT-Letures\python10_env\lib\site-packages\django\utils\autoreload.py",
 
line 64, in wrapper
fn(*args, **kwargs)
  File "D:\Online 
Drives\MDigital\CIT-Letures\python10_env\lib\site-packages\django\core\management\commands\runserver.py",
 
line 124, in inner_run
self.check(display_num_errors=True)
  File "D:\Online 
Drives\MDigital\CIT-Letures\python10_env\lib\site-packages\django\core\management\base.py",
 
line 438, in check
all_issues = checks.run_checks(
  File "D:\Online 
Drives\MDigital\CIT-Letures\python10_env\lib\site-packages\django\core\checks\registry.py",
 
line 77, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
  File "D:\Online 
Drives\MDigital\CIT-Letures\python10_env\lib\site-packages\django\core\checks\urls.py",
 
line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
  File "D:\Online 
Drives\MDigital\CIT-Letures\python10_env\lib\site-packages\django\core\checks\urls.py",
 
line 67, in _load_all_namespaces
namespaces.extend(_load_all_namespaces(pattern, current))
  File "D:\Online 
Drives\MDigital\CIT-Letures\python10_env\lib\site-packages\django\core\checks\urls.py",
 
line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
  File "D:\Online 
Drives\MDigital\CIT-Letures\python10_env\lib\site-packages\django\utils\functional.py",
 
line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "D:\Online 
Drives\MDigital\CIT-Letures\python10_env\lib\site-packages\django\urls\resolvers.py",
 
line 642, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) from e
django.core.exceptions.ImproperlyConfigured: The included URLconf ''
 
does not appear to have any patterns in it. If you see the 'urlpatterns' 
variable with valid patterns in the file then the issue is probably caused 
by a circular import.

**

  urls.py  *
from django.urls import path
from . import views

#from .views import index
#from .views import predict

urlpartterns = [
path('', views.index, name='index'),
path('result.html', views.predict, name='predict')

]
**

* views.py *
from django.shortcuts import render
# Testing if context can solve circular refference issue.
from django.template import context
# Model related imports
import pandas as pd #install pandas
import pickle
import numpy as np #  helps to manipulate the data

# Create your views here.
def index(request):
return render(request, 'index.html')

# importing the models using pickle.
#Loading Naive Bayes Pickle  Model load method 1
nb_pickle = open('./models_store/final_nb_model.pickel','rb+')
nb_model = pickle.load(nb_pickle)
#Loading RandomForest Pickle Modal load method 1
rf_pickle = open('./models_store/final_rf_model.pickel', 'rb+')
rf_model = pickle.load(rf_pickle)
#Loading Scala Vector Machine  Pickle  Model load method 2
svm_model = pickle.load(open('./models_store/final_svm_model.pickel', 
'rb+'))

# Disease prediction Function:
def predict(request):
if request.method=='POST':
symptom_index = {}
symptom_index['symptom1'] =float(request.POST.get('symptom1')) # 
Add data in string format to the dictionary
symptom_index['symptom2'] =float(request.POST.get('symptom2'))
symptom_index['symptom3'] =float(request.POST.get('symptom3'))
user_symptoms = pd.DataFrame({'X':symptom_index}).transpose() 
#think about changing dictionary to list at this line.
# Using pickle model() to predict
nb_prediction = nb_model.predict(user_symptoms)[0]
rf_prediction = rf_model.predict(user_symptoms)[0]
svm_prediction = svm_model.predict(user_symptoms)[0]