Re: django...@googlegroups.com

2023-04-17 Thread herve bineli
Hello Wilson,

In your html template, index.html, you should use the context object
students without capital *"S"*, because this is how you have created it in
your view.py file.

Hope it helped you.

Best regards,
BINELI Herve



On Fri, Apr 14, 2023 at 11:07 PM WILSON TALENGA 
wrote:

> Hello, i have an issue with my django project, the created students are
> not reflecting when i run the server?
> below is my views.py and index.html
>
> what could the issue be?
>
> --
> 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/62eebb40-9255-438d-b7ca-e535ba40f611n%40googlegroups.com
> 
> .
>


-- 
*BINELI MANGA Hervé Arsène*
Ingénieur Informaticien - ENSPY
binelima...@gmail.com
(+237) 691388922 / 699946323

-- 
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/CAJm63O%3D%2BtMszQqbc97C8SqU1u%3Dr%3DZ0hL1eVsnVNFL-pT2vUa%2Bg%40mail.gmail.com.


Re: Async views means dropping gunicorn gevent for uvicorn, affecting sync view performance

2023-04-17 Thread Chris Barber
I know you can run gunicorn with uvicorn workers. But the sync views will 
be running sync, no longer gevent patched, meaning performance could 
change. I’m also unsure if sync views are serialized into one thread if you 
don’t set DJANGO_ALLOW_ASYNC_UNSAFE, which could be a bottleneck.

I did some more research and thinking and I made two errors in my first 
post, but it doesn’t really change the matter. 1) doing something like 
monkey.patch_all() to patch things out with async versions does not work, 
because you can’t get the patched things to magically somehow be awaited 
instead of being called normally 2) I didn’t realize you can run django 
hybrid (both sync and async views) both under WSGI as well as ASGI.

On Monday, April 17, 2023 at 8:34:55 AM UTC+2 TITAS ONLINE MARKET wrote:

> Thanks 
>
> On Mon, 17 Apr 2023, 11:42 am Fortune Osho,  wrote:
>
>> You can simply run gunicorn with unicorn workers... which is very 
>> performance using uvloop... test it performance against pure gunicorn... 
>> note that performance is not totally dependent on server used(a whole lot 
>> of things can affect performance like moddlewares, serialization etc)
>>
>>
>> On Sun, Apr 16, 2023 at 5:34 PM Chris Barber  wrote:
>>
>>> Hello
>>>
>>> Production django app, currently 100% sync views, running under gunicorn 
>>> with gevent worker class.
>>>
>>> @andrewgodwin suggests here it is possible to migrate slowly, just run 
>>> hybrid sync-async and add or convert views as desired
>>> https://www.youtube.com/watch?v=19Uh_PA_8Rc&t=1728s
>>>
>>> But to get a single async view one has to switch to uvicorn workers or 
>>> similar, right? Now one is no longer getting the gevent patching for sync 
>>> views, which could be a major impact on performance/scaling, and could 
>>> trigger re-evaluation of the production deployment & tuning!
>>>
>>> Questions:
>>>
>>> 1. How to approach this? It has me wondering if monkey.patch_all() 
>>> should be ported to asyncio and tested under uvicorn. This would smooth the 
>>> transition since the sync views should perform and scale roughly the same 
>>> as before.
>>>
>>> 2. Also an important technical question on how sync views under ASGI 
>>> work. By default they will run all in the same thread (*per worker*) 
>>> which could be really bad for performance with tons of sync views, correct? 
>>> If I enable DJANGO_ALLOW_ASYNC_UNSAFE, then the sync views will be run in 
>>> more threads, right? How many threads?Should I expect to have to tune this?
>>>
>>> In general, regardless of the approach, one could presumably A/B test in 
>>> a live environment - run some workers / nodes under uvicorn, partition the 
>>> traffic accordingly, and see how it compares. Tune, stress test, and then 
>>> rolling transition.
>>>
>>> -C
>>>
>>> -- 
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/8cc88d44-df9f-4232-8f57-89a1b07fb769n%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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CABqs0Mwr%3DXjg6OLUAN9kxsqCKREJW1%2BtrkDHbTq0pnazKgqQkQ%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/68a3f159-9c6b-4216-b476-9f4ef37e2a06n%40googlegroups.com.


Re: Django urls error

2023-04-17 Thread Tarun Miri
You may not write any string on the urls.py of myapp/urls.py
Ex path('',hello_delhi_capitals,name="hello_delhi_capitals"),

On Sat, 15 Apr, 2023, 7:29 am Muhammad Juwaini Abdul Rahman, <
juwa...@gmail.com> wrote:

> In your urls.py you use '/hello' but in your browser you type '/home'.
>
> On Sat, 15 Apr 2023 at 06:07, lalit upadhyay 
> wrote:
>
>> *I have copied my code here. Plz fix this error:*
>>
>>
>> view.py
>> from django.http import HttpResponse
>>
>>
>> def hello_delhi_capitals(request):
>> return HttpResponse('Hello Delhi Capitals!')
>>
>>
>>
>> myproject/urls.py
>>
>> from django.contrib import admin
>> from django.urls import path, include
>>
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('hello/', include('myapp.urls')),
>> ]
>>
>>
>>
>> myapp/urls.py
>>
>>
>>
>> from django.urls import path
>> from .views import hello_delhi_capitals
>>
>> urlpatterns = [
>> path('hello/', hello_delhi_capitals, name='hello_delhi_capitals'),
>> ]
>>
>> --
>> 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/b157258f-6697-4bd7-81c7-48e425b4a1edn%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/CAFKhtoTQB506MC1OwxvHhT23R5kK-0uC5cxcDm3YS3Q6SYM-Pg%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/CA%2BznC8P5goz9Wzfreknw7vhpChMxjxb4P2jZOa%2BpP68%3D0r3FKA%40mail.gmail.com.


Re: Django urls error

2023-04-17 Thread Tahir Munir Faraz
do not write hello at the project level This is not correct
path('hello/', include('myapp.urls')),
The code below is correct
path('' ",include("myapp.urls"),

On Sun, 16 Apr 2023 at 21:34, oluwafemi damilola 
wrote:

> Your path is 'hello/', but in your browser you are going to 'home', that
> path does not exist
>
> On Fri, 14 Apr 2023 at 23:07, lalit upadhyay 
> wrote:
>
>> *I have copied my code here. Plz fix this error:*
>>
>>
>> view.py
>> from django.http import HttpResponse
>>
>>
>> def hello_delhi_capitals(request):
>> return HttpResponse('Hello Delhi Capitals!')
>>
>>
>>
>> myproject/urls.py
>>
>> from django.contrib import admin
>> from django.urls import path, include
>>
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('hello/', include('myapp.urls')),
>> ]
>>
>>
>>
>> myapp/urls.py
>>
>>
>>
>> from django.urls import path
>> from .views import hello_delhi_capitals
>>
>> urlpatterns = [
>> path('hello/', hello_delhi_capitals, name='hello_delhi_capitals'),
>> ]
>>
>> --
>> 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/b157258f-6697-4bd7-81c7-48e425b4a1edn%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/CALo4fb8kC34MgtuhdDz5MVDotBXvDe-crQLTiWBxLF1q0QmbEw%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/CAJ%2BiHWZXdE0BmuoUob%3DK%2Bibh82_8u%2BWAgSrTr4Tkz_wR89aQ3A%40mail.gmail.com.