superuser having all permissions makes perm checking messy

2017-03-16 Thread guettli
This is not a question, just a feeling. I want to know if you feel the same 
pain.

Checking for permission in django is done in two steps:

 check1: check if user is superuser, then user is allowed.
 check2: check if user has the given permission.

This OR is solvable. It's easy to code. It is just a simple "if".

The OR can be done in SQL, too But not much better.

But somehow it makes my code messy.

I would like to get the answer directly from postgres/DB, I don't write a 
condition.

I want it to be straight forward.

In our custom code we already skip check1 and do only check2.

But this makes the whole situation not much better.

I am just speaking out my thoughts.

Dear django (core) developer: I like django very much and it is a great
framework which I use daily with joy. Don't get me wrong!

Unfortunately I have no clue which strategy could lead me to the goal if 
this particular issue without
doing stuff in my code completely different than django does. I want to 
avoid doing uncommon things
and stick to upstream.

Regards,
  Thomas Güttler




-- 
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/d629dba5-cc73-4625-9d91-92741b7010a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Serializers and forms

2017-03-16 Thread Luvpreet Singh
What is the difference in saving model instance to database using a form 
and doing the same by using a serializer ? What is the basic need of 
serializers ?

-- 
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/d704e683-ad49-47e6-abaf-4e7b8aca8a5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django and Nginx through uwsgi is not working

2017-03-16 Thread valerio orfano
Hi All

i ve created a django application not using virtual environment. I ve 
installed nginx and trying to integrate them via uwsgi application.
Here my configurations files.

[uwsgi]
chdir = /home/elastic/workspace/ES_Brevetti
wsgi-file = ES_Brevetti/wsgi.py
master = true
processes = 5
uid = nginx
gid = nginx
socket = unix:///socket/uwsgi.sock
chmod-socket = 666
vacuum = true

i've created the file /sockect/uwsgi.sock with permission 777   

chown nginx:nginx -R /sockect/uwsgi.sock

and below nginx conf file:

upstream django {
server unix:///socket/uwsgi.sock; # for a file socket
#server 127.0.0.1:8001; # for a web port socket (we'll use this 
first)
}
server {
listen 80;
server_name 10.184.2.231;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
charset utf-8;

location /static/ { 
alias /home/elastic/workspace/ES_Brevetti;
}

location / {
include uwsgi_params;
uwsgi_pass  unix:///socket/uwsgi.sock;
}
}


When i launch "systemctl start nginx" nginx is started with error:
 connect() to unix:///socket/uwsgi.sock failed (111: Connection refused) 
while connecting to upstream,
 
 When i run uwsgi --ini /etc/uwsgi/sites/ES_Brevetti.ini  it doesnt run 
with error:

.
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
bind(): Permission denied [core/socket.c line 230]


What i am doing wrong? On google i can only see configurations with VENV 
while i am not using virtual environment.

-- 
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/891545d5-a99c-425d-8171-c6a9e43f5dd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Nginx through uwsgi is not working

2017-03-16 Thread Vijay Khemlani
Not sure if a typo on your email, but your command says

"chown nginx:nginx -R /sockect/uwsgi.sock"

sockect ?

On 3/16/17, valerio orfano  wrote:
> Hi All
>
> i ve created a django application not using virtual environment. I ve
> installed nginx and trying to integrate them via uwsgi application.
> Here my configurations files.
>
> [uwsgi]
> chdir = /home/elastic/workspace/ES_Brevetti
> wsgi-file = ES_Brevetti/wsgi.py
> master = true
> processes = 5
> uid = nginx
> gid = nginx
> socket = unix:///socket/uwsgi.sock
> chmod-socket = 666
> vacuum = true
>
> i've created the file /sockect/uwsgi.sock with permission 777
>
> chown nginx:nginx -R /sockect/uwsgi.sock
>
> and below nginx conf file:
>
> upstream django {
> server unix:///socket/uwsgi.sock; # for a file socket
> #server 127.0.0.1:8001; # for a web port socket (we'll use this
> first)
> }
> server {
> listen 80;
> server_name 10.184.2.231;
> error_log /var/log/nginx/error.log;
> access_log /var/log/nginx/access.log;
> charset utf-8;
>
> location /static/ {
> alias /home/elastic/workspace/ES_Brevetti;
> }
>
> location / {
> include uwsgi_params;
> uwsgi_pass  unix:///socket/uwsgi.sock;
> }
> }
>
>
> When i launch "systemctl start nginx" nginx is started with error:
>  connect() to unix:///socket/uwsgi.sock failed (111: Connection refused)
> while connecting to upstream,
>
>  When i run uwsgi --ini /etc/uwsgi/sites/ES_Brevetti.ini  it doesnt run
> with error:
>
> .
> lock engine: pthread robust mutexes
> thunder lock: disabled (you can enable it with --thunder-lock)
> bind(): Permission denied [core/socket.c line 230]
>
>
> What i am doing wrong? On google i can only see configurations with VENV
> while i am not using virtual environment.
>
> --
> 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/891545d5-a99c-425d-8171-c6a9e43f5dd8%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/CALn3ei3kOMcm5UL%2BPojo%3Dsa7r9jk9zZRDi_2QGDBh0%3Da_fhcAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Nginx through uwsgi is not working

2017-03-16 Thread 'Tom Evans' via Django users
On Thu, Mar 16, 2017 at 12:25 PM, valerio orfano  wrote:
> Hi All
>
> i ve created a django application not using virtual environment. I ve
> installed nginx and trying to integrate them via uwsgi application.
> Here my configurations files.
>
> [uwsgi]
> chdir = /home/elastic/workspace/ES_Brevetti
> wsgi-file = ES_Brevetti/wsgi.py
> master = true
> processes = 5
> uid = nginx
> gid = nginx
> socket = unix:///socket/uwsgi.sock
> chmod-socket = 666
> vacuum = true
>
> i've created the file /sockect/uwsgi.sock with permission 777
>
> chown nginx:nginx -R /sockect/uwsgi.sock

When you say you've "created the file /socket/uwsgi.sock", what have
you actually done?

You should have made a directory that uwsgi will be able to create a
unix socket in. You should not create a regular file, or even a named
fifo, with the same name as the socket, otherwise uwsgi will be unable
to create the socket.

Typically people do this by placing their socket files in /tmp or
/var/tmp, a world writeable sticky directory.

Cheers

Tom

-- 
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/CAFHbX1JbngRuEkjj_DvZQBinGtFi%3DKaJqN17qeMuQpxZH%3D1XDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: superuser having all permissions makes perm checking messy

2017-03-16 Thread Jani Tiainen

Hi,

You don't need to check for superuser explicitly Django does that when 
you check does user have a permission and returns true for all perm checks.


So it's just simple check.

Unless you meant something else, maybe giving a sample code would help 
understand your problem better.


On 16.03.2017 11:29, guettli wrote:
This is not a question, just a feeling. I want to know if you feel the 
same pain.


Checking for permission in django is done in two steps:

 check1: check if user is superuser, then user is allowed.
 check2: check if user has the given permission.

This OR is solvable. It's easy to code. It is just a simple "if".

The OR can be done in SQL, too But not much better.

But somehow it makes my code messy.

I would like to get the answer directly from postgres/DB, I don't 
write a condition.


I want it to be straight forward.

In our custom code we already skip check1 and do only check2.

But this makes the whole situation not much better.

I am just speaking out my thoughts.

Dear django (core) developer: I like django very much and it is a great
framework which I use daily with joy. Don't get me wrong!

Unfortunately I have no clue which strategy could lead me to the goal 
if this particular issue without
doing stuff in my code completely different than django does. I want 
to avoid doing uncommon things

and stick to upstream.

Regards,
  Thomas Güttler




--
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/d629dba5-cc73-4625-9d91-92741b7010a2%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/472278f7-898e-07d9-ebd6-cab399825afb%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Nginx through uwsgi is not working

2017-03-16 Thread valerio orfano
Ya it was a typo when writing

On Thursday, March 16, 2017 at 1:30:21 PM UTC+1, Vijay Khemlani wrote:
>
> Not sure if a typo on your email, but your command says 
>
> "chown nginx:nginx -R /sockect/uwsgi.sock" 
>
> sockect ? 
>
> On 3/16/17, valerio orfano > wrote: 
> > Hi All 
> > 
> > i ve created a django application not using virtual environment. I ve 
> > installed nginx and trying to integrate them via uwsgi application. 
> > Here my configurations files. 
> > 
> > [uwsgi] 
> > chdir = /home/elastic/workspace/ES_Brevetti 
> > wsgi-file = ES_Brevetti/wsgi.py 
> > master = true 
> > processes = 5 
> > uid = nginx 
> > gid = nginx 
> > socket = unix:///socket/uwsgi.sock 
> > chmod-socket = 666 
> > vacuum = true 
> > 
> > i've created the file /sockect/uwsgi.sock with permission 777 
> > 
> > chown nginx:nginx -R /sockect/uwsgi.sock 
> > 
> > and below nginx conf file: 
> > 
> > upstream django { 
> > server unix:///socket/uwsgi.sock; # for a file socket 
> > #server 127.0.0.1:8001; # for a web port socket (we'll use this 
> > first) 
> > } 
> > server { 
> > listen 80; 
> > server_name 10.184.2.231; 
> > error_log /var/log/nginx/error.log; 
> > access_log /var/log/nginx/access.log; 
> > charset utf-8; 
> > 
> > location /static/ { 
> > alias /home/elastic/workspace/ES_Brevetti; 
> > } 
> > 
> > location / { 
> > include uwsgi_params; 
> > uwsgi_pass  unix:///socket/uwsgi.sock; 
> > } 
> > } 
> > 
> > 
> > When i launch "systemctl start nginx" nginx is started with error: 
> >  connect() to unix:///socket/uwsgi.sock failed (111: Connection refused) 
> > while connecting to upstream, 
> > 
> >  When i run uwsgi --ini /etc/uwsgi/sites/ES_Brevetti.ini  it doesnt run 
> > with error: 
> > 
> > . 
> > lock engine: pthread robust mutexes 
> > thunder lock: disabled (you can enable it with --thunder-lock) 
> > bind(): Permission denied [core/socket.c line 230] 
> > 
> > 
> > What i am doing wrong? On google i can only see configurations with VENV 
> > while i am not using virtual environment. 
> > 
> > -- 
> > 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/891545d5-a99c-425d-8171-c6a9e43f5dd8%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/4c6a85d2-85c6-4569-81f9-f74cf9ed63bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Nginx through uwsgi is not working

2017-03-16 Thread valerio orfano
Hi Tom if i dont create the file i get the error: unix:///tmp/uwsgi.sock 
failed (2: No such file or directory)

On Thursday, March 16, 2017 at 1:47:12 PM UTC+1, Tom Evans wrote:
>
> On Thu, Mar 16, 2017 at 12:25 PM, valerio orfano  > wrote: 
> > Hi All 
> > 
> > i ve created a django application not using virtual environment. I ve 
> > installed nginx and trying to integrate them via uwsgi application. 
> > Here my configurations files. 
> > 
> > [uwsgi] 
> > chdir = /home/elastic/workspace/ES_Brevetti 
> > wsgi-file = ES_Brevetti/wsgi.py 
> > master = true 
> > processes = 5 
> > uid = nginx 
> > gid = nginx 
> > socket = unix:///socket/uwsgi.sock 
> > chmod-socket = 666 
> > vacuum = true 
> > 
> > i've created the file /sockect/uwsgi.sock with permission 777 
> > 
> > chown nginx:nginx -R /sockect/uwsgi.sock 
>
> When you say you've "created the file /socket/uwsgi.sock", what have 
> you actually done? 
>
> You should have made a directory that uwsgi will be able to create a 
> unix socket in. You should not create a regular file, or even a named 
> fifo, with the same name as the socket, otherwise uwsgi will be unable 
> to create the socket. 
>
> Typically people do this by placing their socket files in /tmp or 
> /var/tmp, a world writeable sticky directory. 
>
> Cheers 
>
> Tom 
>

-- 
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/88eb9c79-4823-40ac-a6e3-f6f810952c8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error running Django tutorial

2017-03-16 Thread Camilo Torres
Hi.

You may have a strange, non-visible character in your file just before the line 
giving error.

-- 
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/f9e098eb-2362-4cc1-bc41-0b5a03f64172%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error running Django tutorial

2017-03-16 Thread Vijay Khemlani
Why is there a backslash in

from django.conf.urls import polls\

?

On 3/16/17, Camilo Torres  wrote:
> Hi.
>
> You may have a strange, non-visible character in your file just before the
> line giving error.
>
> --
> 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/f9e098eb-2362-4cc1-bc41-0b5a03f64172%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/CALn3ei2hsX-YPbrf-47E5vfyR-So88UVGHGWGt06br1Jaiqf%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Nginx through uwsgi is not working

2017-03-16 Thread Melvyn Sopacua
On Thursday 16 March 2017 05:25:32 valerio orfano wrote:

> Here my configurations files.
> 
> [uwsgi]
> chdir = /home/elastic/workspace/ES_Brevetti
> wsgi-file = ES_Brevetti/wsgi.py
> master = true
> processes = 5
> uid = nginx
> gid = nginx
> socket = unix:///socket/uwsgi.sock

Where did you read the unix prototol is a network protocol that requires two 
slashes to 
indicate it is? And then add another to reference the root of the network 
domain?

> uwsgi_pass  unix:///socket/uwsgi.sock;

See above.
-- 
Melvyn Sopacua

-- 
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/5866801.BESY0mt1MW%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: Error running Django tutorial

2017-03-16 Thread Thomas Pittman
I'm not sure why, but it stopped the error and send to import it. I'm using
3.6?

On Mar 16, 2017 11:45 AM, "Vijay Khemlani"  wrote:

> Why is there a backslash in
>
> from django.conf.urls import polls\
>
> ?
>
> On 3/16/17, Camilo Torres  wrote:
> > Hi.
> >
> > You may have a strange, non-visible character in your file just before
> the
> > line giving error.
> >
> > --
> > 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/f9e098eb-
> 2362-4cc1-bc41-0b5a03f64172%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/aZQoPBeHDPs/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CALn3ei2hsX-YPbrf-47E5vfyR-So88UVGHGWGt06br1Jaiqf%3DA%
> 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 
https://groups.google.com/d/msgid/django-users/CANQVT%2BaN%3DgjUdzyr7npfmwbcoHqwFrXrhtk2SmT02NaU_MO2dA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Nginx through uwsgi is not working

2017-03-16 Thread valerio orfano
I got it here "http://uwsgi-docs.readthedocs.io/en/latest/Nginx.html"; and 
others actually 

On Thursday, March 16, 2017 at 4:51:35 PM UTC+1, Melvyn Sopacua wrote:
>
> On Thursday 16 March 2017 05:25:32 valerio orfano wrote:
>
>  
>
> > Here my configurations files.
>
> > 
>
> > [uwsgi]
>
> > chdir = /home/elastic/workspace/ES_Brevetti
>
> > wsgi-file = ES_Brevetti/wsgi.py
>
> > master = true
>
> > processes = 5
>
> > uid = nginx
>
> > gid = nginx
>
> > socket = unix:///socket/uwsgi.sock
>
>  
>
> Where did you read the unix prototol is a network protocol that requires 
> two slashes to indicate it is? And then add another to reference the root 
> of the network domain?
>
>  
>
> > uwsgi_pass unix:///socket/uwsgi.sock;
>
>  
>
> See above.
>
> -- 
>
> Melvyn Sopacua
>

-- 
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/f2255468-2f43-4b5c-92d7-7b6ceaf9338d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Nginx through uwsgi is not working

2017-03-16 Thread Rafael E. Ferrero
I've been using this

tutorial on a Salix Linux and everythings goes well


Rafael E. Ferrero

2017-03-16 15:04 GMT-03:00 valerio orfano :

> I got it here "http://uwsgi-docs.readthedocs.io/en/latest/Nginx.html"; and
> others actually
>
> On Thursday, March 16, 2017 at 4:51:35 PM UTC+1, Melvyn Sopacua wrote:
>>
>> On Thursday 16 March 2017 05:25:32 valerio orfano wrote:
>>
>>
>>
>> > Here my configurations files.
>>
>> >
>>
>> > [uwsgi]
>>
>> > chdir = /home/elastic/workspace/ES_Brevetti
>>
>> > wsgi-file = ES_Brevetti/wsgi.py
>>
>> > master = true
>>
>> > processes = 5
>>
>> > uid = nginx
>>
>> > gid = nginx
>>
>> > socket = unix:///socket/uwsgi.sock
>>
>>
>>
>> Where did you read the unix prototol is a network protocol that requires
>> two slashes to indicate it is? And then add another to reference the root
>> of the network domain?
>>
>>
>>
>> > uwsgi_pass unix:///socket/uwsgi.sock;
>>
>>
>>
>> See above.
>>
>> --
>>
>> Melvyn Sopacua
>>
> --
> 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/f2255468-2f43-4b5c-92d7-7b6ceaf9338d%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/CAJJc_8UxZeLk-52ncju6RsPseAmwjgOjh%3DvEZE95rfoT1UBH9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Nginx through uwsgi is not working

2017-03-16 Thread Melvyn Sopacua
On Thursday 16 March 2017 11:04:53 valerio orfano wrote:
> http://uwsgi-docs.readthedocs.io/en/latest/Nginx.htm
*sigh*

http://nginx.org/en/docs/http/ngx_http_uwsgi_module.html#uwsgi_pass

unix:/path/to

Maybe unix:/// works, maybe it doesn't. But file:/// is supposed to be the 
exception to the URI rules, not the rule itself.

Also, just providing a plain path (socket = /var/run/uwsgi/myapp.sock) in 
uwsgi.ini works.

Of course, it will try to create the socket under the user uwsgi runs as, so 
permissions for the directory need to allow that.
-- 
Melvyn Sopacua

-- 
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/3861233.uUr4JQkNb4%40devstation.
For more options, visit https://groups.google.com/d/optout.


new bee - starting to build web application based on python - Django - PostgreSQL (or) MYSQL

2017-03-16 Thread SD
Hi There,

Am new to web development based on python,Django and PostgreSQL (or) MYSQL 
databases. I am able to build standalone applications.
Anyone from community could you help me to get start with web application 
based on mentioned technologies. 


Thanks,
SD. 

-- 
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/e9298c26-9574-4209-b6cb-6e7efd6eb36f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


need advice/tips on storing favicon in my django bookmark app

2017-03-16 Thread Stephen Fox
I've developed a bookmark manager app in django. Things are working well. 
It's pretty cool, has a js bookmarklet and such. In my model I have fields 
such as link title, link category, link url, etc... I'd like to have an 
image as well.

So I was thinking of grabbing the favicon for the links and storing that as 
base64 in a CharField. Then pass that to the template and show an image 
along with the other link info.

I've had some issues however, I've tried messing with pyfav and just 
grabbing /favicon.ico and trying to encode to base64. I suppose I could 
also just point to {{ link.url }}/favicon.ico but not every site offers the 
favicon that way.

Just curious to see what other ideas someone has for offering an image to 
go along with my saved links.

Thanks

-- 
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/705681e0-7050-44f7-ba8b-cc1ed66de7db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: new bee - starting to build web application based on python - Django - PostgreSQL (or) MYSQL

2017-03-16 Thread Mike Dewhirst

SD

It would help to say if you have a particular web application in mind. 
What is it you would like to achieve?


Mike

On 17/03/2017 8:38 AM, SD wrote:

Hi There,

Am new to web development based on python,Django and PostgreSQL (or) 
MYSQL databases. I am able to build standalone applications.
Anyone from community could you help me to get start with web 
application based on mentioned technologies.



Thanks,
SD.
--
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/e9298c26-9574-4209-b6cb-6e7efd6eb36f%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/126e93cd-7c29-c00b-5c6e-796d7f921818%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


new bee - starting to build web application based on python - Django - PostgreSQL (or) MYSQL

2017-03-16 Thread Camilo Torres
I recommend you the django tutorial:

https://docs.djangoproject.com/en/1.10/intro/

-- 
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/95ec951f-54ae-4424-87e9-278f40dba9b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Tweaking the admin title to display the model name

2017-03-16 Thread Mike Dewhirst
Currently in an admin model change form, the admin page title is "Change 
"


How can I tweak the code or the template so it displays an attribute of 
the model instance instead?


I'm trying to work on a few instances at the same time and having the 
model instance identifier would be very useful.


Thanks

Mike

--
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/bf52e2be-f042-dc0f-9e76-86a9ad62d6fc%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Questions on Django queryset iterator - wrt select_related and prefetch_related and how it works

2017-03-16 Thread Web Architect
Hi,

Could someone please let me know what the implications of Django queryset 
iterator on select_related and prefetch_related? 

Also, I am still not quite clear on the concept of iterator which I 
understand returns a Generator. Whenever a for loop is run on the 
Generator, the DB is queried for each element in the for loop - if my 
understanding is correct. The result of the Query is not stored in the 
memory. So, for some model A,

qs = A.objects.all() which probably does 'Select "all columns/fields'" from 
A in some order". This would probably fetch the results in one go. I am not 
sure how the iterator() changes this. 

BTW I observed that the iterator doesn't work like a typical Generator. 
Repeated call with next() on the Generator produces the same value. 

Would appreciate if someone could explain the above or provide any 
reference.

Thanks.

-- 
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/252d11a2-6e49-4c5a-b466-e186cf7254af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Questions on Django queryset iterator - wrt select_related and prefetch_related and how it works

2017-03-16 Thread Shawn Milochik
I think the benefit of using the iterator is best explained by an example:

Without iterator:

You loop through the queryset, using each item for  whatever you're doing.
As you do this, all the items are now in your local scope, using up RAM.
If, after the loop, you should want to loop through the data again, you
can. Upside: Can re-use the data. Downside: memory usage.

With iterator:

You loop through the queryset, using each item for  whatever you're doing.
As you do this, read items are garbage-collected. If you want to loop
through the data again, you'll have to hit the database again. Upside:
Memory usage.

-- 
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/CAOzwKwGuO_Yt8ir3XaB9BaY%3DF7Y2R87tGKx6ArAtiFmL0qzDFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: need advice/tips on storing favicon in my django bookmark app

2017-03-16 Thread Antonis Christofides
The favicon is pointed to inside the web page by an element such as this:. This is inside the . To find the favicon
you need to parse the HTML and locate the element. If you choose to download it
and store it, the canonical way would be to use an ImageField.

Regards,

A.

Antonis Christofides
http://djangodeployment.com


On 03/16/2017 11:15 PM, Stephen Fox wrote:
> I've developed a bookmark manager app in django. Things are working well. It's
> pretty cool, has a js bookmarklet and such. In my model I have fields such as
> link title, link category, link url, etc... I'd like to have an image as well.
>
> So I was thinking of grabbing the favicon for the links and storing that as
> base64 in a CharField. Then pass that to the template and show an image along
> with the other link info.
>
> I've had some issues however, I've tried messing with pyfav and just grabbing
> /favicon.ico and trying to encode to base64. I suppose I could also just point
> to {{ link.url }}/favicon.ico but not every site offers the favicon that way.
>
> Just curious to see what other ideas someone has for offering an image to go
> along with my saved links.
>
> Thanks
> -- 
> 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/705681e0-7050-44f7-ba8b-cc1ed66de7db%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/43895337-e7ca-8ab5-cf1f-46d6b5089fb1%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.