Column width changeable in django admin screen

2015-09-16 Thread Pawanesh Gautam
How to make column width changeable in django admin screen. so that client 
can change width using drag n drop in django admin screen .

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6eac002f-1299-437a-8747-0ff93e329951%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: No module named _mysql

2015-09-16 Thread Sandeep kaur
On Thu, Sep 17, 2015 at 3:19 AM, Cliff Peng  wrote:
>
>
http://stackoverflow.com/questions/26560973/python3-mysql-error-loading-mysqldb-module-no-module-named-mysqldb
>
> Can this help you?

I have already implemented this solution, but still the error.log goes like
this :

[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95] from
django.contrib.auth.models import Permission
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File
"/usr/local/lib/python3.4/site-packages/django/contrib/auth/models.py",
line 41, in 
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95] class
Permission(models.Model):
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File
"/usr/local/lib/python3.4/site-packages/django/db/models/base.py", line
139, in __new__
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]
new_class.add_to_class('_meta', Options(meta, **kwargs))
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File
"/usr/local/lib/python3.4/site-packages/django/db/models/base.py", line
324, in add_to_class
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]
value.contribute_to_class(cls, name)
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File
"/usr/local/lib/python3.4/site-packages/django/db/models/options.py", line
250, in contribute_to_class
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95] self.db_table
= truncate_name(self.db_table, connection.ops.max_name_length())
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File
"/usr/local/lib/python3.4/site-packages/django/db/__init__.py", line 36, in
__getattr__
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95] return
getattr(connections[DEFAULT_DB_ALIAS], item)
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File
"/usr/local/lib/python3.4/site-packages/django/db/utils.py", line 240, in
__getitem__
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95] backend =
load_backend(db['ENGINE'])
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File
"/usr/local/lib/python3.4/site-packages/django/db/utils.py", line 111, in
load_backend
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95] return
import_module('%s.base' % backend_name)
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File
"/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]
__import__(name)
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File
"/usr/local/lib/python3.4/site-packages/django/db/backends/mysql/base.py",
line 27, in 
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95] raise
ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]
ImproperlyConfigured: Error loading MySQLdb module: No module named _mysql


-- 
Sandeep Kaur
Blog: sandymadaan.wordpress.com
SCM: https://github.com/sandeepmadaan

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF66xG2PCknXqG8509TgMcCTk7d_WE3cffV2JcLYrCiKxz6YzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: No module named _mysql

2015-09-16 Thread Cliff Peng
http://stackoverflow.com/questions/26560973/python3-mysql-error-loading-mysqldb-module-no-module-named-mysqldb

Can this help you?

2015-09-16 20:04 GMT+08:00 Sandeep kaur :

> Greetings,
> I am using Python3.4 for the Django app on CentOs. The application is
> working perfectly fine with runserver, but when it is configured with
> apache and wsgi.py, I get this Internal Server error and error long says :
>
> [Wed Sep 16 11:38:30 2015] [error] [client 101.56.225.177]   File
> "/usr/local/lib/python3.4/site-packages/django/db/backends/mysql/base.py",
> line 27, in 
> [Wed Sep 16 11:38:30 2015] [error] [client 101.56.225.177] raise
> ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> [Wed Sep 16 11:38:30 2015] [error] [client 101.56.225.177]
> ImproperlyConfigured: Error loading MySQLdb module: No module named _mysql
>
>
> MySQLdb module is working perfectly fine. I tried to install MySQL-python
> and then found MySQLdb doesn't have Python 3 support. Then tried to used
> Python -mysql connector but that too gives error.
>
> I don't know why the MySQL is not working with apache.
> Your help will be highly appreciated.
>
> --
> Sandeep Kaur
> Blog: sandymadaan.wordpress.com
> SCM: https://github.com/sandeepmadaan
>
>
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAF66xG3jHPXhABeuq8Uw3UMV9vdPTg9PET5LdYSZZHY5sg8x1A%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH_Bdvo7_%2Bpd0muwJXZp0aqUouZPp%3D8RGucezVrvwiqNxnCiYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Prefetch() with through models

2015-09-16 Thread Mike Dewhirst

On 16/09/2015 9:53 AM, Erik Cederstrand wrote:

Hi folks,

I'm working on a school timetable app. I want to fetch hundreds of
thousands of Lesson instances with prefetched m2m relations (e.g.
subjects). My m2m relations use through models (I'm not sure this
actually makes a difference here), and I'm running into performance
issues because the prefetch query does something along the lines of
"SELECT ... FROM lesson_subjects WHERE lesson_id IN
[insane_list_of_lesson_ids]".


I'm no expert so I'm wondering if len([insane_list_of_lesson_ids]) == 
"hundreds of thousands"?


And if there are that many involved, why wouldn't the infrastructure 
groan and creak a little?


I'm not much help but I do remember many years ago a school timetable 
programming guru who told me they are definitely not trivial. I think he 
was referring to timetable creation given enrolments, student 
preferences, curriculum/course requirements, availability of teachers 
and location of campuses. One of the main issues (ISTR) was memory - or 
lack of it.


Someone other than me is going to have to help on this but I am 
interested in the solution.


Good luck

Mike


The initial query on Lesson uses a properly indexed filter on e.g.
dates, so I thought I'd try to use the same filter to get the related
Subjects via the relation to Lessons:

qs = Subject.objects.filter(lessons__school_id=8,
lessons__start__lt=datetime(2015, 8, 1))
Lesson.objects.filter(school_id=8, start__lt=datetime(2015, 8, 1))\
.prefetch_related(Prefetch('subjects', queryset=qs))

I can see that the extra filters are added to the prefetch query, but
the huge IN clause is still there.

Am I using Prefetch() wrong? Are there any other techniques to avoid
the huge IN clause in prefetch queries?

Thanks, Erik



--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55F9808E.5060204%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Advanced Annotate

2015-09-16 Thread Paolo C.
Hi Carsten,

my problem is slightly different, in your example you wanted to annotate 
for example the max_book price, I need to annotate not only the price but 
also which is the book that has that max value.


Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2d99ea2e-7927-437a-91f2-cc354986f5c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to create a Django formset with three or more related items?

2015-09-16 Thread John Schmitt
I posted this question on SO, perhaps someone can answer it. http://
stackoverflow.com/questions/32615421/

This Django doc

explains
inline formsets, and uses this nice example:

from django.db import models
class Author(models.Model):
name = models.CharField(max_length=100)
class Book(models.Model):
author = models.ForeignKey(Author)
title = models.CharField(max_length=100)
>>> from django.forms.models import inlineformset_factory>>> BookFormSet = 
>>> inlineformset_factory(Author, Book, fields=('title',))>>> author = 
>>> Author.objects.get(name='Mike Royko')>>> formset = 
>>> BookFormSet(instance=author)

Now, if I add a third model:

class Event(models.Model):
author = models.ForeignKey(Author)
location = model.CharField(max_length=100)

How do I create a formset that allows me to edit all three models? Suppose
there were even more models with a ForeignKey to Author, how do I create a
formset for that? For example,

class Store(models.Model):
author = models.ForeignKey(Author)
store = model.CharField(max_length=100)

There are now three related objects to Author. How do I create a formset
for all four objects?

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALHvOW5BWkFGCvdMwZm36%2BK4A06iG7S27%3DyqreDR6Zc%3DBP-dNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrating RabbitMQ with Django

2015-09-16 Thread Felipe Arenhardt Tomaz
I create and use this class to manipulate the queues

https://gist.github.com/Arenhardt/8ac7e7667134c28eceed

--
Felipe Arenhardt Tomaz
Systems Developer
Curitiba - Paraná
www.felipetomaz.com

On Wed, Sep 16, 2015 at 2:01 PM, Erol Merdanović 
wrote:

> @Tom
>
> Yes, it was also thinking about using supervisord. But I'm interested if
> there is anything else that nicely integrates into Django.
>
> @Felipe
>
> Yes, I'm using pika. Afaik there are no decent tutorials how to implement
> consumers into Django.
>
> On Wednesday, 16 September 2015 16:05:26 UTC+2, Felipe Tomaz wrote:
>>
>> For manual manipulation recommend Pika[1]
>>
>> [1] https://pypi.python.org/pypi/pika
>>
>> --
>> Felipe Arenhardt Tomaz
>> Systems Developer
>> Curitiba - Paraná
>> www.felipetomaz.com
>>
>> On Wed, Sep 16, 2015 at 10:53 AM, Erol Merdanović 
>> wrote:
>>
>>> @Vijay
>>>
>>> Yes, source of the messages is outside of the Django application. I
>>> could use some transformers, but again, it's extra moving part.
>>>
>>> @Sadaf
>>>
>>> Ok, thank you for the blog. I will check it out. But again, Celery is
>>> great but I'm not really sure it solves my problem.
>>>
>>> On Wednesday, 16 September 2015 15:34:54 UTC+2, Sadaf Noor wrote:

 Instead you can try using celery. For demonstration purpose I have
 tried an image processing app using rabbitmq, celery with flask. It worked
 great. It can be found at my blog (
 http://www.sadafnoor.com/blog/rabbitmq-celery-demonstration-using-image-processing-app-on-flask/
 ).
 On 16-Sep-2015 6:53 PM, "Erol Merdanović"  wrote:

> Hi all
>
> I'm using Django to develop a service. Service connects to RabbitMQ
> and receives events that are translated to creating/updating/deleting of
> the database records.
>
> What is the best way to run RabbitMQ consumer with Django? I'm using
> Pika library and I run consumer as a management command (python manage.py
> listen_to_changes). Is this a good solution? I don't see it so. I'm 
> running
> Django as WSGI so I presume there are no start/stop Django events that I
> could plugin in to start/stop consumer.
>
> I'm aware of the Celery and how it nicely integrates into Django, but
> for me it's not an option.
>
> What do you suggest? How to run RabbitMQ with Django (stability is the
> main objective).
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e2b0cfd3-f33f-485c-9497-98fd281c9cd2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
 --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/a1b78c97-eddb-4330-96e9-b442fe6609bd%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ec65ffec-0b14-4a17-a15f-6899a3575cca%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 

Re: Prefetch() with through models

2015-09-16 Thread Simon Charette
Hi Erik,

I think the prefetch api uses IN [id1, ..., idn] instead of IN (SELECT * 
...)
because the default isolation level Django runs with is READ COMITTED
and using the latter could return different results for the second query.

e.g.

SELECT id FROM foo WHERE bar = true;
-- An other transaction changes a matching row from bar = true to false.
SELECT id, foo_id FROM baz WHERE foo_id IN (
SELECT id FROM foo WHERE bar = true
);

If you want to use this approach I'm afraid you'll have to do
what prefetch_related does under the hood by yourself.

e.g.

from collections import defaultdict

prefetched = defaultdict(list)
subjects = Subject.objects.filter(...)
lessons = Lesson.objects.filter(...)
for lesson_subject in 
Lesson.subjects.through.objects.filter(lesson__in=lessons, 
subject__in=subject).select_related('subject').iterator():
prefetched[lesson_subject.lesson_id].append(lesson_subject.subject)

Simon

Le mercredi 16 septembre 2015 04:54:13 UTC-4, Erik Cederstrand a écrit :
>
> Hi folks, 
>
> I'm working on a school timetable app. I want to fetch hundreds of 
> thousands of Lesson instances with prefetched m2m relations (e.g. 
> subjects). My m2m relations use through models (I'm not sure this actually 
> makes a difference here), and I'm running into performance issues because 
> the prefetch query does something along the lines of "SELECT ... FROM 
> lesson_subjects WHERE lesson_id IN [insane_list_of_lesson_ids]". 
>
> The initial query on Lesson uses a properly indexed filter on e.g. dates, 
> so I thought I'd try to use the same filter to get the related Subjects via 
> the relation to Lessons: 
>
> qs = Subject.objects.filter(lessons__school_id=8, 
> lessons__start__lt=datetime(2015, 8, 1)) 
> Lesson.objects.filter(school_id=8, start__lt=datetime(2015, 8, 1))\ 
>   .prefetch_related(Prefetch('subjects', queryset=qs)) 
>
> I can see that the extra filters are added to the prefetch query, but the 
> huge IN clause is still there. 
>
> Am I using Prefetch() wrong? Are there any other techniques to avoid the 
> huge IN clause in prefetch queries? 
>
> Thanks, 
> Erik

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f3a3f269-993e-46dd-93ea-0ff015c52c1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrating RabbitMQ with Django

2015-09-16 Thread Erol Merdanović
@Tom

Yes, it was also thinking about using supervisord. But I'm interested if 
there is anything else that nicely integrates into Django.

@Felipe

Yes, I'm using pika. Afaik there are no decent tutorials how to implement 
consumers into Django.

On Wednesday, 16 September 2015 16:05:26 UTC+2, Felipe Tomaz wrote:
>
> For manual manipulation recommend Pika[1]
>
> [1] https://pypi.python.org/pypi/pika
>
> --
> Felipe Arenhardt Tomaz
> Systems Developer
> Curitiba - Paraná
> www.felipetomaz.com
>
> On Wed, Sep 16, 2015 at 10:53 AM, Erol Merdanović  > wrote:
>
>> @Vijay
>>
>> Yes, source of the messages is outside of the Django application. I could 
>> use some transformers, but again, it's extra moving part.
>>
>> @Sadaf
>>
>> Ok, thank you for the blog. I will check it out. But again, Celery is 
>> great but I'm not really sure it solves my problem.
>>
>> On Wednesday, 16 September 2015 15:34:54 UTC+2, Sadaf Noor wrote:
>>>
>>> Instead you can try using celery. For demonstration purpose I have tried 
>>> an image processing app using rabbitmq, celery with flask. It worked great. 
>>> It can be found at my blog ( 
>>> http://www.sadafnoor.com/blog/rabbitmq-celery-demonstration-using-image-processing-app-on-flask/
>>>  
>>> ).
>>> On 16-Sep-2015 6:53 PM, "Erol Merdanović"  wrote:
>>>
 Hi all

 I'm using Django to develop a service. Service connects to RabbitMQ and 
 receives events that are translated to creating/updating/deleting of the 
 database records. 

 What is the best way to run RabbitMQ consumer with Django? I'm using 
 Pika library and I run consumer as a management command (python manage.py 
 listen_to_changes). Is this a good solution? I don't see it so. I'm 
 running 
 Django as WSGI so I presume there are no start/stop Django events that I 
 could plugin in to start/stop consumer.

 I'm aware of the Celery and how it nicely integrates into Django, but 
 for me it's not an option.

 What do you suggest? How to run RabbitMQ with Django (stability is the 
 main objective).

 -- 
 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 http://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/e2b0cfd3-f33f-485c-9497-98fd281c9cd2%40googlegroups.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/a1b78c97-eddb-4330-96e9-b442fe6609bd%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ec65ffec-0b14-4a17-a15f-6899a3575cca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-sendfile with apache2+mod_wsgi: got empty files

2015-09-16 Thread gerard

Le 16/09/2015 15:47, gerard a écrit :

In apache2 conf:

 Options Indexes FollowSymLinks MultiViews
 XSendFile On
 AllowOverride All
 Order allow,deny
 allow from all




ok, replacing the above with:
XSendFile On
XSendFilePath /home/devel/media/python3/media/Images/

does the job. Hope this help,

--
Gérard Henry

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55F97860.3060704%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrating RabbitMQ with Django

2015-09-16 Thread Felipe Arenhardt Tomaz
For manual manipulation recommend Pika[1]

[1] https://pypi.python.org/pypi/pika

--
Felipe Arenhardt Tomaz
Systems Developer
Curitiba - Paraná
www.felipetomaz.com

On Wed, Sep 16, 2015 at 10:53 AM, Erol Merdanović 
wrote:

> @Vijay
>
> Yes, source of the messages is outside of the Django application. I could
> use some transformers, but again, it's extra moving part.
>
> @Sadaf
>
> Ok, thank you for the blog. I will check it out. But again, Celery is
> great but I'm not really sure it solves my problem.
>
> On Wednesday, 16 September 2015 15:34:54 UTC+2, Sadaf Noor wrote:
>>
>> Instead you can try using celery. For demonstration purpose I have tried
>> an image processing app using rabbitmq, celery with flask. It worked great.
>> It can be found at my blog (
>> http://www.sadafnoor.com/blog/rabbitmq-celery-demonstration-using-image-processing-app-on-flask/
>> ).
>> On 16-Sep-2015 6:53 PM, "Erol Merdanović"  wrote:
>>
>>> Hi all
>>>
>>> I'm using Django to develop a service. Service connects to RabbitMQ and
>>> receives events that are translated to creating/updating/deleting of the
>>> database records.
>>>
>>> What is the best way to run RabbitMQ consumer with Django? I'm using
>>> Pika library and I run consumer as a management command (python manage.py
>>> listen_to_changes). Is this a good solution? I don't see it so. I'm running
>>> Django as WSGI so I presume there are no start/stop Django events that I
>>> could plugin in to start/stop consumer.
>>>
>>> I'm aware of the Celery and how it nicely integrates into Django, but
>>> for me it's not an option.
>>>
>>> What do you suggest? How to run RabbitMQ with Django (stability is the
>>> main objective).
>>>
>>> --
>>> 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 http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/e2b0cfd3-f33f-485c-9497-98fd281c9cd2%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a1b78c97-eddb-4330-96e9-b442fe6609bd%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOgBq%3D-9Ly8KouJ78MHyCH%2BYAWFEnj2mM5Q48KSk6cK1L%3D%2BNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrating RabbitMQ with Django

2015-09-16 Thread 'Tom Evans' via Django users
On Wed, Sep 16, 2015 at 2:34 PM, Erol Merdanović  wrote:
> Hello Vijay
>
> The differences are
> 1. Celery message and our message has different format
> 2. Celery uses custom queues
>
> Is this correct?
>

Yep. Celery is a distributed task system which can use AMQP as
transport, but by default it just uses simple direct exchanges. If you
are using AMQP for something more specialized, like a fanout or topic
exchange, you can configure this for celery. It is still all about
running tasks though.

This page in the celery docs describes how celery uses AMQP, and
briefly discusses the format:

http://celery.readthedocs.org/en/latest/userguide/routing.html

Implementing your worker processes as a management command is
sensible, I would use something like supervisord or circusd to manage
the processes. You should integrate restarting the workers in to the
deployment scripts that update your web server code.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1KNGkmSSWSH25N_vsFmq2VOKc3A%2BVAA2VGXKdu--r7%3DDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advanced Annotate

2015-09-16 Thread Carsten Fuchs

Hi Paolo,

Am 15.09.2015 um 00:32 schrieb Paolo C.:

How can obtain details from the last comment when listing ll posts?


If I understood your question correctly -- I recently had the same question, see 
https://groups.google.com/d/msg/django-users/adRe2_BWMz0/G71BVUEI_7oJ for details.


It seems that the so far best answer is described at 
http://blog.roseman.org.uk/2010/08/14/getting-related-item-aggregate/


Best regards,
Carsten

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55F9753D.4030105%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


Re: Django deployment

2015-09-16 Thread 'Tom Evans' via Django users
On Wed, Sep 16, 2015 at 2:20 PM, bobhaugen  wrote:
> You gotta give PHP credit here. They did deployment better than anybody.
>

I'd disagree massively. Deploying code is not the same as ftping a
bunch of files in to a directory and hoping for the best. Where is the
repeatability, rollback etc?

> Django as a community could stand to put more concentrated work into
> deployment.

Django is a community, but django is also just one part of your stack.
Rightfully, things like being a webserver, rotating logs, managing
rollout/rollback and a whole heap of other things are orthogonal to
Django - is deploying a Django project really that different than
deploying another python application?

Fortunately, Django is part of a larger community - the python
community. The python community has done a lot of work in deployment
(think virtualenv, fabric, the logging API, supervisor processes...)

Even when there isn't a solution in the python community, we're also
all part of the larger open source community. We don't need to bring
CI into django, because we can easily leverage things like Jenkins,
which despite being a Java project, integrates really quite well.

Django isn't a panacea - to really downplay it, it just provides tools
to manage the ORM, processing requests and managing content - but by
combining it with the appropriate other tools and knowledge, you get
awesome deployments.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1Ly%2BJM4cat7R7iymsVZQUZXacjCuhO0aJcww5H1YrBpzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrating RabbitMQ with Django

2015-09-16 Thread Erol Merdanović
@Vijay

Yes, source of the messages is outside of the Django application. I could 
use some transformers, but again, it's extra moving part.

@Sadaf

Ok, thank you for the blog. I will check it out. But again, Celery is great 
but I'm not really sure it solves my problem.

On Wednesday, 16 September 2015 15:34:54 UTC+2, Sadaf Noor wrote:
>
> Instead you can try using celery. For demonstration purpose I have tried 
> an image processing app using rabbitmq, celery with flask. It worked great. 
> It can be found at my blog ( 
> http://www.sadafnoor.com/blog/rabbitmq-celery-demonstration-using-image-processing-app-on-flask/
>  
> ).
> On 16-Sep-2015 6:53 PM, "Erol Merdanović"  
> wrote:
>
>> Hi all
>>
>> I'm using Django to develop a service. Service connects to RabbitMQ and 
>> receives events that are translated to creating/updating/deleting of the 
>> database records. 
>>
>> What is the best way to run RabbitMQ consumer with Django? I'm using Pika 
>> library and I run consumer as a management command (python manage.py 
>> listen_to_changes). Is this a good solution? I don't see it so. I'm running 
>> Django as WSGI so I presume there are no start/stop Django events that I 
>> could plugin in to start/stop consumer.
>>
>> I'm aware of the Celery and how it nicely integrates into Django, but for 
>> me it's not an option.
>>
>> What do you suggest? How to run RabbitMQ with Django (stability is the 
>> main objective).
>>
>> -- 
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/e2b0cfd3-f33f-485c-9497-98fd281c9cd2%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a1b78c97-eddb-4330-96e9-b442fe6609bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django-sendfile with apache2+mod_wsgi: got empty files

2015-09-16 Thread gerard

Hello all,

im using django-sendfile with django 1.8.4. Tested with development 
backend and runserver, everything is fine.
But when going to Apache2 and xsendfile backend, the downloaded files 
are empties, i don't understand why.

I have:
MEDIA_ROOT = '/home/devel/media/python3/media'
and Images are in MEDIA_ROOT

In apache2 conf:

Options Indexes FollowSymLinks MultiViews
XSendFile On
AllowOverride All
Order allow,deny
allow from all


and in views.py, i have:
response = HttpResponse(content_type='application/force-download')
response['Content-Disposition'] = 'attachment;filename="%s"'\
% smart_str(img.name)
response["X-Sendfile"] = img.image.path
response['Content-length'] = img.image.size
return response

Anybody can help?

Thanks in advance,
--
Gérard Henry

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55F972E8.3090800%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrating RabbitMQ with Django

2015-09-16 Thread Vijay Khemlani
Is the origin of the messages something different than your Django
application? Seems overkill to have a custom message format.

On Wed, Sep 16, 2015 at 10:34 AM, Erol Merdanović 
wrote:

> Hello Vijay
>
> The differences are
> 1. Celery message and our message has different format
> 2. Celery uses custom queues
>
> Is this correct?
>
> On Wednesday, 16 September 2015 15:28:33 UTC+2, Vijay Khemlani wrote:
>>
>> Celery would be the usual choice for this, why is it not an option? Seems
>> far easier and more stable than trying to use a webserver as a queue worker.
>>
>> On Wed, Sep 16, 2015 at 10:22 AM, Erol Merdanović 
>> wrote:
>>
>>> Hi all
>>>
>>> I'm using Django to develop a service. Service connects to RabbitMQ and
>>> receives events that are translated to creating/updating/deleting of the
>>> database records.
>>>
>>> What is the best way to run RabbitMQ consumer with Django? I'm using
>>> Pika library and I run consumer as a management command (python manage.py
>>> listen_to_changes). Is this a good solution? I don't see it so. I'm running
>>> Django as WSGI so I presume there are no start/stop Django events that I
>>> could plugin in to start/stop consumer.
>>>
>>> I'm aware of the Celery and how it nicely integrates into Django, but
>>> for me it's not an option.
>>>
>>> What do you suggest? How to run RabbitMQ with Django (stability is the
>>> main objective).
>>>
>>> --
>>> 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 http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/e2b0cfd3-f33f-485c-9497-98fd281c9cd2%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/249b4f0e-b817-4a1f-8ad0-4dabc64d554d%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei22EQzgX2w1TeAr37pfKNTiNTqee8vx1-aYTnFe58AXng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrating RabbitMQ with Django

2015-09-16 Thread Erol Merdanović
Hello Vijay

The differences are
1. Celery message and our message has different format
2. Celery uses custom queues

Is this correct?

On Wednesday, 16 September 2015 15:28:33 UTC+2, Vijay Khemlani wrote:
>
> Celery would be the usual choice for this, why is it not an option? Seems 
> far easier and more stable than trying to use a webserver as a queue worker.
>
> On Wed, Sep 16, 2015 at 10:22 AM, Erol Merdanović  > wrote:
>
>> Hi all
>>
>> I'm using Django to develop a service. Service connects to RabbitMQ and 
>> receives events that are translated to creating/updating/deleting of the 
>> database records. 
>>
>> What is the best way to run RabbitMQ consumer with Django? I'm using Pika 
>> library and I run consumer as a management command (python manage.py 
>> listen_to_changes). Is this a good solution? I don't see it so. I'm running 
>> Django as WSGI so I presume there are no start/stop Django events that I 
>> could plugin in to start/stop consumer.
>>
>> I'm aware of the Celery and how it nicely integrates into Django, but for 
>> me it's not an option.
>>
>> What do you suggest? How to run RabbitMQ with Django (stability is the 
>> main objective).
>>
>> -- 
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/e2b0cfd3-f33f-485c-9497-98fd281c9cd2%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/249b4f0e-b817-4a1f-8ad0-4dabc64d554d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrating RabbitMQ with Django

2015-09-16 Thread Sadaf Noor
Instead you can try using celery. For demonstration purpose I have tried an
image processing app using rabbitmq, celery with flask. It worked great. It
can be found at my blog (
http://www.sadafnoor.com/blog/rabbitmq-celery-demonstration-using-image-processing-app-on-flask/
).
On 16-Sep-2015 6:53 PM, "Erol Merdanović"  wrote:

> Hi all
>
> I'm using Django to develop a service. Service connects to RabbitMQ and
> receives events that are translated to creating/updating/deleting of the
> database records.
>
> What is the best way to run RabbitMQ consumer with Django? I'm using Pika
> library and I run consumer as a management command (python manage.py
> listen_to_changes). Is this a good solution? I don't see it so. I'm running
> Django as WSGI so I presume there are no start/stop Django events that I
> could plugin in to start/stop consumer.
>
> I'm aware of the Celery and how it nicely integrates into Django, but for
> me it's not an option.
>
> What do you suggest? How to run RabbitMQ with Django (stability is the
> main objective).
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e2b0cfd3-f33f-485c-9497-98fd281c9cd2%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAJ2eVqY3PEkPauv%2BCsMZE1xofmkj%2BYcMJkWkfmvkdNbp_janQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrating RabbitMQ with Django

2015-09-16 Thread Vijay Khemlani
Celery would be the usual choice for this, why is it not an option? Seems
far easier and more stable than trying to use a webserver as a queue worker.

On Wed, Sep 16, 2015 at 10:22 AM, Erol Merdanović 
wrote:

> Hi all
>
> I'm using Django to develop a service. Service connects to RabbitMQ and
> receives events that are translated to creating/updating/deleting of the
> database records.
>
> What is the best way to run RabbitMQ consumer with Django? I'm using Pika
> library and I run consumer as a management command (python manage.py
> listen_to_changes). Is this a good solution? I don't see it so. I'm running
> Django as WSGI so I presume there are no start/stop Django events that I
> could plugin in to start/stop consumer.
>
> I'm aware of the Celery and how it nicely integrates into Django, but for
> me it's not an option.
>
> What do you suggest? How to run RabbitMQ with Django (stability is the
> main objective).
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e2b0cfd3-f33f-485c-9497-98fd281c9cd2%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei0hJBLfHJnxAH97hAvStA_vQPPBvVey7G%2B-8TFLbG%3DZDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django deployment

2015-09-16 Thread Daniel Chimeno


El miércoles, 16 de septiembre de 2015, 15:20:32 (UTC+2), bobhaugen 
escribió:
>
> You gotta give PHP credit here. They did deployment better than anybody.
>
+1
 

> Django as a community could stand to put more concentrated work into 
> deployment.
>
That was my unique constraint in the last Django survey.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c4326a8e-3df0-48b4-a26d-bfc3d304b902%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Integrating RabbitMQ with Django

2015-09-16 Thread Erol Merdanović
Hi all

I'm using Django to develop a service. Service connects to RabbitMQ and 
receives events that are translated to creating/updating/deleting of the 
database records. 

What is the best way to run RabbitMQ consumer with Django? I'm using Pika 
library and I run consumer as a management command (python manage.py 
listen_to_changes). Is this a good solution? I don't see it so. I'm running 
Django as WSGI so I presume there are no start/stop Django events that I 
could plugin in to start/stop consumer.

I'm aware of the Celery and how it nicely integrates into Django, but for 
me it's not an option.

What do you suggest? How to run RabbitMQ with Django (stability is the main 
objective).

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e2b0cfd3-f33f-485c-9497-98fd281c9cd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django deployment

2015-09-16 Thread bobhaugen
You gotta give PHP credit here. They did deployment better than anybody.

Django as a community could stand to put more concentrated work into 
deployment.

On Tuesday, September 15, 2015 at 3:27:49 PM UTC-5, Nikolas 
Stevenson-Molnar wrote:
>
> I second the nginx/gunicorn/django/supervisor stack. I've used it many 
> times; it's relatively easy to get everything installed and set up, and all 
> the involved components are ready for prime time.
>
> I think the "difficult to set up" sentiment is probably in comparison to 
> something like PHP. So many servers have already have the LAMP stack, so 
> deployment is just dropping your source in the correct directory and making 
> sure the permissions are right. So it's not that Django is *unnecessarily* 
> difficult, but it's certainly a bit more involved than a PHP app.
>
> On 9/15/2015 1:02:36 PM, Michiel Overtoom  
> wrote:
> Hi Hugo, 
>
> > I keep hearing that Django deployment is unnecessarily difficult. 
>
> Who says this? And what are the reasons they give for it? 
>
>
> > For a website with very little traffic, and for somebody who's new to it 
> all, what is the best way to deploy? And how should I go about deploying! 
>
> I can tell you how I do it, which is not necessarily the simplest way nor 
> especially suited to low traffic. But it's not that hard. On the server 
> machine, I install nginx, gunicorn, django and supervisor. Nginx will be 
> the frontend, gunicorn will be the webserver, django is the application 
> server, and supervisor will be used to start/stop/restart the web 
> application. 
>
> I basically did the same as Shawn. In my supervisord.conf I have these 
> lines: 
>
> [program:myapp] 
> command=/usr/local/bin/gunicorn myapp.wsgi -b 127.0.0.1: 
> directory=/wwwapp/myapp/my 
> environment=PATH="%(ENV_PATH)s:/usr/local/bin" 
> user=root 
> autostart=true 
> autorestart=true 
> stdout_logfile=NONE 
> stderr_logfile=NONE 
>
> I also wrote a blog article about this subject: 
> http://www.michielovertoom.com/freebsd/flask-gunicorn-nginx-supervisord/ 
> which uses Flask as an example, but as Shawn said, it's easy to plug in 
> your Django app instead. 
>
> -- 
> 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 http://groups.google.com/group/django-users. 
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/6DFD6635-480E-43A1-B7CC-2C5FA826185C%40xs4all.nl.
>  
>
> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f1692b82-4894-4c1f-bd88-3a7f32005fd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Form Container for Django Formwizard only shows labels

2015-09-16 Thread Jur Remeijn
So in my Django project, I am using a formwizard for a multi-page form. On 
one of those pages, I want a form as well as a formset (sadly, this is 
absolutely necessary). The formwizard can do these things separately but 
not together, so I found this ticket 
 () on the django development 
side,  which brought me to the use of a form_container like this one 
.

Now for using this container, i have in my forms.py:
"
*AddressesFormSet = formset_factory(EmailAddressForm)*

*class UserFormsContainer(FormContainer):*
*user = UserDetailForm*
*addresses = AddressesFormSet*
"

In my urls.py:
*url(r'^$', views.ContactWizard.as_view([("0", UserFormsContainer),]), 
name='index'),*

Only, when I call this container in the formwizard (which should work), the 
html output is this:
**

* ''user''*
* ''addresses''*
**
* *
**
**

Instead of the actual forms I expected...

I think the problem might be in the following part of the form container, 
because it describes the behaviour of the form as I see it (it shows me the 
labels for the forms in the container).

*def get_form_kwargs(self, prefix, **kwargs):*
*"""Return per-form kwargs for instantiating a specific form*

*By default, just returns the kwargs provided. prefix is the*
*label for the form in the container, allowing you to specify*
*extra (or less) kwargs for each form in the container.*
*"""*
*return kwargs*

However, I want it to actually show the forms, but since I am not very 
familliar with the django source-code I don't know how to edit my 
formcontainer to do this.

Can anyone help me with this issue? Thanks in advance!

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/238025d5-c4a3-4574-9897-8439ec4ebb2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


No module named _mysql

2015-09-16 Thread Sandeep kaur
Greetings,
I am using Python3.4 for the Django app on CentOs. The application is
working perfectly fine with runserver, but when it is configured with
apache and wsgi.py, I get this Internal Server error and error long says :

[Wed Sep 16 11:38:30 2015] [error] [client 101.56.225.177]   File
"/usr/local/lib/python3.4/site-packages/django/db/backends/mysql/base.py",
line 27, in 
[Wed Sep 16 11:38:30 2015] [error] [client 101.56.225.177] raise
ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
[Wed Sep 16 11:38:30 2015] [error] [client 101.56.225.177]
ImproperlyConfigured: Error loading MySQLdb module: No module named _mysql


MySQLdb module is working perfectly fine. I tried to install MySQL-python
and then found MySQLdb doesn't have Python 3 support. Then tried to used
Python -mysql connector but that too gives error.

I don't know why the MySQL is not working with apache.
Your help will be highly appreciated.

-- 
Sandeep Kaur
Blog: sandymadaan.wordpress.com
SCM: https://github.com/sandeepmadaan

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF66xG3jHPXhABeuq8Uw3UMV9vdPTg9PET5LdYSZZHY5sg8x1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Prefetch() with through models

2015-09-16 Thread Erik Cederstrand
Hi folks,

I'm working on a school timetable app. I want to fetch hundreds of thousands of 
Lesson instances with prefetched m2m relations (e.g. subjects). My m2m 
relations use through models (I'm not sure this actually makes a difference 
here), and I'm running into performance issues because the prefetch query does 
something along the lines of "SELECT ... FROM lesson_subjects WHERE lesson_id 
IN [insane_list_of_lesson_ids]".

The initial query on Lesson uses a properly indexed filter on e.g. dates, so I 
thought I'd try to use the same filter to get the related Subjects via the 
relation to Lessons:

qs = Subject.objects.filter(lessons__school_id=8, 
lessons__start__lt=datetime(2015, 8, 1))
Lesson.objects.filter(school_id=8, start__lt=datetime(2015, 8, 1))\
  .prefetch_related(Prefetch('subjects', queryset=qs))

I can see that the extra filters are added to the prefetch query, but the huge 
IN clause is still there.

Am I using Prefetch() wrong? Are there any other techniques to avoid the huge 
IN clause in prefetch queries?

Thanks,
Erik

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3A748402-9FAC-4670-BDD0-140CD4F080A4%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.