Thursday, November 30, 2017

İ want to setup a server at home for testing and lerning to deploy django projects, thanks for any helping.

İ want to setup a server at home for testing and lerning to deploy django projects, can anyone help me , advice and share sources  thanks for all.

Re: Send email - user data for complete registration

Earlier comment is correct that you shouldn't email a password. It's actually not necessary, or even possible. The stored version is a "one way hash" -- which is not reversible; there's no way to get the password from the hash -- and you (should) only have access to the hashed value. (Obviously it could be hacked to store the value un-hashed... but don't do that :-)

The user should know the password if they just created it. And if they've forgotten, then just send them a Reset link.

A system admin should never have access to the passwords of any of the system's users... in fact, that's the (US) law (Sarbanes-Oxley) in many types of applications, e.g. financial transaction site of any publicly traded company.




On 11/30/2017 02:45 PM, Richard Maceček wrote:
Hello,
after successful registration of the user, how to send personal information (password) to the user in emails? I personally use send_mass_mail. But I have a problem that the password is not in text, but it's in the "encrypted" form.
 I do not know how to send user's data but now they need it, and I have not found documentation on how easily I can get the password to display the text format.

I use this shape:


message
= 'Hi, registration date:' + 'Your name:' + user.username + 'Your password:' + user.password
....
email
.send ()

Thanks for any advice!
--
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+unsubscribe@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/3bc6d503-20ef-4002-b291-753d83786dfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Send email - user data for complete registration

you should never send anything password related via email to the user.  doing so is highly irresponsible. furthermore, the plain password is never stored in the database, only the encrypted hash of it.


--
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+unsubscribe@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/771b991d-eb0a-4f06-ad48-e0caf54c7222%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Django forms and django models

I have an attribute of a model called "options" that is an array of prayers that are entered through textinputs. How can I declare this attribute in the model and what widget may I use in the model form? 
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+unsubscribe@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/10861b26-4ec2-49c3-967b-5819959fa732%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

How do I customize registration form HTML?

The HTML for the user registration form looks like this:
<form method="post">
 {% csrf_token %}
 {{ registration_form.as_p }}
 <button type="submit">Register</button>
</form>

I understand that the `registration_form.as_p` line automatically gives me the form's HTML. But I'd like to customize that HTML. For instance, I'd like the label text to be placeholders instead. How do I do this?

If it helps, `registration_form` is `UserCreationForm()`

--
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+unsubscribe@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/12490918-6d56-4079-ab53-9b8cb6f9fd9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Send email - user data for complete registration

Hello,
after successful registration of the user, how to send personal information (password) to the user in emails? I personally use send_mass_mail. But I have a problem that the password is not in text, but it's in the "encrypted" form.
 I do not know how to send user's data but now they need it, and I have not found documentation on how easily I can get the password to display the text format.

I use this shape:


message
= 'Hi, registration date:' + 'Your name:' + user.username + 'Your password:' + user.password
....
email
.send ()

Thanks for any advice!

--
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+unsubscribe@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/3bc6d503-20ef-4002-b291-753d83786dfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

why is `WebsocketMultiplexer.group_send` a class method?

why is `WebsocketMultiplexer.group_send` a class method?      Currently it's the following:        @classmethod      def group_send(cls, name, stream, payload, close=False):          message = cls.encode(stream, payload)          if close:              message["close"] = True          Group(name).send(message)      what is to stop it being the following?        def group_send(self, name, payload, close=False):          message = cls.encode(self.stream, payload)          if close:              message["close"] = True          Group(name).send(message)      `group_send` being a class method makes call more verbose than it appears neccisary      multiplexer.group_send(name='my-group', stream=multiplexer.stream, payload={})    https://github.com/django/channels/blob/8e2bbebe6d62850f0c5072b1541d96d9b932c472/channels/generic/websockets.py#L215

--
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+unsubscribe@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/4d3f592d-c97a-4ecc-bc40-aa756ff76be2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django with apache and php

you'll need to set up a virtual conf file.  https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/modwsgi/ has good directions.

You can have it run on the same port, just set the URL path differently to point to django.  Eg, using the Alias directive


--
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+unsubscribe@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/81437d8c-ea33-4eb8-8ca8-83f0e21cf4f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How can i use live reloader in django. Please can anyone help me?

assuming you're talking python code, the django dev server, with the runserver command, is live reloading.

If you're talking about javascript, that is something entirely different.

what commands are you executing?

--
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+unsubscribe@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/0494c1ce-8f9c-45b5-8dac-07e2678b88ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

How can i use live reloader in django. Please can anyone help me?

How can i use live reloader in django. Please can anyone help me?

--
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+unsubscribe@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/014f40a2-f954-4aed-9e6b-5dc3444955e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Django with apache and php

Hi all.

I'm new in Django. I have a question.

I have a server with apache and php. I would like to use django in this server.

How can I config django in apache?

Can I use django in the same port that php projects? How?

Thank you a lot!

Julián Melero.

Re: How to configure NGINX to run Django app in a subpath?

Nothing wrong, but havign set up the system I didn't want to change software cause I'm not that savvy.
Anyway, I ended up hiring someone on Fivrr and  got the job done. I was closed, but not closed enough

Thank for you help !!!

Il giorno mercoledì 29 novembre 2017 22:56:37 UTC+1, Etienne Robillard ha scritto:

Whats wrong in using FastCGI for your specific use-case ?

Etienne

Le 2017-11-29 à 15:45, Luca Moiana a écrit :
Following this tutorial

I came up with this NGINX server:

upstream app_name {

   server unix:/home/geouser/pmapp/pmapp.sock fail_timeout=10;

}


server {


   listen 80;

  root /home/geouser/pmapp;

  server_name www.officinecartografiche.it, officinecartografiche.it, 207.154.206.172;



   location /pmapp/ {

     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

     proxy_set_header Host $http_host;

     proxy_redirect off;

     proxy_pass http://app_name/;


}

}


and I can access the "it works" page from: http://my domain/pmapp

But, If I try http://my domain/pmapp/admin

I have error 404

then if I use www.mydomain/pmapp I have "DisallowedHost at /" error but I added all possibile spell of my site, including IP, on 'ALLOWED_HOSTS' in settings.py

Any help?


Il giorno lunedì 27 novembre 2017 21:28:55 UTC+1, Matemática A3K ha scritto:
Something like this should work:
https://stackoverflow.com/a/20998131/8930660
and change STATIC_URL and MEDIA_URL

Also, the FORCE_SCRIPT_NAME should also work, but if it doesn't, the first is the most "manual" thing you can do, I think...

Then you have no need to have 2 nginx confs, just put that the proxy_pass "starts" in your prefix instead of root

On Mon, Nov 27, 2017 at 8:32 AM, Luca Moiana <luca....@gmail.com> wrote:
Googling around I found this page http://albertoconnor.ca/hosting-django-under-different-locations.html but ain't working for me

Il giorno lunedì 27 novembre 2017 11:10:50 UTC+1, Etienne Robillard ha scritto:

I have not been able to solve this problem with uWSGI. Apparently, uWSGI is not using the same internal routing semantics than FastCGI.

See: https://forum.nginx.org/read.php?2,275684,275706

Etienne

Le 2017-11-26 à 15:41, Matemática A3K a écrit :
I don't know / remember how to do it in Gunicorn, but here is an example with uWSGI:
https://stackoverflow.com/questions/35792409/nginx-serving-django-in-a-subdirectory-through-uwsgi

The main thing is that you will have to deal with "/pmapp" prefix in your routing / urls. You can deal with this inside Django or have it stripped before it gets to Django (by nginx or gunicorn).

HTH :)

On Sun, Nov 26, 2017 at 4:56 PM, Luca Moiana <luca....@gmail.com> wrote:
Hi,

Sorry for the slight OT but after days of search I have no clue.


Following this DigitalOcean tutorial I was able to setup Django + Postgres + Gunicorn + NGINX running Django on my root,

Now I'd like to change and have something like this:

mydomain.com -> static HTML
mydomain.com/pmapp -> Django app

I created two server blocks in NGINX, one for my static website:

server {


        listen 80;


        listen [::]:80;




        root /var/www/html/officinecartografiche.it;


        index index.html index.htm index.nginx-debian.html;




        server_name www.officinecartografiche.it, officinecartografiche.it, 207.154.206.172;




        location / {


                try_files $uri $uri/ =404;

       }

}


 and one for my django app:

server {


    listen 80;


    listen [::]:80;


    server_name www.officinecartografiche.it, officinecartografiche.it, 207.154.206.172;


    location = /favicon.ico { access_log off; log_not_found off; }


    location /static/ {


        root /home/geouser/pmapp;


    }




    location /pmapp {


        #include proxy_params;


        proxy_pass http://unix:/home/geouser/pmapp/pmapp.sock;


        proxy_redirect http://www.officinecartografiche.it:8000/pmapp/ http://$host/pmapp/;


        proxy_set_header SCRIPT_NAME /pmapp;


    }


}


and added this to settings.py:

FORCE_SCRIPT_NAME = '/pmapp'



WHAT AM I DOING WRONG??

THANKS FOR YOUR 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...@googlegroups.com.
To post to this group, send email to django...@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/b1ee39d2-fd04-4727-88e1-e130def5dd37%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...@googlegroups.com.
To post to this group, send email to django...@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/CA%2BFDnhLuJEm4kE1D1FHMApW8nYQv%2BWi1Xt9R7o07bgOwqLGsjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--   Etienne Robillard  tka...@yandex.com  https://www.isotopesoftware.ca/
--
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 post to this group, send email to django...@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/d15cf9a9-9f60-49c4-ad6b-b89ad2f78cde%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...@googlegroups.com.
To post to this group, send email to django...@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/321f9296-6c85-4afb-a411-a6b0f29445a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--   Etienne Robillard  tka...@yandex.com  https://www.isotopesoftware.ca/

--
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+unsubscribe@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/7ffbe4f8-d2bc-4015-936e-ef67211592a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Why does Django say my login form is invalid? How can I find out why Django thinks it is?

Tom,

- You shouldn't use Model=User (or the Meta) as it was a ModelForm, it is just a regular Form
- AuthenticationForm takes request as its first parameter:

def login_register(request, template="templates/login_register.html"):
    if request.method == "POST":
        login_form = AuthenticationForm(request, data=request.POST)
        if login_form.is_valid():
            print("Login form valid")
            # return redirect(home_slug())
        # else:
        #  print "Login invalid"
    else:
        login_form = AuthenticationForm()
    return render(request, template, {"login_form": login_form})


--
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+unsubscribe@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/CA%2BFDnh%2B1i4eRye6qr%3DF2zWz2Nnf4mAZ1%3DnY357m01HSyeFL0UA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Why does Django say my login form is invalid? How can I find out why Django thinks it is?



On Wednesday, 29 November 2017 08:24:26 UTC+5:30, Tom Tanner wrote:
My `forms.py` looks like this. (I want user's email to be their login username. 
from django.utils.translation import ugettext_lazy as _

from django import forms
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User

class LoginForm(AuthenticationForm):
 username
= forms.EmailField(label=_("Email"), max_length=254)


 
class Meta:
 model
= User
 fields
= ("username",)

`views.py`:
def login_register(request, template="pages/login_register.html"):
 
if request.method=="POST":
  login_form
= LoginForm(request.POST)
  
if login_form.is_valid():
   
print "Login form valid"
   
return redirect(home_slug())
  # else:
  #  print "Login invalid"
 
else:
  login_form
= LoginForm()
 
return render(request, template, {"login_form": login_form})


`login_register.html`:
 <form method="post">
  {% csrf_token %}
  {{ login_form.as_p }}
  
<button type="submit">Log in</button>
 
</form>

The login form accepts two fields labeled "Email" and "Password." But when I hit "Log in" button, the page just seems to refresh. If I uncomment the `print` statement, it prints, indicating that `login_form.is_valid()!=True`. Why does Django do this?

--
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+unsubscribe@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/c36c350e-2c5f-4439-9a98-d15758f98b2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wednesday, November 29, 2017

Re: Why does Django say my login form is invalid? How can I find out why Django thinks it is?

I removed that line, but nothing changed.

On Wednesday, November 29, 2017 at 11:58:28 PM UTC-5, Matemática A3K wrote:


On Thu, Nov 30, 2017 at 12:35 AM, Tom Tanner <dontsende...@gmail.com> wrote:
What would I need to change? 

I tried changing the ...
fields= ("username",)

... to ...
fields= ("username","email",)
or...
fields= ("email",)

Nothing seemed to change. the `login_form.is_valid()` still is `False`.

Sorry if the question is dumb, I'm still learning Django thru working with it.


Try not using fields at all, that will use the fields in AuthenticationForm
 


On Wednesday, November 29, 2017 at 12:21:04 AM UTC-5, Matemática A3K wrote:

class LoginForm(AuthenticationForm):
 username
= forms.EmailField(label=_("Email"), max_length=254)


 
class Meta:
 model
= User
 

 fields
= ("username",)


If you use "fields = ("username")" you are restricting the fields to just that field, and the authentication form needs also password to be valid
 

--
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 post to this group, send email to django...@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/1e861f42-2115-4377-848c-67c59d122610%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...@googlegroups.com.
To post to this group, send email to django...@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/7dafbe54-6563-401b-9461-b857f9340d64%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+unsubscribe@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/c506fa03-09f7-4f69-b464-ec2d789baf65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Why does Django say my login form is invalid? How can I find out why Django thinks it is?



On Thu, Nov 30, 2017 at 12:35 AM, Tom Tanner <dontsendemailhereok@gmail.com> wrote:
What would I need to change? 

I tried changing the ...
fields= ("username",)

... to ...
fields= ("username","email",)
or...
fields= ("email",)

Nothing seemed to change. the `login_form.is_valid()` still is `False`.

Sorry if the question is dumb, I'm still learning Django thru working with it.


Try not using fields at all, that will use the fields in AuthenticationForm
 


On Wednesday, November 29, 2017 at 12:21:04 AM UTC-5, Matemática A3K wrote:

class LoginForm(AuthenticationForm):
 username
= forms.EmailField(label=_("Email"), max_length=254)


 
class Meta:
 model
= User
 

 fields
= ("username",)


If you use "fields = ("username")" you are restricting the fields to just that field, and the authentication form needs also password to be valid
 

--
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 post to this group, send email to django...@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/1e861f42-2115-4377-848c-67c59d122610%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+unsubscribe@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/7dafbe54-6563-401b-9461-b857f9340d64%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+unsubscribe@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/CA%2BFDnhKD6GXVnR2DmcuLGqscV2%2BE%2BAm-Tu7yjcsORbWgOBi2iA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.