Re: Django not saving form in DB from frontend

2016-09-30 Thread Ali khan
Thanks Mudassar,

Its working now.



On Fri, Sep 30, 2016 at 8:42 PM, M Hashmi  wrote:

> *Please change*
>
> def contact_form(request):
> template = 'contact.html'
> if request.method == 'POST':
>form = ContactForm(request.POST or None, request.Files or
> None)
>if form.is_valid():
>  new_form = form
>  new_form.save(commit=True)
>
>
> return redirect('/')
>else:
>   form = ContactForm
> return render(request, template, context={"form":form})
>
> *To*
> def contact_form(request):
> template = 'contact.html'
> form = ContactForm(request.POST or None, request.Files or None)
>if form.is_valid():
>  form.save()
>else:
>   do something here
>return render(request, template, context={"form":form})
>
> You are saving a form but calling back variable that holds unsaved version
> of the form.
>
> Regards,
> Mudassar
>
>
>
> On Thu, Sep 29, 2016 at 2:18 PM, ludovic coues  wrote:
>
>> I would try to replace
>>
>> if form.is_valid():
>> new_form = form
>> new_form.save(commit=True)
>>
>> with :
>>
>> if form.is_valid():
>> print("Form is valid")
>> form.save(commit=True)
>> else:
>> print("Invalid form")
>>
>>
>> Pretty sure you will get an invalid form, due to a missing field
>> send_quote field. For the form to send the file, you need to add an
>> enctype=multipart or something related.
>>
>> 2016-09-29 21:06 GMT+02:00 Ali khan :
>> > Appologies. In my view after else clause its ContactForm.
>> >
>> > On Thu, Sep 29, 2016 at 11:52 AM, Ali khan 
>> > wrote:
>> >>
>> >> Hi,
>> >>
>> >> I am newbie so I must be doing some stupid mistake here.
>> >>
>> >> I am trying to save a contact form with ModelForm. But its not saving
>> in
>> >> DB from the frontend form.
>> >>
>> >> model.py
>> >>
>> >> class Contact(models.Model):
>> >>  name = models.CharField(max_length=100, null=True, blank=True)
>> >>  email = models.EmailField()
>> >>  send_quote = models.FileField(upload_to='/contacts')
>> >>
>> >>   def __unicode__(self)
>> >>return self.name
>> >>
>> >> forms.py
>> >>
>> >> from .models import Contact
>> >> from djagno import forms
>> >> from django.forms import ModelForm
>> >>
>> >> class ContactForm(forms.ModelForm):
>> >> class Meta:
>> >> model = Contact
>> >> fields = ['name', 'email', 'send_quote']
>> >>
>> >> views.py:
>> >>
>> >> from Django.shortcuts import render, redirect
>> >> from .forms import ContactForm
>> >>
>> >> def contact_form(request):
>> >> template = 'contact.html'
>> >> if request.method == 'POST':
>> >>form = ContactForm(request.POST or None, request.Files
>> or
>> >> None)
>> >>if form.is_valid():
>> >>  new_form = form
>> >>  new_form.save(commit=True)
>> >>
>> >>
>> >> return redirect('/')
>> >>else:
>> >>   form = RFPForm
>> >> return render(request, template, context={"form":form})
>> >>
>> >>
>> >> contact.html:
>> >>
>> >> 
>> >> {% csrf_token %}
>> >> {{ form }}
>> >> 
>> >> 
>> >>
>> >> Please advise.
>> >>
>> >
>> > --
>> > 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 post to this group, send email to django-users@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msgid/django-users/CAAXvsYkTe_LU
>> 03ErF%3Dz%3DbNfM3LapOsyQywzKxUP3tm5pxHh28Q%40mail.gmail.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>>
>> Cordialement, Coues Ludovic
>> +336 148 743 42
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CAEuG%2BTaKjumkUsT_6Y4WVKkZqtG%3DyPE6G6bazD
>> Ju39WewtaZrA%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving 

Re: Django not saving form in DB from frontend

2016-09-30 Thread M Hashmi
*Please change*

def contact_form(request):
template = 'contact.html'
if request.method == 'POST':
   form = ContactForm(request.POST or None, request.Files or
None)
   if form.is_valid():
 new_form = form
 new_form.save(commit=True)


return redirect('/')
   else:
  form = ContactForm
return render(request, template, context={"form":form})

*To*
def contact_form(request):
template = 'contact.html'
form = ContactForm(request.POST or None, request.Files or None)
   if form.is_valid():
 form.save()
   else:
  do something here
   return render(request, template, context={"form":form})

You are saving a form but calling back variable that holds unsaved version
of the form.

Regards,
Mudassar



On Thu, Sep 29, 2016 at 2:18 PM, ludovic coues  wrote:

> I would try to replace
>
> if form.is_valid():
> new_form = form
> new_form.save(commit=True)
>
> with :
>
> if form.is_valid():
> print("Form is valid")
> form.save(commit=True)
> else:
> print("Invalid form")
>
>
> Pretty sure you will get an invalid form, due to a missing field
> send_quote field. For the form to send the file, you need to add an
> enctype=multipart or something related.
>
> 2016-09-29 21:06 GMT+02:00 Ali khan :
> > Appologies. In my view after else clause its ContactForm.
> >
> > On Thu, Sep 29, 2016 at 11:52 AM, Ali khan 
> > wrote:
> >>
> >> Hi,
> >>
> >> I am newbie so I must be doing some stupid mistake here.
> >>
> >> I am trying to save a contact form with ModelForm. But its not saving in
> >> DB from the frontend form.
> >>
> >> model.py
> >>
> >> class Contact(models.Model):
> >>  name = models.CharField(max_length=100, null=True, blank=True)
> >>  email = models.EmailField()
> >>  send_quote = models.FileField(upload_to='/contacts')
> >>
> >>   def __unicode__(self)
> >>return self.name
> >>
> >> forms.py
> >>
> >> from .models import Contact
> >> from djagno import forms
> >> from django.forms import ModelForm
> >>
> >> class ContactForm(forms.ModelForm):
> >> class Meta:
> >> model = Contact
> >> fields = ['name', 'email', 'send_quote']
> >>
> >> views.py:
> >>
> >> from Django.shortcuts import render, redirect
> >> from .forms import ContactForm
> >>
> >> def contact_form(request):
> >> template = 'contact.html'
> >> if request.method == 'POST':
> >>form = ContactForm(request.POST or None, request.Files or
> >> None)
> >>if form.is_valid():
> >>  new_form = form
> >>  new_form.save(commit=True)
> >>
> >>
> >> return redirect('/')
> >>else:
> >>   form = RFPForm
> >> return render(request, template, context={"form":form})
> >>
> >>
> >> contact.html:
> >>
> >> 
> >> {% csrf_token %}
> >> {{ form }}
> >> 
> >> 
> >>
> >> Please advise.
> >>
> >
> > --
> > 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 post to this group, send email to django-users@googlegroups.com.
> > Visit this group at https://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/django-users/CAAXvsYkTe_LU03ErF%3Dz%
> 3DbNfM3LapOsyQywzKxUP3tm5pxHh28Q%40mail.gmail.com.
> >
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
>
> Cordialement, Coues Ludovic
> +336 148 743 42
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAEuG%2BTaKjumkUsT_6Y4WVKkZqtG%
> 3DyPE6G6bazDJu39WewtaZrA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 

Re: Django software docs

2016-09-30 Thread Luis Zárate
Are you looking for something like
https://d3js.org/ ?

Or something like blender with django ?

El lunes, 26 de septiembre de 2016, Jani Tiainen 
escribió:
> Hi,
>
> What you expect Django to do for you?
>
> Django has been successfully used to write great variety of webapps like
e-commerce, blogs, cms etc.
>
> So you have to be a bit more spesific what you're looking for.
>
> On 26.09.2016 18:14, Dave Baas wrote:
>
> All,
> Can anyone point me to some software documentation, (I work with 3D
visualization software) that utilizes Django?
> Manuals, tutorials, video links and such?
> thanks / Dave
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/e1bb770a-3b6e-4be2-806f-0e01302d3c7b%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> Jani Tiainen
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/024af0bd-bab9-3bb0-8732-cd158965051e%40gmail.com
.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyNTPkALqu%2B9sMuppwtHHQ4WuyvVP-vufxAzWBmKSd13qg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Help] Advanced tutorial: How to install my Python package with Virtualenv

2016-09-30 Thread Luis Zárate
You need to create a setup.py file (see setuptools doc) it's a simple file
find examples. Then do

python setup.py sdist

This will create dist file then surft to the .tar.gz file

pip install -u django-poll.tar.gz

Or you also can do

python setup.py install



El martes, 27 de septiembre de 2016, Aline C. R. Souza <
linecrso...@gmail.com> escribió:
> Hi everybody,
> Pip was working, but I did not know how to use it. Now, I figured out.
> Inside the project directory:
>
> pip install ../django-polls/dist/django-polls-0.1.zip
> Worked fine, the app is running.
> Thank you, guys.
>
> Em terça-feira, 27 de setembro de 2016 08:21:54 UTC-3, Aline C. R. Souza
escreveu:
>>
>> Hello Guys,
>> I need some help to install my Python package with virtualenv. I follow
the 'Advanced tutorial: How to write reusable apps' and moved the polls
directory out of the project. Now I want to install my package using
virtualenv and pip, but I don't know how.
>> Consider I am inside of my project diretory (where the manage.py is) and
I am working on a virtual environment. What would be the right pip command
to install my package, considering that the polls directory is out of the
project.
>> Please help!
>>
>>
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/66dc1093-dced-4d3b-8a34-3e1c250fbee0%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyPUrx5HOHSojrUD9Y%2BNxetTWvwaLgXzf1h6ZyZ-uS-fSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Subscribe / unsubscribe to data streams over websocket channel

2016-09-30 Thread Ian Danforth
Hello!

 Channels + databinding is a great way to push updates to clients of an 
API. I'm wondering however if there are any good examples of the client 
being able to subscribe and unsubscribe to streams of data over an existing 
websocket/channel pair (while making use of databinding)

 For example, github.com will send a message like this from the client to 
the server when it wants to get a particular data stream over the websocket:

subscribe:tenant:1:repo:51179261:branch:master

 I'd like to provide this kind of protocol to my clients. I think it may 
have to go into a custom consumer, but any examples / insights into this 
pattern would be greatly appreciated.

Ian

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f0ceba18-411c-4771-b8f2-1e46a32bc1b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-30 Thread Stodge
Thanks again. I set a different session cookie name for S1 and it seems to have 
worked.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5f4c1bd7-84f3-4b74-bde7-6a8ffd39f14a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: download file when debug=false

2016-09-30 Thread Constantine Covtushenko
Hi Richard,

There are a lot of options of how to change/switch application behaviour.
It depends on what  you eventually need to get.

Mentioned solution: settings.DEBUG = true/false can be one of them

Hope it helps.

Regards,
Constantine C.

> On Sep 30, 2016, at 12:06, Richard Auscard  wrote:
> 
> hello,
> 
> i have developp a django application where excel file are generate after some 
> operation. when debug=true thes excel files can be download but when false it 
> is not possible.
> my question is how to solve this issus.
> 
> all think are ok when debug=true
> 
> -- 
> 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 post to this group, send email to django-users@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/1075ee7d-6927-47ee-8196-243a3d5091f5%40googlegroups.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7C753B1A-8DAD-4CFD-8C4E-330AABC755AA%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading a django 1.2 Alpha site to 1.10 final site, passwords don't work

2016-09-30 Thread Tim Graham
Django 1.10 can still support SHA1, but it's not enabled by default. Please 
read 
https://docs.djangoproject.com/en/dev/releases/1.10/#removed-weak-password-hashers-from-the-default-password-hashers-setting
 
and https://docs.djangoproject.com/en/stable/topics/auth/passwords/.

On Friday, September 30, 2016 at 11:18:36 AM UTC-4, Evan Roberts wrote:
>
> Hello All,
>
> I'm new to django and python.  A project that was last maintained in 2009 
> was bestowed upon me because the underlying OS is approaching end-of-life.
>
> I've read the first few chapters the Django book and the first 10 chapters 
> of Django Unleashed.  I've got the project and supporting libraries brought 
> up to the python 3.5.0 and django 1.10.
> My current hurdle is the user's passwords are stored using SHA1 hashing. 
>  I ***think*** django 1.10 no longer supports the sha1 hashing algorithm. 
>
> Is there a way to allow the users to login (using SHA1 to validate the 
> password) and then force them to change their passwords (storing them using 
> new hash)? 
>
> Best Regards,
>
> Evan R.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/16abf06b-4cda-4ea6-967d-b2286df0c9da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to setup django 1.9 with mongodb

2016-09-30 Thread ludovic coues
Django's ORM doesn't support mongodb or any non-relational database
(read SQL only). So you set it up like any django, but you don't use
the models

2016-09-30 11:37 GMT+02:00 danang geek :
> hai Man How to setup django 1.9 with mongodb
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d42f85c3-2dfc-4d18-9fc3-c72bf9a355b5%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTYjcF4BrCqqnHg_w80m9n_64f%2BK5n-Q2bKf5zNv5WfrLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Upgrading a django 1.2 Alpha site to 1.10 final site, passwords don't work

2016-09-30 Thread Evan Roberts
Hello All,

I'm new to django and python.  A project that was last maintained in 2009 
was bestowed upon me because the underlying OS is approaching end-of-life.

I've read the first few chapters the Django book and the first 10 chapters 
of Django Unleashed.  I've got the project and supporting libraries brought 
up to the python 3.5.0 and django 1.10.
My current hurdle is the user's passwords are stored using SHA1 hashing.  I 
***think*** django 1.10 no longer supports the sha1 hashing algorithm. 

Is there a way to allow the users to login (using SHA1 to validate the 
password) and then force them to change their passwords (storing them using 
new hash)? 

Best Regards,

Evan R.


-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/efbb981a-b560-44a1-a475-60fdffe20be7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-30 Thread Michal Petrucha
Hi Mike,

On Fri, Sep 30, 2016 at 06:00:30AM -0700, Stodge wrote:
> Thanks Michal,
> 
> The two servers are on the same domain and use different databases. At the 
> moment I'm using the default Django session backend.
> 
> It's an experiment, nothing more really. I just wanted to see if I could 
> make it work. I haven't really worked out the flow, but it's probably 
> something like:
> 
>  - admin creates user account on A1, auto replicates it to S1
>  - user U1 visits S1, not logged in
>  - U1 redirected to A1 to generate auth token, not logged in
>  - U1 logs into A1
>  - U1 redirected back to S1 to accept authentication
>  - S1 logs U1 in, creates session as normal
> 
> So the user is logged into both. It's a fairly naive attempt at reinventing 
> the wheel, but that's how we learn, right? :)

Sounds all right, at least from a higher-level point of view. So
basically, those two services are pretty much separate, just sharing a
domain. In this case, your problem should go away if you set a unique
SESSION_COOKIE_NAME for each of those sites.

It might be a different situation if those two sites were using a
shared database; then, the same session ID would be valid for both,
but since that's not the case here, they need to be separate.

Cheers,

Michal

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20160930132620.GZ6601%40konk.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Digital signature


Re: Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-30 Thread Stodge
I discovered JSON Web Tokens after I posted my original question. So I'll 
read about how they work.

Thanks
Mike

On Thursday, 29 September 2016 16:50:22 UTC-4, Stodge wrote:
>
> I have two Django servers A1 and S1, which sit behind a simplistic NodeJS 
> proxy. This is a silly attempt at single sign on.
>
> I can log into and out of A1 (authentication server) just fine. If I log 
> into A1, visit S1 (without being logged in to S1) and then revisit A1, I am 
> no longer logged in. The S1 server doesn't set a new session ID in the 
> cookie and I don't think from memory that the CSRF changes. The session ID 
> cookie hasn't changed, the domain is the same etc.
>
> I can't work out why I'm no longer logged into A1. I know this isn't much 
> to go on but I'm assuming something is happening to the cookies set by S1 
> when I visit it. Any suggestions appreciated.
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1bfc206d-6aa2-44c4-8218-e2d2cdfd0369%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-30 Thread Stodge
Thanks Michal,

The two servers are on the same domain and use different databases. At the 
moment I'm using the default Django session backend.

It's an experiment, nothing more really. I just wanted to see if I could 
make it work. I haven't really worked out the flow, but it's probably 
something like:

 - admin creates user account on A1, auto replicates it to S1
 - user U1 visits S1, not logged in
 - U1 redirected to A1 to generate auth token, not logged in
 - U1 logs into A1
 - U1 redirected back to S1 to accept authentication
 - S1 logs U1 in, creates session as normal

So the user is logged into both. It's a fairly naive attempt at reinventing 
the wheel, but that's how we learn, right? :)

Cheers
Mike



On Friday, 30 September 2016 04:30:04 UTC-4, Michal Petrucha wrote:
>
> On Thu, Sep 29, 2016 at 01:50:22PM -0700, Stodge wrote: 
> > I have two Django servers A1 and S1, which sit behind a simplistic 
> > NodeJS proxy. This is a silly attempt at single sign on. 
> > 
> > I can log into and out of A1 (authentication server) just fine. If I 
> > log into A1, visit S1 (without being logged in to S1) and then 
> > revisit A1, I am no longer logged in. The S1 server doesn't set a 
> > new session ID in the cookie and I don't think from memory that the 
> > CSRF changes. The session ID cookie hasn't changed, the domain is 
> > the same etc. 
> > 
> > I can't work out why I'm no longer logged into A1. I know this isn't 
> > much to go on but I'm assuming something is happening to the cookies 
> > set by S1 when I visit it. Any suggestions appreciated. 
>
> Are those two applications sitting on the same domain? If yes, then 
> you should probably configure them to use different session cookies. 
> Logging in or out causes the session to be reset, and if they try to 
> use the same session cookie, resetting for either application will 
> reset it for both. 
>
> It's hard to give you any more specific advice, because there are many 
> ways to go about implementing SSO, some of which would be affected by 
> this. 
>
> You might want to share some more information, such as: 
>
> - Are those two applications sharing one database? 
> - What session backend are you using? 
> - Are they on the same domain? (this one I've already asked above) 
> - Could you describe the SSO flow in a bit more detail? 
>
> Cheers, 
>
> Michal 
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/77416e51-a616-42eb-8b02-55b9fb0759e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to setup django 1.9 with mongodb

2016-09-30 Thread danang geek
hai Man How to setup django 1.9 with mongodb

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d42f85c3-2dfc-4d18-9fc3-c72bf9a355b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


download file when debug=false

2016-09-30 Thread Richard Auscard
hello,

i have developp a django application where excel file are generate after 
some operation. when debug=true thes excel files can be download but when 
false it is not possible.
my question is how to solve this issus.

all think are ok when debug=true

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1075ee7d-6927-47ee-8196-243a3d5091f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-30 Thread Michal Petrucha
On Thu, Sep 29, 2016 at 01:50:22PM -0700, Stodge wrote:
> I have two Django servers A1 and S1, which sit behind a simplistic
> NodeJS proxy. This is a silly attempt at single sign on.
> 
> I can log into and out of A1 (authentication server) just fine. If I
> log into A1, visit S1 (without being logged in to S1) and then
> revisit A1, I am no longer logged in. The S1 server doesn't set a
> new session ID in the cookie and I don't think from memory that the
> CSRF changes. The session ID cookie hasn't changed, the domain is
> the same etc.
> 
> I can't work out why I'm no longer logged into A1. I know this isn't
> much to go on but I'm assuming something is happening to the cookies
> set by S1 when I visit it. Any suggestions appreciated.

Are those two applications sitting on the same domain? If yes, then
you should probably configure them to use different session cookies.
Logging in or out causes the session to be reset, and if they try to
use the same session cookie, resetting for either application will
reset it for both.

It's hard to give you any more specific advice, because there are many
ways to go about implementing SSO, some of which would be affected by
this.

You might want to share some more information, such as:

- Are those two applications sharing one database?
- What session backend are you using?
- Are they on the same domain? (this one I've already asked above)
- Could you describe the SSO flow in a bit more detail?

Cheers,

Michal

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20160930082844.GX6601%40konk.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Digital signature