pywkhtmltopdf [Was: [mezzanine-users] Re: Images in .pdf Invoice]

2016-06-28 Thread Mike Dewhirst

Sorry for hijacking a thread from Mezzanine ...

On 29/06/2016 11:22 AM, Sam Kingston wrote:

I'm not sure if this will help you or not, but I developed a replacement
library for xhtml2pdf (though not a drop-in):

https://github.com/sjkingo/pywkhtmltopdf


Thank you Sam :)

Do you have a separate users list for questions?

In case not, I'm trying to display a page produced with function-based 
views. Is there a hint you can offer?


I want the "View on site" button to produce pdf.

Maybe the real question is how do I change from function based views to 
class based views - which BTW I don't want to do.


Thanks

Mike




On Friday, 24 June 2016 20:13:05 UTC+10, Joseph Mohan wrote:

Any other things i'm missing with regards to getting an image into
the .pdf invoices?

Set the url to a full path

Tried .png/.jpgÂ

Nothing...

Any ideas?

--
You received this message because you are subscribed to the Google
Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to mezzanine-users+unsubscr...@googlegroups.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/c7d2fe2c-86b2-0162-10f9-8993d25b9beb%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Serving static files

2016-06-28 Thread Ankush Thakur
Hmmm. One argument I read supporting separate servers is that it would save
the main server a few socket connections. But this appears to be too little
of a gain. The approach of using a CDN, I think, is much more sensible.

Thanks once again, Tim!


Regards,
Ankush Thakur

On Wed, Jun 29, 2016 at 7:33 AM, Tim Graham  wrote:

> The concerns about needing a separate server are likely overblown. In
> particular, Whitenoise is a popular solution for static file serving using
> Python. See its FAQ:
> http://whitenoise.evans.io/en/stable/#isn-t-serving-static-files-from-python-horribly-inefficient
>
> On Tuesday, June 28, 2016 at 9:59:26 PM UTC-4, Ankush Thakur wrote:
>>
>> Thanks but I'm afraid I wasn't able to grasp the point of that article.
>> Could you break it down for me, please?
>>
>> ~~Ankush
>>
>> On Monday, June 27, 2016 at 10:07:43 PM UTC+5:30, ludovic coues wrote:
>>>
>>> It's not that the framework will come to an halt. It's that a server
>>> serving static file directly would be an order of magnitude faster.
>>>
>>> https://unix4lyfe.org/time/hn.html is a nice article on how server
>>> react to heavy load when serving static file.
>>>
>>> 2016-06-27 18:26 GMT+02:00 Ankush Thakur :
>>> > I keep hearing in the docs and in tutorials that frameworks are
>>> horrible
>>> > when it comes to service static files. In production, also, one needs
>>> to set
>>> > up another dedicated server to serve static files.
>>> >
>>> > I'm wondering why. What is so special about serving static files that
>>> a
>>> > framework comes to a halt, even though the same framework can happily
>>> serve
>>> > thousands of requests per hour?
>>> >
>>> > Regards,
>>> > Ankush Thakur
>>> >
>>> > --
>>> > 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/CALX%3DrKLw_nMxZz7xeC0N%3D5Zwn0Q0eZnV_GFGkdwmP-%3DabtPMUQ%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 a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/U1Y52ad4lDM/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/c2f1699e-9bfc-43f4-a858-a54a256cec1d%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/CALX%3DrKKR-40%2B%3DjssfSk6HEaTk3ibkKQqENDA6gQ2Acjzm2q3bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: AUTH_PASSWORD_VALIDATORS not used when creating new users?

2016-06-28 Thread Farhan Khan
Even when I use User.objects.create_user() I am still not required to use a 
strong password. Considering that createsuperuser and changepassword are 
management commands, it seems odd that require a password that conforms 
with AUTH_PASSWORD_VALIDATORS there, but not with a function I would use in 
production code.

On Tuesday, June 28, 2016 at 10:00:06 PM UTC-4, Tim Graham wrote:
>
> Validation happens in the management commands (createsuperuser, 
> changepassword) as well as the user creation forms. We assume that if 
> you're creating a user using the command line, you know what you're doing. 
> If you want to open a documentation ticket, we could add a note about this.
>
> On Monday, June 27, 2016 at 9:29:56 PM UTC-4, Farhan Khan wrote:
>>
>> Hi all,
>>
>> I set the AUTH_PASSWORD_VALIDATORS variable to the standard set here: 
>> https://docs.djangoproject.com/en/1.9/topics/auth/passwords/#enabling-password-validation.
>>  
>> When I use the `createsuperuser` function in manage.py, my password must 
>> conform to the validators. But when I use User.objects.create_user() or the 
>> user.set_password() methods, the AUTH_PASSWORD_VALIDATORS is not used. I 
>> can literally set my password to 'a' and its accepted.
>>
>> Is this a bug? It seems like the validators should be used when creating 
>> a new user or setting the password.
>> Is is there an alternative method to validate the password prior to 
>> creation?
>>
>> I am using Django 1.9.7
>>
>> Thanks!
>> ---
>> Farhan Khan
>> PGP Fingerprint: 4A78 F071 5CB6 E771 B8D6 3910 F371 FE22 3B20 B21B
>>
>

-- 
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/e44a9871-0aeb-4cc4-96ec-a9866e6d6f74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Serving static files

2016-06-28 Thread Tim Graham
The concerns about needing a separate server are likely overblown. In 
particular, Whitenoise is a popular solution for static file serving using 
Python. See its FAQ: 
http://whitenoise.evans.io/en/stable/#isn-t-serving-static-files-from-python-horribly-inefficient

On Tuesday, June 28, 2016 at 9:59:26 PM UTC-4, Ankush Thakur wrote:
>
> Thanks but I'm afraid I wasn't able to grasp the point of that article. 
> Could you break it down for me, please? 
>
> ~~Ankush
>
> On Monday, June 27, 2016 at 10:07:43 PM UTC+5:30, ludovic coues wrote:
>>
>> It's not that the framework will come to an halt. It's that a server 
>> serving static file directly would be an order of magnitude faster. 
>>
>> https://unix4lyfe.org/time/hn.html is a nice article on how server 
>> react to heavy load when serving static file. 
>>
>> 2016-06-27 18:26 GMT+02:00 Ankush Thakur : 
>> > I keep hearing in the docs and in tutorials that frameworks are 
>> horrible 
>> > when it comes to service static files. In production, also, one needs 
>> to set 
>> > up another dedicated server to serve static files. 
>> > 
>> > I'm wondering why. What is so special about serving static files that a 
>> > framework comes to a halt, even though the same framework can happily 
>> serve 
>> > thousands of requests per hour? 
>> > 
>> > Regards, 
>> > Ankush Thakur 
>> > 
>> > -- 
>> > 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/CALX%3DrKLw_nMxZz7xeC0N%3D5Zwn0Q0eZnV_GFGkdwmP-%3DabtPMUQ%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/c2f1699e-9bfc-43f4-a858-a54a256cec1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How by help Python generate random image with vector figures.

2016-06-28 Thread Tim Graham
This probably isn't the best place to ask since it isn't Django related.

On Tuesday, June 28, 2016 at 6:16:20 AM UTC-4, Seti Volkylany wrote:
>
> I need a pure python module from PyPI without additional packages on my OS.
>

-- 
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/610ae409-f8f3-48ad-8855-cd31bfa13f2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AUTH_PASSWORD_VALIDATORS not used when creating new users?

2016-06-28 Thread Tim Graham
Validation happens in the management commands (createsuperuser, 
changepassword) as well as the user creation forms. We assume that if 
you're creating a user using the command line, you know what you're doing. 
If you want to open a documentation ticket, we could add a note about this.

On Monday, June 27, 2016 at 9:29:56 PM UTC-4, Farhan Khan wrote:
>
> Hi all,
>
> I set the AUTH_PASSWORD_VALIDATORS variable to the standard set here: 
> https://docs.djangoproject.com/en/1.9/topics/auth/passwords/#enabling-password-validation.
>  
> When I use the `createsuperuser` function in manage.py, my password must 
> conform to the validators. But when I use User.objects.create_user() or the 
> user.set_password() methods, the AUTH_PASSWORD_VALIDATORS is not used. I 
> can literally set my password to 'a' and its accepted.
>
> Is this a bug? It seems like the validators should be used when creating a 
> new user or setting the password.
> Is is there an alternative method to validate the password prior to 
> creation?
>
> I am using Django 1.9.7
>
> Thanks!
> ---
> Farhan Khan
> PGP Fingerprint: 4A78 F071 5CB6 E771 B8D6 3910 F371 FE22 3B20 B21B
>

-- 
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/e7320f01-21db-417c-b6c0-b5e0335d0508%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Serving static files

2016-06-28 Thread Ankush Thakur
Thanks but I'm afraid I wasn't able to grasp the point of that article. 
Could you break it down for me, please? 

~~Ankush

On Monday, June 27, 2016 at 10:07:43 PM UTC+5:30, ludovic coues wrote:
>
> It's not that the framework will come to an halt. It's that a server 
> serving static file directly would be an order of magnitude faster. 
>
> https://unix4lyfe.org/time/hn.html is a nice article on how server 
> react to heavy load when serving static file. 
>
> 2016-06-27 18:26 GMT+02:00 Ankush Thakur  >: 
> > I keep hearing in the docs and in tutorials that frameworks are horrible 
> > when it comes to service static files. In production, also, one needs to 
> set 
> > up another dedicated server to serve static files. 
> > 
> > I'm wondering why. What is so special about serving static files that a 
> > framework comes to a halt, even though the same framework can happily 
> serve 
> > thousands of requests per hour? 
> > 
> > Regards, 
> > Ankush Thakur 
> > 
> > -- 
> > 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/CALX%3DrKLw_nMxZz7xeC0N%3D5Zwn0Q0eZnV_GFGkdwmP-%3DabtPMUQ%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/4ee672fa-f6d8-4882-8420-ac57032e4904%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use password_change function from django.contrib.auth.views

2016-06-28 Thread Tim Graham
You need a url() with name='password_change_done' -- instead you wrote 
'change_password_done'.

On Monday, June 27, 2016 at 11:39:23 AM UTC-4, Juan Sebastian Avila 
Rodriguez wrote:
>
> I tried to implement the password_change view but is not working. I only 
> add the code below to the urls.py:
>
> from django.contrib.auth import views as auth_views
>
> ...
>
> url(
> r'^change-password/$',
> auth_views.password_change,
>
> name='change_password'
>
> ),
>
> url(
>
> r'^change-password/done$',
>
> auth_views.password_change_done,
>
> name='change_password_done'
>
> ),
>
> ...
>
>
> In the base.html template. Add the  tag with href="{% url 
> 'change_password' %}". When I click on it. I get this error:
>
>
> NoReverseMatch at /change-password/
> Reverse for 'password_change_done' with arguments '()' and keyword arguments 
> '{}' not found. 0 pattern(s) tried: []
>
>
> Thank you 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+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/f1e91da0-4b8e-49ca-ac61-49259fb53e25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Confused about this aggregation example from the docs

2016-06-28 Thread Tim Graham
'book' (the model name) is the default value of ForeignKey.related_name for 
the publisher field on Book.

class Book(models.Model):
publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE)

https://docs.djangoproject.com/en/stable/ref/models/fields/#django.db.models.ForeignKey.related_name

On Saturday, June 25, 2016 at 10:11:44 AM UTC-4, Ankush Thakur wrote:
>
> On this page https://docs.djangoproject.com/en/1.9/topics/db/aggregation/ 
> we have the following example of aggregation:
>
> # All the following queries involve traversing the Book<->Publisher
> # foreign key relationship backwards.
>
> # Each publisher, each with a count of books as a "num_books" attribute.
> >>> from django.db.models import Count
> >>> pubs = Publisher.objects.annotate(num_books=Count('book'))
> >>> pubs
> [, , ...]
> >>> pubs[0].num_books
> 73
>
> ​The models used in this are as follows: 
>
> from django.db import models
>
> class Author(models.Model):
> name = models.CharField(max_length=100)
> age = models.IntegerField()
>
> class Publisher(models.Model):
> name = models.CharField(max_length=300)
> num_awards = models.IntegerField()
>
> class Book(models.Model):
> name = models.CharField(max_length=300)
> pages = models.IntegerField()
> price = models.DecimalField(max_digits=10, decimal_places=2)
> rating = models.FloatField()
> authors = models.ManyToManyField(Author)
> publisher = models.ForeignKey(Publisher)
> pubdate = models.DateField()
>
> class Store(models.Model):
> name = models.CharField(max_length=300)
> books = models.ManyToManyField(Book)
> registered_users = models.PositiveIntegerField()
>
> My question is: How come something like 
> "Publisher.objects.annotate(num_books=Count('book'))" work? The name "book" 
> is not defined as a reverse relationship (I think it should be accessible 
> by "book_set"). 
>
> How is this traversal working?
>
> ​
> Regards,
> Ankush Thakur
>

-- 
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/5ee2d7cb-4247-45e0-9bb0-e5cb8013b04c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: error logging in after updating to 1.9

2016-06-28 Thread Tim Graham
Did you upgrade Django version by version as suggested in our upgrade guide 
[0] and fix deprecation warnings along the way? That might help alert you 
to the issue.

[0] https://docs.djangoproject.com/en/dev/howto/upgrade-version/

On Tuesday, June 28, 2016 at 4:05:06 PM UTC-4, larry@gmail.com wrote:
>
> I had a 1.6 app and I updated to 1.9. Now when I try to login it fails 
> and I see this in the logs. This works in 1.6. Any ideas what the 
> issue is? 
>
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while 
> resolving variable 'STATIC_URL' in template 'registration/login.html'. 
> Traceback (most recent call last): 
>   File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", 
> line 901, in _resolve_lookup 
> (bit, current))  # missing attribute 
> VariableDoesNotExist: Failed lookup for key [STATIC_URL] in 
> u"[{'False': False, 'None': None, 'True': True}, {u'csrf_token': 
> >, 
> 'PYTHON_VERSION': '2.7.9 (default, Mar  1 2015, 13:01:26) ', 'perms': 
>  0x7f0e9ae23290>, u'request': , 'ELUCID_VERSION': 
> 'unknown', 'messages': 
>  0x7f0e9ae23310>, 'is_elucid': True, 'my_reports': {}, 
> 'ELUCID_HOSTNAME': '0d226ac61524', 'user':  admin>>, 'ELUCID_SERVER_NAME': 'localhost', 'NAVSTRUCT': [], 
> 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'WARNING': 30, 
> 'SUCCESS': 25, 'ERROR': 40}, 'base_template': 'base_elucid.html', 
> 'DJANGO_VERSION': '1.9'}, {}, {'site_name': 'bekku.bbmsc.com:8004', 
> 'site':  0x7f0e9ae23750>, 'form':  valid=Unknown, fields=(username;password)>, 'next': ''}]" 
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while 
> resolving variable 'msie6_user_agent' in template 
> 'registration/login.html'. 
> Traceback (most recent call last): 
>   File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", 
> line 901, in _resolve_lookup 
> (bit, current))  # missing attribute 
> VariableDoesNotExist: Failed lookup for key [msie6_user_agent] in 
> u"[{'False': False, 'None': None, 'True': True}, {u'csrf_token': 
> >, 
> 'PYTHON_VERSION': '2.7.9 (default, Mar  1 2015, 13:01:26) ', 'perms': 
>  0x7f0e9ae23290>, u'request': , 'ELUCID_VERSION': 
> 'unknown', 'messages': 
>  0x7f0e9ae23310>, 'is_elucid': True, 'my_reports': {}, 
> 'ELUCID_HOSTNAME': '0d226ac61524', 'user':  admin>>, 'ELUCID_SERVER_NAME': 'localhost', 'NAVSTRUCT': [], 
> 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'WARNING': 30, 
> 'SUCCESS': 25, 'ERROR': 40}, 'base_template': 'base_elucid.html', 
> 'DJANGO_VERSION': '1.9'}, {}, {'site_name': 'bekku.bbmsc.com:8004', 
> 'site':  0x7f0e9ae23750>, 'form':  valid=Unknown, fields=(username;password)>, 'next': ''}]" 
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while 
> resolving variable 'STATIC_URL' in template 'registration/login.html'. 
> Traceback (most recent call last): 
>   File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", 
> line 901, in _resolve_lookup 
> (bit, current))  # missing attribute 
> VariableDoesNotExist: Failed lookup for key [STATIC_URL] in 
> u"[{'False': False, 'None': None, 'True': True}, {u'csrf_token': 
> >, 
> 'PYTHON_VERSION': '2.7.9 (default, Mar  1 2015, 13:01:26) ', 'perms': 
>  0x7f0e9ae23290>, u'request': , 'ELUCID_VERSION': 
> 'unknown', 'messages': 
>  0x7f0e9ae23310>, 'is_elucid': True, 'my_reports': {}, 
> 'ELUCID_HOSTNAME': '0d226ac61524', 'user':  admin>>, 'ELUCID_SERVER_NAME': 'localhost', 'NAVSTRUCT': [], 
> 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'WARNING': 30, 
> 'SUCCESS': 25, 'ERROR': 40}, 'base_template': 'base_elucid.html', 
> 'DJANGO_VERSION': '1.9'}, {}, {'site_name': 'bekku.bbmsc.com:8004', 
> 'site':  0x7f0e9ae23750>, 'form':  valid=Unknown, fields=(username;password)>, 'next': ''}]" 
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while 
> resolving variable 'User' in template 'registration/login.html'. 
> Traceback (most recent call last): 
>   File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", 
> line 901, in _resolve_lookup 
> (bit, current))  # missing attribute 
> VariableDoesNotExist: Failed lookup for key [User] in u" '/'>" 
> [28/Jun/2016 17:43:51] WARNING [django.request:182] Not Found: 
> /scripts/chosen/chosen.css 
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while 
> resolving variable 'name' in template 'unknown'. 
> Traceback (most recent call last): 
>   File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", 
> line 901, in _resolve_lookup 
> (bit, current))  # missing attribute 
> VariableDoesNotExist: Failed lookup for key [name] in 
> u' (admin:admin) ^admin/>' 
> [28/Jun/2016 17:43:51] WARNING [django.request:182] Not Found: 
> /scripts/chosen/chosen.jquery.min.js 
> [28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while 
> resolving variable 'name' in template 'unknown'. 
> Traceback (most recent call last): 
>   File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", 

Re: Contribute to Django - Python 3 or Python 2

2016-06-28 Thread Tim Graham
You can use either, but use Python 3. You can rely on the continuous 
integration server to test your pull request on Python 2 and debug any 
issues

Can you given an example of "most places python2 is used"? In fact, the 
tutorial says, "This tutorial assumes you are using Python 3."

On Tuesday, June 28, 2016 at 7:45:02 PM UTC-4, premdjango wrote:
>
> Hello,
> Im trying to contribute to Django project and started with this document.
>
> https://docs.djangoproject.com/en/dev/intro/contributing/
>
> Here in couple of places I see Python3 is being used but in most places 
> python2 is used.
>
> Should I use Python 3 or Python 2?
>
>
>

-- 
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/a0539448-0019-40a2-b732-e2c44799877b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Contribute to Django - Python 3 or Python 2

2016-06-28 Thread Farhan Khan
I switched from Python2 to Python3 because I needed my Django code to fire 
off some TLSv1.2 code, that python2 could not do. I barely notice the 
difference between the two except in very small syntax differences. When I 
switched from python2 to python3, I literally did this:

find ./ -name "*.py" -exec 2to3 -w {} \;

And everything worked :)

I found it to have a more profound impact in other frameworks, such as 
Twisted or any type of socket programming, where you need to worry about 
encoding/decoding between unicode and binary strings.

On Tuesday, June 28, 2016 at 7:45:02 PM UTC-4, premdjango wrote:
>
> Hello,
> Im trying to contribute to Django project and started with this document.
>
> https://docs.djangoproject.com/en/dev/intro/contributing/
>
> Here in couple of places I see Python3 is being used but in most places 
> python2 is used.
>
> Should I use Python 3 or Python 2?
>
>
>

-- 
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/9ca05994-67cc-4ee4-bddd-1bd912dbe406%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django tests failing for development env

2016-06-28 Thread Tim Graham
If you're running the tests at the checkout point mentioned in the tutorial 
note, "If you’re using Python 3.5+, there will be a couple failures related 
to deprecation warnings that you can ignore. These failures have since been 
fixed in Django."

On Tuesday, June 28, 2016 at 7:49:43 PM UTC-4, premdjango wrote:
>
> I want to contribute to Django community, so I was trying to setup my env 
> using the following doc - 
>
> https://docs.djangoproject.com/en/dev/intro/contributing/
>
>
> I ran the tests and get the following output - 
>
> ==
>
> FAIL: test_old_style_storage (file_storage.tests.FileFieldStorageTests)
>
> --
>
> Traceback (most recent call last):
>
>   File 
> "/Users/prem/Documents/django-contribute/django/tests/file_storage/tests.py", 
> line 566, in test_old_style_storage
>
> self.assertEqual(len(warns), 2)
>
> AssertionError: 4 != 2
>
>
> ==
>
> FAIL: test_migrate_legacy_router (multiple_database.tests.RouterTestCase)
>
> --
>
> Traceback (most recent call last):
>
>   File 
> "/Users/prem/Documents/django-contribute/django/tests/multiple_database/tests.py",
>  
> line 954, in test_migrate_legacy_router
>
> self.assertEqual(recorded, [])
>
> AssertionError: Lists differ: [ 0x1130bdda0>] != []
>
>
> First list contains 1 additional elements.
>
> First extra element 0:
>
> {message : DeprecationWarning('inspect.getargspec() is deprecated, use 
> inspect.signature() instead',), category : 'DeprecationWarning', filename : 
> '/Users/premDocuments/django-contribute/django/django/db/utils.py', lineno 
> : 293, line : None}
>
>
> - []
>
> + []
>
>
> ==
>
> FAIL: test_if_tag_eq_deprecated 
> (template_tests.syntax_tests.test_if.IfTagTests)
>
> --
>
> Traceback (most recent call last):
>
>   File 
> "/Users/prem/Documents/django-contribute/django/django/test/utils.py", line 
> 182, in inner
>
> return test_func(*args, **kwargs)
>
>   File 
> "/Users/prem/Documents/django-contribute/django/tests/template_tests/utils.py",
>  
> line 62, in inner
>
> func(self)
>
>   File 
> "/Users/prem/Documents/django-contribute/django/tests/template_tests/syntax_tests/test_if.py",
>  
> line 537, in test_if_tag_eq_deprecated
>
> self.assertEqual(len(warns), 1)
>
> AssertionError: 3 != 1
>
>
> ==
>
> FAIL: test_only_new_files 
> (utils_tests.test_autoreload.TestFilenameGenerator)
>
> --
>
> Traceback (most recent call last):
>
>   File 
> "/Users/prem/Documents/django-contribute/django/tests/utils_tests/test_autoreload.py",
>  
> line 87, in test_only_new_files
>
> self.assertEqual(len(filenames2), 1)
>
> AssertionError: 0 != 1
>
>
> --
>
> Ran 9637 tests in 202.521s
>
>
> FAILED (failures=4, skipped=856, expected failures=6)
>
> Destroying test database for alias 'default'...
>
> Destroying test database for alias 'other'.
>
>
>
> Not sure, if the errors are valid or not. One thing I see is expected 
> failures =6
>
>
>
>

-- 
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/5c707d7e-a08a-403f-acf2-df37f6288ebd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django tests failing for development env

2016-06-28 Thread premdjango
I want to contribute to Django community, so I was trying to setup my env 
using the following doc - 

https://docs.djangoproject.com/en/dev/intro/contributing/


I ran the tests and get the following output - 

==

FAIL: test_old_style_storage (file_storage.tests.FileFieldStorageTests)

--

Traceback (most recent call last):

  File 
"/Users/prem/Documents/django-contribute/django/tests/file_storage/tests.py", 
line 566, in test_old_style_storage

self.assertEqual(len(warns), 2)

AssertionError: 4 != 2


==

FAIL: test_migrate_legacy_router (multiple_database.tests.RouterTestCase)

--

Traceback (most recent call last):

  File 
"/Users/prem/Documents/django-contribute/django/tests/multiple_database/tests.py",
 
line 954, in test_migrate_legacy_router

self.assertEqual(recorded, [])

AssertionError: Lists differ: [] != []


First list contains 1 additional elements.

First extra element 0:

{message : DeprecationWarning('inspect.getargspec() is deprecated, use 
inspect.signature() instead',), category : 'DeprecationWarning', filename : 
'/Users/premDocuments/django-contribute/django/django/db/utils.py', lineno 
: 293, line : None}


- []

+ []


==

FAIL: test_if_tag_eq_deprecated 
(template_tests.syntax_tests.test_if.IfTagTests)

--

Traceback (most recent call last):

  File 
"/Users/prem/Documents/django-contribute/django/django/test/utils.py", line 
182, in inner

return test_func(*args, **kwargs)

  File 
"/Users/prem/Documents/django-contribute/django/tests/template_tests/utils.py", 
line 62, in inner

func(self)

  File 
"/Users/prem/Documents/django-contribute/django/tests/template_tests/syntax_tests/test_if.py",
 
line 537, in test_if_tag_eq_deprecated

self.assertEqual(len(warns), 1)

AssertionError: 3 != 1


==

FAIL: test_only_new_files 
(utils_tests.test_autoreload.TestFilenameGenerator)

--

Traceback (most recent call last):

  File 
"/Users/prem/Documents/django-contribute/django/tests/utils_tests/test_autoreload.py",
 
line 87, in test_only_new_files

self.assertEqual(len(filenames2), 1)

AssertionError: 0 != 1


--

Ran 9637 tests in 202.521s


FAILED (failures=4, skipped=856, expected failures=6)

Destroying test database for alias 'default'...

Destroying test database for alias 'other'.



Not sure, if the errors are valid or not. One thing I see is expected 
failures =6



-- 
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/340a2acb-6459-4f1e-9b25-0d3a4d8a5b3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Contribute to Django - Python 3 or Python 2

2016-06-28 Thread premdjango
Hello,
Im trying to contribute to Django project and started with this document.

https://docs.djangoproject.com/en/dev/intro/contributing/

Here in couple of places I see Python3 is being used but in most places 
python2 is used.

Should I use Python 3 or Python 2?


-- 
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/55a3a553-72d9-4ad9-a3fa-f8ae11b30f40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: running devel server in docker container

2016-06-28 Thread Larry Martell
On Tue, Jun 28, 2016 at 5:11 PM, Michal Petrucha
 wrote:
> On Tue, Jun 28, 2016 at 05:01:20PM -0400, Larry Martell wrote:
>> I am trying to run the devel server in a docker container. On the
>> physical machine I don't have port 8000 available and I usually use
>> 8006 for the devel server. Outside of the docker container I can
>> connect to 8006. Inside the container I tried both:
>>
>> manage.py runserver 0.0.0.0:8006
>>
>> and just manage.py runserver when starting the container with -p 8006:8000
>>
>> But in both cases I cannot connect to the devel server at 8006. Anyone
>> know how to do this?
>
> In the example you described, you launched runserver to listen on port
> 8006 inside the container, and then told docker to forward the host
> port 8006 to port 8000 inside the container, but there's nothing
> listening on port 8000 inside the container.
>
> You'll want either to start the development server at port 8000 (and
> keep the -p 8006:8000), or change the -p argument to 8006:8006.

Those were 2 different examples. In one case I started the container
with -p 8006:8000 and did:

runserver 0.0.0.0:8000

In the other case I didn't specify a the  -p 8006:8000 at all and did:

runserver 0.0.0.0:8006

I could not connect in either case.

I just tried the second case again with -p 8006:8006 but still no joy.

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


Re: running devel server in docker container

2016-06-28 Thread Michal Petrucha
On Tue, Jun 28, 2016 at 05:01:20PM -0400, Larry Martell wrote:
> I am trying to run the devel server in a docker container. On the
> physical machine I don't have port 8000 available and I usually use
> 8006 for the devel server. Outside of the docker container I can
> connect to 8006. Inside the container I tried both:
> 
> manage.py runserver 0.0.0.0:8006
> 
> and just manage.py runserver when starting the container with -p 8006:8000
> 
> But in both cases I cannot connect to the devel server at 8006. Anyone
> know how to do this?

In the example you described, you launched runserver to listen on port
8006 inside the container, and then told docker to forward the host
port 8006 to port 8000 inside the container, but there's nothing
listening on port 8000 inside the container.

You'll want either to start the development server at port 8000 (and
keep the -p 8006:8000), or change the -p argument to 8006:8006.

Good luck,

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/20160628211153.GU29054%40konk.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Digital signature


running devel server in docker container

2016-06-28 Thread Larry Martell
I am trying to run the devel server in a docker container. On the
physical machine I don't have port 8000 available and I usually use
8006 for the devel server. Outside of the docker container I can
connect to 8006. Inside the container I tried both:

manage.py runserver 0.0.0.0:8006

and just manage.py runserver when starting the container with -p 8006:8000

But in both cases I cannot connect to the devel server at 8006. Anyone
know how to 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+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/CACwCsY6P7LNutqRNu9FCA-VP8Y6OtDugWGXOwAef92knn9xFnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


error logging in after updating to 1.9

2016-06-28 Thread Larry Martell
I had a 1.6 app and I updated to 1.9. Now when I try to login it fails
and I see this in the logs. This works in 1.6. Any ideas what the
issue is?

[28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
resolving variable 'STATIC_URL' in template 'registration/login.html'.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
line 901, in _resolve_lookup
(bit, current))  # missing attribute
VariableDoesNotExist: Failed lookup for key [STATIC_URL] in
u"[{'False': False, 'None': None, 'True': True}, {u'csrf_token':
>,
'PYTHON_VERSION': '2.7.9 (default, Mar  1 2015, 13:01:26) ', 'perms':
, u'request': , 'ELUCID_VERSION':
'unknown', 'messages':
, 'is_elucid': True, 'my_reports': {},
'ELUCID_HOSTNAME': '0d226ac61524', 'user': >, 'ELUCID_SERVER_NAME': 'localhost', 'NAVSTRUCT': [],
'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'WARNING': 30,
'SUCCESS': 25, 'ERROR': 40}, 'base_template': 'base_elucid.html',
'DJANGO_VERSION': '1.9'}, {}, {'site_name': 'bekku.bbmsc.com:8004',
'site': , 'form': , 'next': ''}]"
[28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
resolving variable 'msie6_user_agent' in template
'registration/login.html'.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
line 901, in _resolve_lookup
(bit, current))  # missing attribute
VariableDoesNotExist: Failed lookup for key [msie6_user_agent] in
u"[{'False': False, 'None': None, 'True': True}, {u'csrf_token':
>,
'PYTHON_VERSION': '2.7.9 (default, Mar  1 2015, 13:01:26) ', 'perms':
, u'request': , 'ELUCID_VERSION':
'unknown', 'messages':
, 'is_elucid': True, 'my_reports': {},
'ELUCID_HOSTNAME': '0d226ac61524', 'user': >, 'ELUCID_SERVER_NAME': 'localhost', 'NAVSTRUCT': [],
'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'WARNING': 30,
'SUCCESS': 25, 'ERROR': 40}, 'base_template': 'base_elucid.html',
'DJANGO_VERSION': '1.9'}, {}, {'site_name': 'bekku.bbmsc.com:8004',
'site': , 'form': , 'next': ''}]"
[28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
resolving variable 'STATIC_URL' in template 'registration/login.html'.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
line 901, in _resolve_lookup
(bit, current))  # missing attribute
VariableDoesNotExist: Failed lookup for key [STATIC_URL] in
u"[{'False': False, 'None': None, 'True': True}, {u'csrf_token':
>,
'PYTHON_VERSION': '2.7.9 (default, Mar  1 2015, 13:01:26) ', 'perms':
, u'request': , 'ELUCID_VERSION':
'unknown', 'messages':
, 'is_elucid': True, 'my_reports': {},
'ELUCID_HOSTNAME': '0d226ac61524', 'user': >, 'ELUCID_SERVER_NAME': 'localhost', 'NAVSTRUCT': [],
'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'WARNING': 30,
'SUCCESS': 25, 'ERROR': 40}, 'base_template': 'base_elucid.html',
'DJANGO_VERSION': '1.9'}, {}, {'site_name': 'bekku.bbmsc.com:8004',
'site': , 'form': , 'next': ''}]"
[28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
resolving variable 'User' in template 'registration/login.html'.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
line 901, in _resolve_lookup
(bit, current))  # missing attribute
VariableDoesNotExist: Failed lookup for key [User] in u""
[28/Jun/2016 17:43:51] WARNING [django.request:182] Not Found:
/scripts/chosen/chosen.css
[28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
resolving variable 'name' in template 'unknown'.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
line 901, in _resolve_lookup
(bit, current))  # missing attribute
VariableDoesNotExist: Failed lookup for key [name] in
u' (admin:admin) ^admin/>'
[28/Jun/2016 17:43:51] WARNING [django.request:182] Not Found:
/scripts/chosen/chosen.jquery.min.js
[28/Jun/2016 17:43:51] DEBUG [django.template:923] Exception while
resolving variable 'name' in template 'unknown'.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py",
line 901, in _resolve_lookup
(bit, current))  # missing attribute
VariableDoesNotExist: Failed lookup for key [name] in
u' (admin:admin) ^admin/>'

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


Tip: django-admin-easy

2016-06-28 Thread Ezequiel Bertti
Guys,

I did release a new version of django-admin-easy. Version 0.3

It is a collection of mixin, decorators and fields to be used on
django-admin.

It made what was already simple into something easy

Please, let me know if you have some suggestions, get some issue or want to
collaborate.

https://pypi.python.org/pypi/django-admin-easy

https://github.com/ebertti/django-admin-easy

Best regards

-- 
Ezequiel Bertti

https://telegram.me/ebertti
https://twitter.com/ebertti
https://github.com/ebertti

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


How to create the template "groups part" users admin. In my app?

2016-06-28 Thread Fellipe Henrique
Hello,

I have 2 model... Model A and B... Model A can has N records of B... That's
simple to do in django... But I want to build the HTML part.. Using the
same mechanism which django use on Groups... In one side show me all
records of B, and I can select one or more to add in A model...

How can I do that, using django admin?

I prefer not use inline..

Cheers!


-- 
Sent from my iPhone

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


Re: Implementing user alias in django.

2016-06-28 Thread Asif Saifuddin
Thanks I will try your suggested way.

On Tuesday, June 28, 2016 at 6:36:02 PM UTC+6, Asif Saifuddin wrote:
>
> Hi,
>
> I'm planning to implement user alias in django. A user can create many 
> alias and each alias will work like and full user. each alias will have 
> different newsfeed/user follow other user/alias and each alias can do every 
> action a real user can do.
>
> How should I implement this user model/architecture?
>
> Thanks,
>
> Asif
>

-- 
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/5178dd3a-ede8-4a67-ad03-17683f45f514%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTTP2 Server Push with Django?

2016-06-28 Thread Bobby Mozumder
No these are for push at the app layer, for functionality purposes.

HTTP/2 server push is meant for speeding up website responsiveness, by 
delivering static assets before the request for them are even made.

-bobby

> On Jun 28, 2016, at 12:34 PM, Mario R. Osorio  wrote:
> 
> Here are some resources:
> Django Push HTTP Response to users 
> 
> Django Packages 
> django-push-notifications 
> 
> Django-PuSH 
> django-pushserver 
> SwampDragon 
> On Tuesday, June 28, 2016 at 8:46:26 AM UTC-4, Bobby Mozumder wrote:
> Does anyone know of an http/2 server with server push capability that can 
> work with Django? 
>  
> It looks like nginx supports http2 with uWSGI, but it doesn’t actually 
> support server push capability.
>  
> I also found the h2o server, but it doesn’t look like it supports uWSGI yet..
>  
> Any other options out there for http2 server push, preferably with 
> cache-aware server push?
>  
> (I’d set http “Link” headers in my app to direct server push.)
>  
> -bobby
> 
> -- 
> 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/0aaaeb31-dcd7-430c-973a-fa1a0c6331ee%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/CB2E870B-4C9E-45F8-9132-B59CA5054922%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTTP2 Server Push with Django?

2016-06-28 Thread Mario R. Osorio
Here are some resources:

   - Django Push HTTP Response to users 
   

   - Django Packages 
   - django-push-notifications 
   
   - Django-PuSH 
   - django-pushserver 
   - SwampDragon 

On Tuesday, June 28, 2016 at 8:46:26 AM UTC-4, Bobby Mozumder wrote:

> Does anyone know of an http/2 server with server push capability that can 
> work with Django? 
>  
> It looks like nginx supports http2 with uWSGI, but it doesn’t actually 
> support server push capability. 
>  
> I also found the h2o server, but it doesn’t look like it supports uWSGI 
> yet.. 
>  
> Any other options out there for http2 server push, preferably with 
> cache-aware server push? 
>  
> (I’d set http “Link” headers in my app to direct server push.) 
>  
> -bobby
>

-- 
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/0aaaeb31-dcd7-430c-973a-fa1a0c6331ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: wsgi setup + django 1.9 + python 3.5.1 on mac os x

2016-06-28 Thread Coulson Kgathi
ok thanks

c.t.kgathi
On 28 Jun 2016 16:57, "Avraham Serour"  wrote:

> most are for linux, but I believe you can adapt
>
>
> https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
> https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/uwsgi/
> http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
> https://www.nginx.com/resources/admin-guide/gateway-uwsgi-django/
>
> https://www.linode.com/docs/websites/nginx/deploy-django-applications-using-uwsgi-and-nginx-on-ubuntu-14-04
>
>
>
>
> On Tue, Jun 28, 2016 at 5:52 PM, Coulson Kgathi  wrote:
>
>> deploying my mac as a server
>>
>> could you point me to the proper documentation to deploy using nginx+uwsgi
>> so i can try it
>>
>>
>> On Tue, Jun 28, 2016 at 4:49 PM, Avraham Serour 
>> wrote:
>>
>>> it seems it doesn't have cffi installed
>>>
>>> but why do you want to do this? are you using the mac as server of are
>>> you setting up your development environment?
>>>
>>> for development you may just use manage.py runserver, you don't need to
>>> setup apache
>>>
>>> for the server I recommend using nginx+uwsgi, the killer feature for
>>> nginx over apache is the simpler config file
>>>
>>>
>>> On Tue, Jun 28, 2016 at 5:43 PM, Coulson Kgathi 
>>> wrote:
>>>
 I am getting an error trying to setup my django project on apache2 mac
 os x, django 1.9, python 3

 my wsgi.py looks like this

 import os

 import sys


 VIRTUALENV_PATH = '/Users/ckgathi/.virtualenvs/bcpp-interview/'

 SOURCE_ROOT_PATH = '/Users/ckgathi/source'

 LOCAL_PROJECT_RELPATH = 'bcpp-interview/'


 # Activate the virtual env

 activate_env=os.path.join(VIRTUALENV_PATH,'bin/activate_this.py')

 # execfile(activate_env, dict(__file__=activate_env))

 file_p = '/Users/ckgathi/.virtualenvs/bcpp
 -interview/bin/activate_this.py'

 exec(open(activate_env).read(), dict(__file__=activate_env))

 # Add the site-packages of the chosen virtualenv to work with

 # update path

 sys.path.insert(0, os.path.join(VIRTUALENV_PATH, 'local/lib
 /python3.5/site-packages'))

 sys.path.insert(0, os.path.join(SOURCE_ROOT_PATH,
 LOCAL_PROJECT_RELPATH))


 os.environ.setdefault("DJANGO_SETTINGS_MODULE",
 'bcpp_interview.settings')


 from django.core.wsgi import get_wsgi_application

 application = get_wsgi_application()


 and its giving me error






 [Tue Jun 28 16:41:40.781127 2016] [wsgi:error] [pid 3854] [remote
 127.0.0.1:0] mod = import_module(mod_path)

 [Tue Jun 28 16:41:40.781143 2016] [wsgi:error] [pid 3854] [remote
 127.0.0.1:0]   File
 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",
 line 37, in import_module

 [Tue Jun 28 16:41:40.781205 2016] [wsgi:error] [pid 3854] [remote
 127.0.0.1:0] __import__(name)

 [Tue Jun 28 16:41:40.781218 2016] [wsgi:error] [pid 3854] [remote
 127.0.0.1:0]   File
 "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/edc_audio_recording/apps.py",
 line 2, in 

 [Tue Jun 28 16:41:40.781265 2016] [wsgi:error] [pid 3854] [remote
 127.0.0.1:0] import sounddevice as sd

 [Tue Jun 28 16:41:40.781278 2016] [wsgi:error] [pid 3854] [remote
 127.0.0.1:0]   File
 "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/sounddevice.py",
 line 34, in 

 [Tue Jun 28 16:41:40.781765 2016] [wsgi:error] [pid 3854] [remote
 127.0.0.1:0] _ffi = _FFI()

 [Tue Jun 28 16:41:40.781779 2016] [wsgi:error] [pid 3854] [remote
 127.0.0.1:0]   File
 "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/cffi/api.py",
 line 56, in __init__

 [Tue Jun 28 16:41:40.781996 2016] [wsgi:error] [pid 3854] [remote
 127.0.0.1:0] import _cffi_backend as backend

 [Tue Jun 28 16:41:40.782018 2016] [wsgi:error] [pid 3854] [remote
 127.0.0.1:0] ImportError: No module named _cffi_backend

 [Tue Jun 28 16:41:40.898298 2016] [wsgi:info] [pid 3853] mod_wsgi
 (pid=3853): Create interpreter 'interview|'.

 [Tue Jun 28 16:41:40.900250 2016] [wsgi:info] [pid 3853] mod_wsgi
 (pid=3853): Adding '/Users/ckgathi/bcpp-interview' to path.

 [Tue Jun 28 16:41:40.900503 2016] [wsgi:info] [pid 3853] mod_wsgi
 (pid=3853): Adding
 '/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages' to
 path.

 [Tue Jun 28 16:41:40.904407 2016] [wsgi:info] [pid 3853] [remote
 127.0.0.1:0] mod_wsgi (pid=3853, process='interview',
 application='interview|'): Loading WSGI script
 

Re: wsgi setup + django 1.9 + python 3.5.1 on mac os x

2016-06-28 Thread Avraham Serour
most are for linux, but I believe you can adapt

https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/uwsgi/
http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
https://www.nginx.com/resources/admin-guide/gateway-uwsgi-django/
https://www.linode.com/docs/websites/nginx/deploy-django-applications-using-uwsgi-and-nginx-on-ubuntu-14-04




On Tue, Jun 28, 2016 at 5:52 PM, Coulson Kgathi  wrote:

> deploying my mac as a server
>
> could you point me to the proper documentation to deploy using nginx+uwsgi
> so i can try it
>
>
> On Tue, Jun 28, 2016 at 4:49 PM, Avraham Serour  wrote:
>
>> it seems it doesn't have cffi installed
>>
>> but why do you want to do this? are you using the mac as server of are
>> you setting up your development environment?
>>
>> for development you may just use manage.py runserver, you don't need to
>> setup apache
>>
>> for the server I recommend using nginx+uwsgi, the killer feature for
>> nginx over apache is the simpler config file
>>
>>
>> On Tue, Jun 28, 2016 at 5:43 PM, Coulson Kgathi 
>> wrote:
>>
>>> I am getting an error trying to setup my django project on apache2 mac
>>> os x, django 1.9, python 3
>>>
>>> my wsgi.py looks like this
>>>
>>> import os
>>>
>>> import sys
>>>
>>>
>>> VIRTUALENV_PATH = '/Users/ckgathi/.virtualenvs/bcpp-interview/'
>>>
>>> SOURCE_ROOT_PATH = '/Users/ckgathi/source'
>>>
>>> LOCAL_PROJECT_RELPATH = 'bcpp-interview/'
>>>
>>>
>>> # Activate the virtual env
>>>
>>> activate_env=os.path.join(VIRTUALENV_PATH,'bin/activate_this.py')
>>>
>>> # execfile(activate_env, dict(__file__=activate_env))
>>>
>>> file_p = '/Users/ckgathi/.virtualenvs/bcpp
>>> -interview/bin/activate_this.py'
>>>
>>> exec(open(activate_env).read(), dict(__file__=activate_env))
>>>
>>> # Add the site-packages of the chosen virtualenv to work with
>>>
>>> # update path
>>>
>>> sys.path.insert(0, os.path.join(VIRTUALENV_PATH, 'local/lib
>>> /python3.5/site-packages'))
>>>
>>> sys.path.insert(0, os.path.join(SOURCE_ROOT_PATH,
>>> LOCAL_PROJECT_RELPATH))
>>>
>>>
>>> os.environ.setdefault("DJANGO_SETTINGS_MODULE",
>>> 'bcpp_interview.settings')
>>>
>>>
>>> from django.core.wsgi import get_wsgi_application
>>>
>>> application = get_wsgi_application()
>>>
>>>
>>> and its giving me error
>>>
>>>
>>>
>>>
>>>
>>>
>>> [Tue Jun 28 16:41:40.781127 2016] [wsgi:error] [pid 3854] [remote
>>> 127.0.0.1:0] mod = import_module(mod_path)
>>>
>>> [Tue Jun 28 16:41:40.781143 2016] [wsgi:error] [pid 3854] [remote
>>> 127.0.0.1:0]   File
>>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",
>>> line 37, in import_module
>>>
>>> [Tue Jun 28 16:41:40.781205 2016] [wsgi:error] [pid 3854] [remote
>>> 127.0.0.1:0] __import__(name)
>>>
>>> [Tue Jun 28 16:41:40.781218 2016] [wsgi:error] [pid 3854] [remote
>>> 127.0.0.1:0]   File
>>> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/edc_audio_recording/apps.py",
>>> line 2, in 
>>>
>>> [Tue Jun 28 16:41:40.781265 2016] [wsgi:error] [pid 3854] [remote
>>> 127.0.0.1:0] import sounddevice as sd
>>>
>>> [Tue Jun 28 16:41:40.781278 2016] [wsgi:error] [pid 3854] [remote
>>> 127.0.0.1:0]   File
>>> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/sounddevice.py",
>>> line 34, in 
>>>
>>> [Tue Jun 28 16:41:40.781765 2016] [wsgi:error] [pid 3854] [remote
>>> 127.0.0.1:0] _ffi = _FFI()
>>>
>>> [Tue Jun 28 16:41:40.781779 2016] [wsgi:error] [pid 3854] [remote
>>> 127.0.0.1:0]   File
>>> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/cffi/api.py",
>>> line 56, in __init__
>>>
>>> [Tue Jun 28 16:41:40.781996 2016] [wsgi:error] [pid 3854] [remote
>>> 127.0.0.1:0] import _cffi_backend as backend
>>>
>>> [Tue Jun 28 16:41:40.782018 2016] [wsgi:error] [pid 3854] [remote
>>> 127.0.0.1:0] ImportError: No module named _cffi_backend
>>>
>>> [Tue Jun 28 16:41:40.898298 2016] [wsgi:info] [pid 3853] mod_wsgi
>>> (pid=3853): Create interpreter 'interview|'.
>>>
>>> [Tue Jun 28 16:41:40.900250 2016] [wsgi:info] [pid 3853] mod_wsgi
>>> (pid=3853): Adding '/Users/ckgathi/bcpp-interview' to path.
>>>
>>> [Tue Jun 28 16:41:40.900503 2016] [wsgi:info] [pid 3853] mod_wsgi
>>> (pid=3853): Adding
>>> '/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages' to
>>> path.
>>>
>>> [Tue Jun 28 16:41:40.904407 2016] [wsgi:info] [pid 3853] [remote
>>> 127.0.0.1:0] mod_wsgi (pid=3853, process='interview',
>>> application='interview|'): Loading WSGI script
>>> '/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py'.
>>>
>>> [Tue Jun 28 16:41:42.319143 2016] [wsgi:error] [pid 3853] [remote
>>> 127.0.0.1:0] mod_wsgi (pid=3853): Target WSGI script
>>> '/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py' cannot be
>>> loaded as Python module.

Getting "SMTPServerDisconnected: Connection unexpectedly closed: [Errno 104] Connection reset by peer" errors when using django.core.mail.send_mail in the loop

2016-06-28 Thread Haomin Zhang
Create a command like below, which send a mail to the user if the date meet 
the requirement:

class Command(BaseCommand):
help= 'Send mail to user regularly if there have contacts needs 
reminder'

def handle(self, *args, **options):
now = timezone.now().date()
backlogs = Backlog.objects.all()
for backlog in backlogs.iterator():
start_date = backlog.start_date
end_date = backlog.end_date
if start_date <= now and now < end_date:
user = backlog.user
user_email = user.email
user_name = user.username
if user_email is not None:
mail_title = u'Contracts need to be handling.'
mail_content = u"Dear:%s,you have messages" % user_name
link = u"http://xx.xxx.xx.xxx/contract-info/;
mail_content += link;
mail_from = 'from_em...@xx.com'
mail_to = [user_email]
send_mail(mail_title,
  mail_content,
  mail_from,
  mail_to)

This command can run well in local server. But when I launch it on the VPS 
and if call send_mail more than once, below mesasge appear:

"SMTPServerDisconnected: Connection unexpectedly closed: [Errno 104] 
Connection reset by peer"

But if only one backlog been filtered and only call once send_mail, it 
works well.

Does anybody met the issue before? thanks in advance!

-Haomin

-- 
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/f1dc8ce0-6454-474e-b747-15d832b4ac3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying Django via wsgi

2016-06-28 Thread Coulson Kgathi
how did you do that? please assist

On Saturday, 19 March 2016 00:22:18 UTC+2, parall...@gmail.com wrote:
>
> Thank you all for your replies. It turned out to be something simple. 
> Since Django was installed in a virtualenv I needed to include the path to 
> the Django libs in the wsgi paths. Done and site up.
>
> Again thanks!
>
>
>
> On Tuesday, March 15, 2016 at 5:00:10 AM UTC-7, parall...@gmail.com wrote:
>>
>> Quite new, and trying to deploy first Django site. I keep getting 503 
>> errors. Here are the particulars, any hints as to what I'm doing wrong 
>> would be much appreciated! All directories and files are group owned and 
>> writable by www-data. Ubuntu server, and Apache2.4 server where I have root 
>> access. The tutorial where I got the howto is located here:
>>
>> https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-14-04
>>
>> Thank you!
>>
>> *File structure/location:*
>>
>> /home/user/kb_venv/project_name/
>> __init__.py
>> settings.py
>> urls.py
>> wsgi.py
>> manage.py
>> app_name
>>
>> /home/user/kb_venv/project_name/project_name/
>> apache/
>> __init__.py
>> override.py
>> wsgi.py
>>
>>
>> *override.py file contents:*
>> from project_name.settings import
>> DEBUG = True
>> #ALLOWED_HOSTS = ['104.131.154.99'] (no domain name, I'm using IP to 
>> access the site)
>>
>> *wsgi.py file contents:*
>> #wsgi.py
>> import os, sys
>> # Calculate the path based on the location of the WSGI script.
>> apache_configuration= os.path.dirname(__file__)
>> project = os.path.dirname(apache_configuration)
>> workspace = os.path.dirname(project)
>> sys.path.append(workspace)
>> sys.path.append(project)
>>
>> # Add the path to 3rd party django application and to django itself.
>> sys.path.append('/home/smlake/kb_venv')
>> os.environ['DJANGO_SETTINGS_MODULE'] = 'project_name.apache.override'
>> from django.core.wsgi import get_wsgi_application
>> application = get_wsgi_application()
>>
>> *Apache2.4 000-default file:*
>> 
>>
>> WSGIScriptAlias / /home/smlake/kb_venv/project_name/apache/wsgi.py
>> 
>>   Require all granted
>> 
>> ServerAdmin parall...@gmail.com 
>> DocumentRoot /home/smlake/kb_venv/project_name/project_name
>>
>> ErrorLog ${APACHE_LOG_DIR}/error.log
>> CustomLog ${APACHE_LOG_DIR}/access.log combined
>>
>> 
>>
>>
>> *Apache error log entry:*
>> [Mon Mar 14 23:58:48.413099 2016] [authz_core:error] [pid 8034:tid 
>> 140480713053952] [client 54.188.195.80:57782] AH01630: client denied by 
>> server configuration: /home/user/kb_venv/project_name/
>>
>>
>>
>>
>>

-- 
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/62362ac3-2fad-416a-ba71-d895141fc4cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: wsgi setup + django 1.9 + python 3.5.1 on mac os x

2016-06-28 Thread Coulson Kgathi
deploying my mac as a server

could you point me to the proper documentation to deploy using nginx+uwsgi
so i can try it


On Tue, Jun 28, 2016 at 4:49 PM, Avraham Serour  wrote:

> it seems it doesn't have cffi installed
>
> but why do you want to do this? are you using the mac as server of are you
> setting up your development environment?
>
> for development you may just use manage.py runserver, you don't need to
> setup apache
>
> for the server I recommend using nginx+uwsgi, the killer feature for nginx
> over apache is the simpler config file
>
>
> On Tue, Jun 28, 2016 at 5:43 PM, Coulson Kgathi  wrote:
>
>> I am getting an error trying to setup my django project on apache2 mac os
>> x, django 1.9, python 3
>>
>> my wsgi.py looks like this
>>
>> import os
>>
>> import sys
>>
>>
>> VIRTUALENV_PATH = '/Users/ckgathi/.virtualenvs/bcpp-interview/'
>>
>> SOURCE_ROOT_PATH = '/Users/ckgathi/source'
>>
>> LOCAL_PROJECT_RELPATH = 'bcpp-interview/'
>>
>>
>> # Activate the virtual env
>>
>> activate_env=os.path.join(VIRTUALENV_PATH,'bin/activate_this.py')
>>
>> # execfile(activate_env, dict(__file__=activate_env))
>>
>> file_p = '/Users/ckgathi/.virtualenvs/bcpp
>> -interview/bin/activate_this.py'
>>
>> exec(open(activate_env).read(), dict(__file__=activate_env))
>>
>> # Add the site-packages of the chosen virtualenv to work with
>>
>> # update path
>>
>> sys.path.insert(0, os.path.join(VIRTUALENV_PATH, 'local/lib
>> /python3.5/site-packages'))
>>
>> sys.path.insert(0, os.path.join(SOURCE_ROOT_PATH, LOCAL_PROJECT_RELPATH))
>>
>>
>> os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'bcpp_interview.settings'
>> )
>>
>>
>> from django.core.wsgi import get_wsgi_application
>>
>> application = get_wsgi_application()
>>
>>
>> and its giving me error
>>
>>
>>
>>
>>
>>
>> [Tue Jun 28 16:41:40.781127 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] mod = import_module(mod_path)
>>
>> [Tue Jun 28 16:41:40.781143 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0]   File
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",
>> line 37, in import_module
>>
>> [Tue Jun 28 16:41:40.781205 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] __import__(name)
>>
>> [Tue Jun 28 16:41:40.781218 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0]   File
>> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/edc_audio_recording/apps.py",
>> line 2, in 
>>
>> [Tue Jun 28 16:41:40.781265 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] import sounddevice as sd
>>
>> [Tue Jun 28 16:41:40.781278 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0]   File
>> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/sounddevice.py",
>> line 34, in 
>>
>> [Tue Jun 28 16:41:40.781765 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] _ffi = _FFI()
>>
>> [Tue Jun 28 16:41:40.781779 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0]   File
>> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/cffi/api.py",
>> line 56, in __init__
>>
>> [Tue Jun 28 16:41:40.781996 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] import _cffi_backend as backend
>>
>> [Tue Jun 28 16:41:40.782018 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] ImportError: No module named _cffi_backend
>>
>> [Tue Jun 28 16:41:40.898298 2016] [wsgi:info] [pid 3853] mod_wsgi
>> (pid=3853): Create interpreter 'interview|'.
>>
>> [Tue Jun 28 16:41:40.900250 2016] [wsgi:info] [pid 3853] mod_wsgi
>> (pid=3853): Adding '/Users/ckgathi/bcpp-interview' to path.
>>
>> [Tue Jun 28 16:41:40.900503 2016] [wsgi:info] [pid 3853] mod_wsgi
>> (pid=3853): Adding
>> '/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages' to
>> path.
>>
>> [Tue Jun 28 16:41:40.904407 2016] [wsgi:info] [pid 3853] [remote
>> 127.0.0.1:0] mod_wsgi (pid=3853, process='interview',
>> application='interview|'): Loading WSGI script
>> '/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py'.
>>
>> [Tue Jun 28 16:41:42.319143 2016] [wsgi:error] [pid 3853] [remote
>> 127.0.0.1:0] mod_wsgi (pid=3853): Target WSGI script
>> '/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py' cannot be
>> loaded as Python module.
>>
>> [Tue Jun 28 16:41:42.319227 2016] [wsgi:error] [pid 3853] [remote
>> 127.0.0.1:0] mod_wsgi (pid=3853): Exception occurred processing WSGI
>> script '/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py'.
>>
>> [Tue Jun 28 16:41:42.319258 2016] [wsgi:error] [pid 3853] [remote
>> 127.0.0.1:0] Traceback (most recent call last):
>>
>> [Tue Jun 28 16:41:42.319284 2016] [wsgi:error] [pid 3853] [remote
>> 127.0.0.1:0]   File
>> "/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py", line 21, in
>> 
>>
>> [Tue Jun 28 16:41:42.319363 2016] [wsgi:error] [pid 3853] [remote
>> 127.0.0.1:0] application = get_wsgi_application()
>>
>> [Tue Jun 28 16:41:42.319379 2016] [wsgi:error] [pid 

wsgi setup + django 1.9 + python 3.5.1 on mac os x

2016-06-28 Thread Coulson Kgathi
I am getting an error trying to setup my django project on apache2 mac os 
x, django 1.9, python 3

my wsgi.py looks like this

import os

import sys


VIRTUALENV_PATH = '/Users/ckgathi/.virtualenvs/bcpp-interview/'

SOURCE_ROOT_PATH = '/Users/ckgathi/source'

LOCAL_PROJECT_RELPATH = 'bcpp-interview/'


# Activate the virtual env

activate_env=os.path.join(VIRTUALENV_PATH,'bin/activate_this.py')

# execfile(activate_env, dict(__file__=activate_env))

file_p = '/Users/ckgathi/.virtualenvs/bcpp-interview/bin/activate_this.py'

exec(open(activate_env).read(), dict(__file__=activate_env))

# Add the site-packages of the chosen virtualenv to work with

# update path

sys.path.insert(0, os.path.join(VIRTUALENV_PATH, 'local/lib
/python3.5/site-packages'))

sys.path.insert(0, os.path.join(SOURCE_ROOT_PATH, LOCAL_PROJECT_RELPATH))


os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'bcpp_interview.settings')


from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()


and its giving me error






[Tue Jun 28 16:41:40.781127 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] mod = import_module(mod_path)

[Tue Jun 28 16:41:40.781143 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0]   File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",
 
line 37, in import_module

[Tue Jun 28 16:41:40.781205 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] __import__(name)

[Tue Jun 28 16:41:40.781218 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/edc_audio_recording/apps.py",
 
line 2, in 

[Tue Jun 28 16:41:40.781265 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] import sounddevice as sd

[Tue Jun 28 16:41:40.781278 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/sounddevice.py",
 
line 34, in 

[Tue Jun 28 16:41:40.781765 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] _ffi = _FFI()

[Tue Jun 28 16:41:40.781779 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/cffi/api.py",
 
line 56, in __init__

[Tue Jun 28 16:41:40.781996 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] import _cffi_backend as backend

[Tue Jun 28 16:41:40.782018 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] ImportError: No module named _cffi_backend

[Tue Jun 28 16:41:40.898298 2016] [wsgi:info] [pid 3853] mod_wsgi 
(pid=3853): Create interpreter 'interview|'.

[Tue Jun 28 16:41:40.900250 2016] [wsgi:info] [pid 3853] mod_wsgi 
(pid=3853): Adding '/Users/ckgathi/bcpp-interview' to path.

[Tue Jun 28 16:41:40.900503 2016] [wsgi:info] [pid 3853] mod_wsgi 
(pid=3853): Adding 
'/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages' to 
path.

[Tue Jun 28 16:41:40.904407 2016] [wsgi:info] [pid 3853] [remote 
127.0.0.1:0] mod_wsgi (pid=3853, process='interview', 
application='interview|'): Loading WSGI script 
'/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py'.

[Tue Jun 28 16:41:42.319143 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] mod_wsgi (pid=3853): Target WSGI script 
'/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py' cannot be 
loaded as Python module.

[Tue Jun 28 16:41:42.319227 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] mod_wsgi (pid=3853): Exception occurred processing WSGI script 
'/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py'.

[Tue Jun 28 16:41:42.319258 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] Traceback (most recent call last):

[Tue Jun 28 16:41:42.319284 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py", line 21, in 


[Tue Jun 28 16:41:42.319363 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] application = get_wsgi_application()

[Tue Jun 28 16:41:42.319379 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/django/core/wsgi.py",
 
line 13, in get_wsgi_application

[Tue Jun 28 16:41:42.319432 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] django.setup()

[Tue Jun 28 16:41:42.319446 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/django/__init__.py",
 
line 18, in setup

[Tue Jun 28 16:41:42.319493 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] apps.populate(settings.INSTALLED_APPS)

[Tue Jun 28 16:41:42.319510 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/django/apps/registry.py",
 
line 85, in populate

[Tue Jun 28 16:41:42.319644 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] app_config = AppConfig.create(entry)

[Tue Jun 28 16:41:42.319661 2016] 

Re: wsgi setup + django 1.9 + python 3.5.1 on mac os x

2016-06-28 Thread Avraham Serour
it seems it doesn't have cffi installed

but why do you want to do this? are you using the mac as server of are you
setting up your development environment?

for development you may just use manage.py runserver, you don't need to
setup apache

for the server I recommend using nginx+uwsgi, the killer feature for nginx
over apache is the simpler config file


On Tue, Jun 28, 2016 at 5:43 PM, Coulson Kgathi  wrote:

> I am getting an error trying to setup my django project on apache2 mac os
> x, django 1.9, python 3
>
> my wsgi.py looks like this
>
> import os
>
> import sys
>
>
> VIRTUALENV_PATH = '/Users/ckgathi/.virtualenvs/bcpp-interview/'
>
> SOURCE_ROOT_PATH = '/Users/ckgathi/source'
>
> LOCAL_PROJECT_RELPATH = 'bcpp-interview/'
>
>
> # Activate the virtual env
>
> activate_env=os.path.join(VIRTUALENV_PATH,'bin/activate_this.py')
>
> # execfile(activate_env, dict(__file__=activate_env))
>
> file_p = '/Users/ckgathi/.virtualenvs/bcpp-interview/bin/activate_this.py'
>
> exec(open(activate_env).read(), dict(__file__=activate_env))
>
> # Add the site-packages of the chosen virtualenv to work with
>
> # update path
>
> sys.path.insert(0, os.path.join(VIRTUALENV_PATH, 'local/lib
> /python3.5/site-packages'))
>
> sys.path.insert(0, os.path.join(SOURCE_ROOT_PATH, LOCAL_PROJECT_RELPATH))
>
>
> os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'bcpp_interview.settings')
>
>
> from django.core.wsgi import get_wsgi_application
>
> application = get_wsgi_application()
>
>
> and its giving me error
>
>
>
>
>
>
> [Tue Jun 28 16:41:40.781127 2016] [wsgi:error] [pid 3854] [remote
> 127.0.0.1:0] mod = import_module(mod_path)
>
> [Tue Jun 28 16:41:40.781143 2016] [wsgi:error] [pid 3854] [remote
> 127.0.0.1:0]   File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",
> line 37, in import_module
>
> [Tue Jun 28 16:41:40.781205 2016] [wsgi:error] [pid 3854] [remote
> 127.0.0.1:0] __import__(name)
>
> [Tue Jun 28 16:41:40.781218 2016] [wsgi:error] [pid 3854] [remote
> 127.0.0.1:0]   File
> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/edc_audio_recording/apps.py",
> line 2, in 
>
> [Tue Jun 28 16:41:40.781265 2016] [wsgi:error] [pid 3854] [remote
> 127.0.0.1:0] import sounddevice as sd
>
> [Tue Jun 28 16:41:40.781278 2016] [wsgi:error] [pid 3854] [remote
> 127.0.0.1:0]   File
> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/sounddevice.py",
> line 34, in 
>
> [Tue Jun 28 16:41:40.781765 2016] [wsgi:error] [pid 3854] [remote
> 127.0.0.1:0] _ffi = _FFI()
>
> [Tue Jun 28 16:41:40.781779 2016] [wsgi:error] [pid 3854] [remote
> 127.0.0.1:0]   File
> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/cffi/api.py",
> line 56, in __init__
>
> [Tue Jun 28 16:41:40.781996 2016] [wsgi:error] [pid 3854] [remote
> 127.0.0.1:0] import _cffi_backend as backend
>
> [Tue Jun 28 16:41:40.782018 2016] [wsgi:error] [pid 3854] [remote
> 127.0.0.1:0] ImportError: No module named _cffi_backend
>
> [Tue Jun 28 16:41:40.898298 2016] [wsgi:info] [pid 3853] mod_wsgi
> (pid=3853): Create interpreter 'interview|'.
>
> [Tue Jun 28 16:41:40.900250 2016] [wsgi:info] [pid 3853] mod_wsgi
> (pid=3853): Adding '/Users/ckgathi/bcpp-interview' to path.
>
> [Tue Jun 28 16:41:40.900503 2016] [wsgi:info] [pid 3853] mod_wsgi
> (pid=3853): Adding
> '/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages' to
> path.
>
> [Tue Jun 28 16:41:40.904407 2016] [wsgi:info] [pid 3853] [remote
> 127.0.0.1:0] mod_wsgi (pid=3853, process='interview',
> application='interview|'): Loading WSGI script
> '/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py'.
>
> [Tue Jun 28 16:41:42.319143 2016] [wsgi:error] [pid 3853] [remote
> 127.0.0.1:0] mod_wsgi (pid=3853): Target WSGI script
> '/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py' cannot be
> loaded as Python module.
>
> [Tue Jun 28 16:41:42.319227 2016] [wsgi:error] [pid 3853] [remote
> 127.0.0.1:0] mod_wsgi (pid=3853): Exception occurred processing WSGI
> script '/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py'.
>
> [Tue Jun 28 16:41:42.319258 2016] [wsgi:error] [pid 3853] [remote
> 127.0.0.1:0] Traceback (most recent call last):
>
> [Tue Jun 28 16:41:42.319284 2016] [wsgi:error] [pid 3853] [remote
> 127.0.0.1:0]   File
> "/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py", line 21, in
> 
>
> [Tue Jun 28 16:41:42.319363 2016] [wsgi:error] [pid 3853] [remote
> 127.0.0.1:0] application = get_wsgi_application()
>
> [Tue Jun 28 16:41:42.319379 2016] [wsgi:error] [pid 3853] [remote
> 127.0.0.1:0]   File
> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/django/core/wsgi.py",
> line 13, in get_wsgi_application
>
> [Tue Jun 28 16:41:42.319432 2016] [wsgi:error] [pid 3853] [remote
> 127.0.0.1:0] django.setup()
>
> [Tue Jun 28 16:41:42.319446 2016] [wsgi:error] [pid 3853] [remote
> 127.0.0.1:0]   

Re: Implementing user alias in django.

2016-06-28 Thread ludovic coues
I would separate user and account.
User is one person and is used to connect.
Account have newsfeed and follow other user.

Each user can manage as many account as he want.
Many user can manage the same account.

All that can be transparent to your user if you setup an account
matching the user for new account.


2016-06-28 14:36 GMT+02:00 Asif Saifuddin :
> Hi,
>
> I'm planning to implement user alias in django. A user can create many alias
> and each alias will work like and full user. each alias will have different
> newsfeed/user follow other user/alias and each alias can do every action a
> real user can do.
>
> How should I implement this user model/architecture?
>
> Thanks,
>
> Asif
>
> --
> 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/3d1a910a-882f-4c19-8067-3685dbf835c9%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%2BTaUxwhsU_M%2BJ5fdwCtBVz%3DaZq1odLNpYFNp8SsNyp3%3DGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django form data not saving to database

2016-06-28 Thread kaustubh tripathi
I removed 'default' attribute and replaced OneToOneField with ForeignKey of 
Post Model still it is not saving to database.
Do I need to override the save method as I did in Category Model.
If yes,then any solution?? 

On Tuesday, June 28, 2016 at 5:44:16 PM UTC+5:30, kaustubh tripathi wrote:
>
> Hi everyone!
>
> I am creating a simple webapp using django where a user can login, choose 
> one of the given category and create a post under the chosen category.
>
> I am having trouble in creating a post. When I create a  new post through 
> django form the date isn't saved to database. I log in to the django-admin 
> to check if the post is created but the 'post' table remains empty.
>  
> Here are the necessary code snippets:
>
> "Category model"
> class  Category(models.Model):
> 
> name = models.CharField(max_length=128,unique=True)
> slug = models.SlugField()
> def save(self,*args,**kwargs):
> self.slug = slugify(self.name)
> super(Category,self).save(*args,**kwargs)
>
> def __unicode__(self):
> return self.name
> 
> "Post Model"
> class Post(models.Model):
> category = models.OneToOneField(Category,default='category')
> title = models.CharField(max_length=128,null=True)
> content = models.TextField(blank=True,null=True)
> 
> def __unicode__(self):
> return self.title
>
> "Postform/forms.py"
>
> class PostForm(forms.ModelForm):
> title = forms.CharField(max_length=128)
> content = forms.CharField(widget=forms.Textarea)
> class Meta:
> model = Post
> fields = ('title','content')
>
> "create_post function/views.py"
>
> def create_post(request,category_name_slug):
> 
> created = False
> instance = get_object_or_404(Category,slug=category_name_slug)
> if request.method == 'POST':
> form = PostForm(data=request.POST or None,instance=instance)
> if form.is_valid():
> post = form.save(commit=False)
> post.save()
> created = True
> else:
> print form.errors
> else:
> form = PostForm()
> context={
> 'form':form,
> 'instance':instance,
> 'created':created
> }
> return render(request,"add_post.html",context)
>
>
> Any solution??
>

-- 
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/0cf89106-7a6e-45c3-96ce-790400d4d225%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTTP2 Server Push with Django?

2016-06-28 Thread Bobby Mozumder
The h2o server (https://h2o.examp1e.net) looks like it supports http/2 push, 
but it doesn’t have WSGI capability for Django.

-bobby

> On Jun 28, 2016, at 9:09 AM, Fabio C. Barrionuevo da Luz  
> wrote:
> 
> as far as I know, there is still no any web server that fully implements the 
> "push" capability from HTTP2 specification.
> 
> let me know if any web server now implements "push" capability completely
> 
> On Tue, Jun 28, 2016 at 9:46 AM, Bobby Mozumder  > wrote:
> Does anyone know of an http/2 server with server push capability that can 
> work with Django?
> 
> It looks like nginx supports http2 with uWSGI, but it doesn’t actually 
> support server push capability.
> 
> I also found the h2o server, but it doesn’t look like it supports uWSGI yet..
> 
> Any other options out there for http2 server push, preferably with 
> cache-aware server push?
> 
> (I’d set http “Link” headers in my app to direct server push.)
> 
> -bobby
> 
> --
> 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/5A078BDA-0C9C-48E3-B7DC-56CA49434388%40gmail.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .
> 
> 
> 
> -- 
> Fábio C. Barrionuevo da Luz
> Palmas - Tocantins - Brasil - América do Sul
> 
> http://pythonclub.com.br/ 
> 
> Blog colaborativo sobre Python e tecnologias Relacionadas, mantido totalmente 
> no https://github.com/pythonclub/pythonclub.github.io 
>  .
> 
> Todos são livres para publicar. É só fazer fork, escrever sua postagem e 
> mandar o pull-request. Leia mais sobre como publicar em README.md e 
> contributing.md .
> Regra básica de postagem:
> "Você" acha interessante? É útil para "você"? Pode ser utilizado com Python 
> ou é útil para quem usa Python? Está esperando o que? Publica logo, que estou 
> louco para ler...
> 
> 
> -- 
> 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/CAPVjvMYqcOq3cUR5UroSkJu%2BQBvOGG9uwBok9OvOpKz%2B%2BZDDMg%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/985EF5F5-DC05-488F-A867-7E7933D9AA32%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django form data not saving to database

2016-06-28 Thread Luis Zárate
models.OneToOneField(Category,default='category')

This is not set in form and not set in view and is not null so when you do
post.save() error was raised and post is not saved.

I don't sure that you can pass str as default for OnetoOne and I am not
sure that you need a OnetoOne field I think foreignkey us better for you,
because have not sense have one category for every post, I think you want
several post in one category.





El martes, 28 de junio de 2016, kaustubh tripathi 
escribió:
> Hi everyone!
>
> I am creating a simple webapp using django where a user can login, choose
one of the given category and create a post under the chosen category.
>
> I am having trouble in creating a post. When I create a  new post through
django form the date isn't saved to database. I log in to the django-admin
to check if the post is created but the 'post' table remains empty.
>
> Here are the necessary code snippets:
>
> "Category model"
> class  Category(models.Model):
>
> name = models.CharField(max_length=128,unique=True)
> slug = models.SlugField()
> def save(self,*args,**kwargs):
> self.slug = slugify(self.name)
> super(Category,self).save(*args,**kwargs)
>
> def __unicode__(self):
> return self.name
>
> "Post Model"
> class Post(models.Model):
> category = models.OneToOneField(Category,default='category')
> title = models.CharField(max_length=128,null=True)
> content = models.TextField(blank=True,null=True)
>
> def __unicode__(self):
> return self.title
>
> "Postform/forms.py"
>
> class PostForm(forms.ModelForm):
> title = forms.CharField(max_length=128)
> content = forms.CharField(widget=forms.Textarea)
> class Meta:
> model = Post
> fields = ('title','content')
>
> "create_post function/views.py"
>
> def create_post(request,category_name_slug):
>
> created = False
> instance = get_object_or_404(Category,slug=category_name_slug)
> if request.method == 'POST':
> form = PostForm(data=request.POST or None,instance=instance)
> if form.is_valid():
> post = form.save(commit=False)
> post.save()
> created = True
> else:
> print form.errors
> else:
> form = PostForm()
> context={
> 'form':form,
> 'instance':instance,
> 'created':created
> }
> return render(request,"add_post.html",context)
>
>
> Any solution??
>
> --
> 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/cdf3882e-636e-4d2b-b626-6b60aaea9f5c%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%2B5VyNpkULru70Wk3vOa2Sqkwd1HyX9Xy8X-Yt%3Du8gdDPZVTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTTP2 Server Push with Django?

2016-06-28 Thread Fabio C. Barrionuevo da Luz
as far as I know, there is still no any web server that fully implements
the "push" capability from HTTP2 specification.

let me know if any web server now implements "push" capability completely

On Tue, Jun 28, 2016 at 9:46 AM, Bobby Mozumder  wrote:

> Does anyone know of an http/2 server with server push capability that can
> work with Django?
>
> It looks like nginx supports http2 with uWSGI, but it doesn’t actually
> support server push capability.
>
> I also found the h2o server, but it doesn’t look like it supports uWSGI
> yet..
>
> Any other options out there for http2 server push, preferably with
> cache-aware server push?
>
> (I’d set http “Link” headers in my app to direct server push.)
>
> -bobby
>
> --
> 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/5A078BDA-0C9C-48E3-B7DC-56CA49434388%40gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Fábio C. Barrionuevo da Luz
Palmas - Tocantins - Brasil - América do Sul

http://pythonclub.com.br/

Blog colaborativo sobre Python e tecnologias Relacionadas, mantido
totalmente no https://github.com/pythonclub/pythonclub.github.io .

Todos são livres para publicar. É só fazer fork, escrever sua postagem e
mandar o pull-request. Leia mais sobre como publicar em README.md e
contributing.md.
Regra básica de postagem:
"Você" acha interessante? É útil para "você"? Pode ser utilizado com Python
ou é útil para quem usa Python? Está esperando o que? Publica logo, que
estou louco para ler...

-- 
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/CAPVjvMYqcOq3cUR5UroSkJu%2BQBvOGG9uwBok9OvOpKz%2B%2BZDDMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best way to implement list pattern

2016-06-28 Thread Luis Zárate
Maybe with generic view


https://docs.djangoproject.com/en/1.9/topics/class-based-views/

Especially with

https://docs.djangoproject.com/en/1.9/topics/class-based-views/generic-display/

There is a lot information about how to implement what you need.



El martes, 28 de junio de 2016, Jean-Noël Colin 
escribió:
> Hi
> I'm rather new to Django, but familiar with Java based web framework; I'd
like to implement a simple list screen, so in the top part, have a
list of objects, and when selecting one of them, loading the details in a
form at the bottom where you can edit; there should also be a link in the
list to allow to delete an object (after confirmation) as well as the
possibility to create a new one. All that in a single screen.
> Is it feasible? Is it good practice or is it better to have different
screens (one for the list, one for the different actions)?
> Thanks
> Jean-Noël
>
> --
> 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/646ba4ea-e5c9-4022-a511-105c694695d3%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%2B5VyOGQwPzCwyT4KUUUaE50DywOB%3DyDmUzVButdUmodt2gAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


HTTP2 Server Push with Django?

2016-06-28 Thread Bobby Mozumder
Does anyone know of an http/2 server with server push capability that can work 
with Django?

It looks like nginx supports http2 with uWSGI, but it doesn’t actually support 
server push capability.

I also found the h2o server, but it doesn’t look like it supports uWSGI yet..

Any other options out there for http2 server push, preferably with cache-aware 
server push?

(I’d set http “Link” headers in my app to direct server push.)

-bobby

-- 
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/5A078BDA-0C9C-48E3-B7DC-56CA49434388%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Implementing user alias in django.

2016-06-28 Thread Asif Saifuddin
Hi,

I'm planning to implement user alias in django. A user can create many 
alias and each alias will work like and full user. each alias will have 
different newsfeed/user follow other user/alias and each alias can do every 
action a real user can do.

How should I implement this user model/architecture?

Thanks,

Asif

-- 
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/3d1a910a-882f-4c19-8067-3685dbf835c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django form data not saving to database

2016-06-28 Thread kaustubh tripathi
Hi everyone!

I am creating a simple webapp using django where a user can login, choose 
one of the given category and create a post under the chosen category.

I am having trouble in creating a post. When I create a  new post through 
django form the date isn't saved to database. I log in to the django-admin 
to check if the post is created but the 'post' table remains empty.
 
Here are the necessary code snippets:

"Category model"
class  Category(models.Model):

name = models.CharField(max_length=128,unique=True)
slug = models.SlugField()
def save(self,*args,**kwargs):
self.slug = slugify(self.name)
super(Category,self).save(*args,**kwargs)

def __unicode__(self):
return self.name

"Post Model"
class Post(models.Model):
category = models.OneToOneField(Category,default='category')
title = models.CharField(max_length=128,null=True)
content = models.TextField(blank=True,null=True)

def __unicode__(self):
return self.title

"Postform/forms.py"

class PostForm(forms.ModelForm):
title = forms.CharField(max_length=128)
content = forms.CharField(widget=forms.Textarea)
class Meta:
model = Post
fields = ('title','content')

"create_post function/views.py"

def create_post(request,category_name_slug):

created = False
instance = get_object_or_404(Category,slug=category_name_slug)
if request.method == 'POST':
form = PostForm(data=request.POST or None,instance=instance)
if form.is_valid():
post = form.save(commit=False)
post.save()
created = True
else:
print form.errors
else:
form = PostForm()
context={
'form':form,
'instance':instance,
'created':created
}
return render(request,"add_post.html",context)


Any solution??

-- 
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/cdf3882e-636e-4d2b-b626-6b60aaea9f5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Best way to implement list pattern

2016-06-28 Thread Jean-Noël Colin
Hi
I'm rather new to Django, but familiar with Java based web framework; I'd 
like to implement a simple list screen, so in the top part, have a 
list of objects, and when selecting one of them, loading the details in a 
form at the bottom where you can edit; there should also be a link in the 
list to allow to delete an object (after confirmation) as well as the 
possibility to create a new one. All that in a single screen. 
Is it feasible? Is it good practice or is it better to have different 
screens (one for the list, one for the different actions)?
Thanks
Jean-Noël

-- 
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/646ba4ea-e5c9-4022-a511-105c694695d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How by help Python generate random image with vector figures.

2016-06-28 Thread Seti Volkylany
I need a pure python module from PyPI without additional packages on my OS.

-- 
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/76e3f15a-7ad8-4839-b981-c5d36ce8ab14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.