Re: write custom decorators in django to authenticate the user

2017-11-01 Thread rohit . autosoft
On Thursday, 2 November 2017 09:53:33 UTC+5:30, rohit.a...@gmail.com wrote: > > def authenticated(f): > def wrap(request, *args, **kwargs): > token = request.META.get('HTTP_AUTHORIZATION') > entry = Person.objects.get(pk=kwargs['entry_id']) > payload = jwt.decode(token, SECRET) > user =

write custom decorators in django to authenticate the user

2017-11-01 Thread rohit . autosoft
def authenticated(f): def wrap(request, *args, **kwargs): token = request.META.get('HTTP_AUTHORIZATION') entry = Person.objects.get(pk=kwargs['entry_id']) payload = jwt.decode(token, SECRET) user = Person.objects.get( username=payload.get('username'), pk=payload.get('id')) wrap.__doc__=f.__doc__

Django bugfix release: 1.11.7

2017-11-01 Thread Tim Graham
Details are available on the Django project weblog: https://www.djangoproject.com/weblog/2017/nov/01/bugfix-release/ -- 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

Re: Close database connection for long running django-admin command

2017-11-01 Thread 18626427054
Did you solve this problem? On Thursday, August 25, 2016 at 1:16:36 AM UTC+8, Charanpal Dhanjal wrote: > > Hi all, > > I am using GeoDjango and I have a django-admin command that does some > route calculations for approximately 24 hours and then saves the results to > a MySQL database.

Re: Unable to use custom StaticFilesStorage

2017-11-01 Thread Stodge
As usual, despite working on this for a while, the solution hits me after I post here. I have to define a custom finder that uses my custom storage. Bingo! class CatalogFinder(AppDirectoriesFinder): storage_class = AppCatalogStorage def __init__(self, apps=None, *args, **kwargs):

Unable to use custom StaticFilesStorage

2017-11-01 Thread Stodge
I'm trying to add an extra directory for each app that will contain Javascript/CSS files. I created a custom storage.py in my app containing a copy of the code from Django's AppDirectoriesFinder class, but I changed source_dir from "static" to "catalog". I'll include the Django code with the

Re: channels working in runserver but "Still in CONNECTING state" then "ERR_CONNECTION_TIMED_OUT" in production

2017-11-01 Thread Adam
Anybody? On Monday, October 30, 2017 at 10:57:26 AM UTC-7, Adam wrote: > > > Hello, > > I am following "getting started" in the django channel docs as well as > "django channels form the ground up" > https://artandlogic.com/2016/06/django-channels-ground-part-2/ tutorial > in the django,

[Channels] Maybe about daphne?Or not ,I'm not sure.

2017-11-01 Thread CrazyNPC
I run daphne in docker container on AWS ECS behind AWS ALB. I found that, when I configure secure group of the EC2 instance in the ECS cluster to Allow Anyway, the site is ok, but configure to only Allow the secure group of ALB, then the flow can't reach. Curiously, when I use the same config