Re: django template string and int comparison behavior

2013-09-20 Thread J Y
That makes a lot of sense.  Thanks for the explanation.  I will use the 
view to convert it to an int.

Jack

On Tuesday, September 17, 2013 1:00:01 PM UTC-7, ke1g wrote:
>
> Yes, this is the expected behavior.  The GET parameter is a string, being 
> something that is just parsed out of the query parameter portion of the URL 
> (which is, itself, a string).  There is nothing to inform the code that 
> parses the query parameters which of the things that might look like 
> numbers should be converted to int, float, or left alone.  Since converting 
> to a numeric type and back is not a null operation ('001' -> 1 -> '1', 
> '1.00' -> 1.0 -> '1.0'), leaving it as the string it is already is the 
> correct choice.  Knowing how a parameter is to be interpreted is an 
> application specific task.
>
> Probably the correct approach for you is to have view code capture the 
> system argument and convert it to an int (perhaps there is a form field 
> instance handy which has already done that and put it in the form's 
> cleaned_data?), and pass that into the template context.  Then compare 
> item.id to that, rather than something you dug out of request.GET.
>
> Bill
>
>
> On Tue, Sep 17, 2013 at 2:50 PM, J Y wrote:
>
>> I am building a search form that provides a drop down list, and then on 
>> the search results, I am redisplaying the search form, but with the search 
>> parameters already pre-selected, so this is what I attempted to do:
>>
>> 
>> {% for item in object_list %}
>> > request.GET.system %} selected="selected" {% endif %}>
>> {{ item.name }}
>> 
>> {% endfor %}
>> 
>>
>> Unfortunately, this did not work.  When I did some testing, I realized 
>> that item.id is giving back an int, while request.GET.system is giving 
>> back a string.  If I used the view to change the GET value to an int in the 
>> context, then the comparison works.
>>
>> What I am wondering is, is this expected behavior?  Does the request 
>> object always return a string, and that I am better off writing my own 
>> custom tag to convert request objects into int for comparison?  What is the 
>> best practice to employ here?  I am fairly new to django and could use some 
>> pointers.
>>
>> Thanks,
>>
>> Jack
>>
>> -- 
>> 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


and keyword arguments '{u'student_id': None, u'school_id': 1}' not found.

2013-09-20 Thread Trung Nguyen
Django Version:1.5.2Exception Type:NoReverseMatchException Value:

Reverse for 'gradingstudent' with arguments '()' and keyword arguments 
'{u'student_id': None, u'school_id': 1}' not found.

Exception 
Location:/usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py 
in render, line 424Python Executable:/usr/bin/pythonPython Version:2.7.4
 I am new to Django. I got this error and struggle to find a solution for 
it but no luck. Please help!

View.py   def grading_student(request, school_id=1, student_id=1):
urls.py 
  url(r'^(?P\d+)/gradings/gradingstudent/(?P\d+)/$', 
views.grading_student, name='gradingstudent'),

from template :
if I use :
a href="{% url 'contest:gradingstudent'  school_id=1 student_id=1 %}"> 
 Enter Student Score   Enter Student Score  
{{form.instance.id}}  Enter Student Score http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


FileField Default Setting

2013-09-20 Thread Chris Kavanagh
I just added a FileField to my Model (thumbnail = 
models.FileField(upload_to=get_upload_file_name), however when I try to use 
South to migrate the model, I get a message telling me . . . "The field 
'Article.thumbnail' does not have a default specified, yet is NOT NULL. 
Since you are adding this field, you MUST specify a default
value to use for existing rows. Would you like to: 1. Quit now, and add a 
default to the field in models.py 2. Specify a one-off value to use for 
existing columns now
Please select a choice: " . . .I chose option #2 and used 
"datetime.datetime.now". . .

When I began googling this I found a ticket (#10244) that doesn't seem to 
be resolved. Several questions concerning this on Stack Overflow suggest 
using "blank=True" as a default. Another says use "blank=True" AND 
"null=True". The ticket says "null=True" doesn't do anything. . .Anyways, I 
tried both and nothing seemed to change. When I tried a migration, it told 
me there were no changes (after I added each "blank=True" AND "null=True". 
. .

My question is, has there been any resolution to this? What am I supposed 
to use in this situation? Please see the Model below. .Any help would be 
greatly appreciated. Thanks in advance!

#Models.py below. . .

def get_upload_file_name(inatance, filename):
return "uploaded_files/%s_%s" % (str(time()).replace('.','_'), filename)


# Create your models here.
class Article(models.Model):
title = models.CharField(max_length=200)
body = models.TextField()
pub_date = models.DateTimeField('date published')
likes = models.IntegerField(default=0)
thumbnail = models.FileField(upload_to=get_upload_file_name, 
blank=True, null=True)


def __unicode__(self):
return self.title

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: djangojobs.com

2013-09-20 Thread Russell Keith-Magee
The purchase date of the domain is irrelevant. The Django Software
Foundation owns the trademark for Django. It's been a registered trademark
(in the US) for 6 years; we had a trademark-by-use for several years prior
to that. Outside the US, we have a trademark-by-use for the same period.

Anyone using the Django trademark prior to the publication of the license
agreement has been doing so under ambiguous legal conditions. From a legal
standpoint, the default position of the law for trademarks is the same as
it is for copyright -- if there's no explicitly given license, the default
legal position is "you can't use it".

The legal conditions for using the Django trademark are now unambiguous.
We've published a licensing agreement that outlines specifically allowed
terms for use. If your usage doesn't meet those terms, you aren't using the
trademark legally.

Yours,
Russ Magee %-)



On Fri, Sep 20, 2013 at 8:36 PM, Tomas Ehrlich wrote:

> I wonder if licence agreement applies for this case, since domain was
> clearly bought before Django project finished it's trademark policy.
>
>
> Dne Fri, 20 Sep 2013 08:23:27 -0400
> Karen Tracey  napsal(a):
>
> > Please note any use of djangojobs.com domain would need to conform to
> the
> > Django trademark license agreement:
> >
> > https://www.djangoproject.com/trademarks/
> >
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Couple of random Error 500 issues

2013-09-20 Thread Nikolas Stevenson-Molnar
Two other options, depending on how much control you have over the server:

1) Use nginx instead of Apache (smaller memory footprint, leaving more
for Python)

2) Use swap memory
(http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/) ... not an
option for shared hosting and certain types of VPS, but if you can do it
and you're willing to put up with lower performance, this can be a good
way to get your application to run without paying for more memory. I run
development and low-traffic applications on micro AWS instances all the
time by creating 1GB of swap.

_Nik

On 9/20/2013 3:18 PM, Mike Dewhirst wrote:
> On 21/09/2013 3:34am, Carlos Villavicencio wrote:
>> Hello,
>>
>> I have a django project running on digitalocean (in a 512M server) and
>> suddenly it appears Error 500 on the Apache.
>>
>> I'm running wsgi and only 2 users (because we are starting)
>>
>> Looking on the logs, the errors were the following:
>>
>> 1. ImproperlyConfigured: Error importing middleware
>> django.middleware.transaction: "cannot import name transaction"
>
> If it only occurs occasionally it "feels like" a platform problem
>
>> 2. OSError: [Errno 12] Cannot allocate memory
>
> Sounds like insufficient memory. From my reading (some time ago)
> Django/Python likes substantial quantities of memory - and of course
> it depends on what your software is doing.
>
> Try hiring more memory and see if the errors go away. I've got a
> production server running 1Gb quite successfully but it is lightly
> used. I'm planning to throw more at it later.
>
>>
>> The first error occurs more than the second one.
>>
>> Does the 512M server is fine for a django production project?
>> The middleware transaction is correctly configured in settings.py, why I
>> get "randomly" this error? Maybe a concurrency issue?
>>
>> 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Couple of random Error 500 issues

2013-09-20 Thread Mike Dewhirst

On 21/09/2013 3:34am, Carlos Villavicencio wrote:

Hello,

I have a django project running on digitalocean (in a 512M server) and
suddenly it appears Error 500 on the Apache.

I'm running wsgi and only 2 users (because we are starting)

Looking on the logs, the errors were the following:

1. ImproperlyConfigured: Error importing middleware
django.middleware.transaction: "cannot import name transaction"


If it only occurs occasionally it "feels like" a platform problem


2. OSError: [Errno 12] Cannot allocate memory


Sounds like insufficient memory. From my reading (some time ago) 
Django/Python likes substantial quantities of memory - and of course it 
depends on what your software is doing.


Try hiring more memory and see if the errors go away. I've got a 
production server running 1Gb quite successfully but it is lightly used. 
I'm planning to throw more at it later.




The first error occurs more than the second one.

Does the 512M server is fine for a django production project?
The middleware transaction is correctly configured in settings.py, why I
get "randomly" this error? Maybe a concurrency issue?

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.
For more options, visit https://groups.google.com/groups/opt_out.


--
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django-celery connects to localhost but not by ip

2013-09-20 Thread Chad Vernon
I wasn't running celerycam, but now I am.  I also wasn't using the -E -B 
flags.  The result is still False though but in the Django Admin, the task 
has a state of SUCCESS.  

I don't know if it matters or not, but this is how I am starting my 
workers, celerycam through Fabric:

sudo('ps auxww | grep celerycam | grep -v "grep" | awk \'{print $2}\' | 
xargs kill')
# Kill existing workers
sudo('ps auxww | grep "celery worker" | grep -v "grep" | awk \'{print 
$2}\' | xargs kill')

with cd('/usr/local/Cellar/daemonize/1.7.4/sbin'):
# Create new workers
sudo('daemonize -u pipeadmin %s/manage.py celery worker -E -B' % 
siteDir)

# Create new celerycam
sudo('rm celerycam.pid', warn_only=True)
sudo('python %s/manage.py celerycam --detach --pidfile=celerycam.pid' % 
siteDir)



On Friday, September 20, 2013 8:47:44 AM UTC-7, Celso Providelo wrote:
>
> Hi Chad,
>
> Are you running a celery worker instance ? (`manage.py celery worker -E 
> -B`)
>
> You also have to run `manage.py celerycam` in order to see celery 
> action/history in the django admin interface
>
> I use the following makefile rule in order to activate djcelery in 
> development environments:
> {{{
> run-celery:   
> 
> $(PYTHON) $(MANAGER) celerycam -l debug  --detach \
> --pidfile=celerycam.pid
> $(PYTHON) $(MANAGER) celery worker -l debug -E -B -n 
> 'local-worker' \
> --pidfile=celeryworker.pid
> }}}
>
> It is highly verbose, but might help you to visualize what is going on.
>
> []
>
>
> On Fri, Sep 20, 2013 at 1:23 AM, Chad Vernon  > wrote:
>
>> Thanks, I found the issue after checking the logs.
>>
>> I saw in the log that it listed the AMQP connection that it accepts:
>>
>> =INFO REPORT 19-Sep-2013::20:52:57 ===
>> accepting AMQP connection <0.403.0> (127.0.0.1:59930 -> 127.0.0.1:5672)
>>
>> So if that is stating the obvious, I assumed it was blocking all other 
>> ips.  So I found this page 
>> http://superuser.com/questions/464311/open-port-5672-tcp-for-access-to-rabbitmq-on-mac
>> and removed NODE_IP_ADDRESS from rabbitmq-env.conf and that seems to 
>> work.  But I guess my first assumption was incorrect about what the log 
>> displayed because when I run the command again, the log just says my 
>> machine connected and displays the port range of that ip address.
>>
>> However, one issue that still is strange is that the ASyncResult returned 
>> from the task always seems to return False from the .ready() method even 
>> though it seems to have completed the task.  Any ideas on that?
>>
>>
>> On Thursday, September 19, 2013 7:36:41 PM UTC-7, John DeRosa (work) 
>> wrote:
>>
>>> First things to check:
>>>
>>> Check the firewall on the RabbitMQ server. Can you access that server?
>>>
>>> Did you set up the vhost and account on the RabbitMQ server?
>>>
>>> Look in the RabbitMQ logs. Did the request make it to RabbitMQ?
>>>
>>> John
>>>
>>> On Sep 19, 2013, at 7:34 PM, Chad Vernon  wrote:
>>>
>>> I am using djcelery and rabbitmq.  Everything runs fine when the 
>>> BROKER_HOST is localhost but when I change it to the ip of the machine it 
>>> no longer runs.  
>>>
>>> Basically I am trying to be able to run python commands on a separate 
>>> machine to be picked up by the RabbitMQ server on a different machine.  But 
>>> to test first I am doing it all on the same machine.  But as I said it 
>>> doesn't seem to work when I change from localhost to the machine ip. I just 
>>> get socket.error: [Errno 61] Connection refused.
>>>
>>> Any ideas?
>>>
>>> Thanks,
>>> Chad 
>>>
>>> -- 
>>> 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
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>  -- 
>> 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> Celso Providelo
> IRC: cprov,  Skype: cprovidelo
> 1024D/681B6469 C858 2652 1A6E F6A6 037B  B3F7 9FF2 583E 681B 6469
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving 

Couple of random Error 500 issues

2013-09-20 Thread Carlos Villavicencio
Hello,

I have a django project running on digitalocean (in a 512M server) and 
suddenly it appears Error 500 on the Apache. 

I'm running wsgi and only 2 users (because we are starting)

Looking on the logs, the errors were the following:

1. ImproperlyConfigured: Error importing middleware 
django.middleware.transaction: "cannot import name transaction"
2. OSError: [Errno 12] Cannot allocate memory

The first error occurs more than the second one.

Does the 512M server is fine for a django production project?
The middleware transaction is correctly configured in settings.py, why I 
get "randomly" this error? Maybe a concurrency issue?

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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django-celery connects to localhost but not by ip

2013-09-20 Thread Celso Providelo
Hi Chad,

Are you running a celery worker instance ? (`manage.py celery worker -E -B`)

You also have to run `manage.py celerycam` in order to see celery
action/history in the django admin interface

I use the following makefile rule in order to activate djcelery in
development environments:
{{{
run-celery:

$(PYTHON) $(MANAGER) celerycam -l debug  --detach \
--pidfile=celerycam.pid
$(PYTHON) $(MANAGER) celery worker -l debug -E -B -n 'local-worker'
\
--pidfile=celeryworker.pid
}}}

It is highly verbose, but might help you to visualize what is going on.

[]


On Fri, Sep 20, 2013 at 1:23 AM, Chad Vernon  wrote:

> Thanks, I found the issue after checking the logs.
>
> I saw in the log that it listed the AMQP connection that it accepts:
>
> =INFO REPORT 19-Sep-2013::20:52:57 ===
> accepting AMQP connection <0.403.0> (127.0.0.1:59930 -> 127.0.0.1:5672)
>
> So if that is stating the obvious, I assumed it was blocking all other
> ips.  So I found this page
> http://superuser.com/questions/464311/open-port-5672-tcp-for-access-to-rabbitmq-on-mac
> and removed NODE_IP_ADDRESS from rabbitmq-env.conf and that seems to work.
>  But I guess my first assumption was incorrect about what the log displayed
> because when I run the command again, the log just says my machine
> connected and displays the port range of that ip address.
>
> However, one issue that still is strange is that the ASyncResult returned
> from the task always seems to return False from the .ready() method even
> though it seems to have completed the task.  Any ideas on that?
>
>
> On Thursday, September 19, 2013 7:36:41 PM UTC-7, John DeRosa (work) wrote:
>
>> First things to check:
>>
>> Check the firewall on the RabbitMQ server. Can you access that server?
>>
>> Did you set up the vhost and account on the RabbitMQ server?
>>
>> Look in the RabbitMQ logs. Did the request make it to RabbitMQ?
>>
>> John
>>
>> On Sep 19, 2013, at 7:34 PM, Chad Vernon  wrote:
>>
>> I am using djcelery and rabbitmq.  Everything runs fine when the
>> BROKER_HOST is localhost but when I change it to the ip of the machine it
>> no longer runs.
>>
>> Basically I am trying to be able to run python commands on a separate
>> machine to be picked up by the RabbitMQ server on a different machine.  But
>> to test first I am doing it all on the same machine.  But as I said it
>> doesn't seem to work when I change from localhost to the machine ip. I just
>> get socket.error: [Errno 61] Connection refused.
>>
>> Any ideas?
>>
>> Thanks,
>> Chad
>>
>> --
>> 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
>> .
>> For more options, visit 
>> https://groups.google.com/**groups/opt_out
>> .
>>
>>
>>  --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Celso Providelo
IRC: cprov,  Skype: cprovidelo
1024D/681B6469 C858 2652 1A6E F6A6 037B  B3F7 9FF2 583E 681B 6469

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Using Django RelatedField for custom join queries?

2013-09-20 Thread Diederik van der Boor
Hi all,

I've asked this question on stackoverflow 
(http://stackoverflow.com/questions/18913661/using-django-relatedfield-for-custom-join-queries),
but figured it might be better to post it here:

I'm curious whether a RelatedField can be used to cause custom join queries.
I would like to apply this in django-parler 
(https://github.com/edoburu/django-parler), a multilingual app for Django.

For example, when "slug" is a translated field, I would like to have:

MyModel.objects.filter(slug="foo")

to operate as:

MyModel.objects.fiter(translations__slug="foo")

under the hood. This is possible with the API of the RelatedField class for 
example?

I noticed there are several API hooks in the RelatedField class, such as 
m2m_reverse_field_name(), m2m_target_field_name(), m2m_column_name(), 
extra_filters() etc.. which are used in the GenericRelation and django-taggit's 
TaggableManager classes but I have no idea how these work.

N.B. Regular field access on instances is covered in django-parler (using 
descriptors that proxy to calls to the translated table), and I would love to 
extend support to ORM queries as well.

Best regards,
Diederik

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django-celery connects to localhost but not by ip

2013-09-20 Thread John DeRosa
Nope… Good luck!

On Sep 19, 2013, at 9:23 PM, Chad Vernon  wrote:

> Thanks, I found the issue after checking the logs.
> 
> I saw in the log that it listed the AMQP connection that it accepts:
> 
> =INFO REPORT 19-Sep-2013::20:52:57 ===
> accepting AMQP connection <0.403.0> (127.0.0.1:59930 -> 127.0.0.1:5672)
> 
> So if that is stating the obvious, I assumed it was blocking all other ips.  
> So I found this page 
> http://superuser.com/questions/464311/open-port-5672-tcp-for-access-to-rabbitmq-on-mac
> and removed NODE_IP_ADDRESS from rabbitmq-env.conf and that seems to work.  
> But I guess my first assumption was incorrect about what the log displayed 
> because when I run the command again, the log just says my machine connected 
> and displays the port range of that ip address.
> 
> However, one issue that still is strange is that the ASyncResult returned 
> from the task always seems to return False from the .ready() method even 
> though it seems to have completed the task.  Any ideas on that?
> 
> 
> On Thursday, September 19, 2013 7:36:41 PM UTC-7, John DeRosa (work) wrote:
> First things to check:
> 
> Check the firewall on the RabbitMQ server. Can you access that server?
> 
> Did you set up the vhost and account on the RabbitMQ server?
> 
> Look in the RabbitMQ logs. Did the request make it to RabbitMQ?
> 
> John
> 
> On Sep 19, 2013, at 7:34 PM, Chad Vernon  wrote:
> 
>> I am using djcelery and rabbitmq.  Everything runs fine when the BROKER_HOST 
>> is localhost but when I change it to the ip of the machine it no longer 
>> runs.  
>> 
>> Basically I am trying to be able to run python commands on a separate 
>> machine to be picked up by the RabbitMQ server on a different machine.  But 
>> to test first I am doing it all on the same machine.  But as I said it 
>> doesn't seem to work when I change from localhost to the machine ip. I just 
>> get socket.error: [Errno 61] Connection refused.
>> 
>> Any ideas?
>> 
>> Thanks,
>> Chad 
>> 
>> -- 
>> 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Experience of django on AWS

2013-09-20 Thread Andreas Kuhne
Hi all,

Has anyone any experience of django in the AWS cloud? For example using
Amazon Beanstalk with a django 1.5 application? Or any other pitfalls that
can occur when transitioning to AWS?

Regards,

Andréas

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


How to share model/data cross django project

2013-09-20 Thread Dig
Hi,

  There are about 20 views in a django project (with a django app).
Recently, a new requirement occurred, someone want to split current views
into 2 site but the database is unique. That means 2 subdomain, 2 views
sets, 2 deployment scripts, but only one database.

Can I implement this feature by writing 2 setting.py files?

Environment:
  Django 1.5.4
  Nginx + uwsgi
  MySQL

Thanks,
Dig

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: djangojobs.com

2013-09-20 Thread Tomas Ehrlich
I wonder if licence agreement applies for this case, since domain was
clearly bought before Django project finished it's trademark policy.


Dne Fri, 20 Sep 2013 08:23:27 -0400
Karen Tracey  napsal(a):

> Please note any use of djangojobs.com domain would need to conform to the
> Django trademark license agreement:
> 
> https://www.djangoproject.com/trademarks/
> 


signature.asc
Description: PGP signature


Re: djangojobs.com

2013-09-20 Thread Karen Tracey
Please note any use of djangojobs.com domain would need to conform to the
Django trademark license agreement:

https://www.djangoproject.com/trademarks/

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


djangojobs.com

2013-09-20 Thread djangopro
Hi guys,

I assume I shouldn't be allowed to post this here but this is kind of an 
emergency so I hope you forgive me just this time.

Long store short I have the domain djangojobs.com I have been the only 
owner since 2006 but never had the time to develop a job board for it. Now 
I urgently need $$$ and would like to sell the domain to someone who would 
be willing to use it for a job board.

If any of you would be interested in purchasing the domain please let me 
know.

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.
For more options, visit https://groups.google.com/groups/opt_out.


Pyes and global connection

2013-09-20 Thread Mahdi Mazaheri
Hi
I want to use Pyes with django. The problem is that I dont know how to make 
a global connection in django so get rid of overhead of openning and 
closing the connection.
this is how making connection with pyes:
import pyes
conn = pyes.ES('127.0.0.1:9500')
should I define a global variable(Where?)? or there is better approach for 
this.

Thanks a lot in advance
Mahdi

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Enforcing minimum and maximum values in Django model fields

2013-09-20 Thread Abijith Mg
http://blog.p3infotech.in/2013/enforcing-minimum-and-maximum-values-in-django-model-fields/

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Using environment variables in settings.py - good practice? How to handle missing variables gracefully?

2013-09-20 Thread Vernon D. Cole
There is indeed a better way: Structured Settings.
  Turn the usual pattern of having settings.py import local_settings.py 
upside down.  Call your specific setting (you can specify it be altering 
the DJANGO_SETTINGS_MODULE environment variable in your virtualenv 
activation script) and it will import the main settings (which you rename 
to base.py).  This is documented in 
http://www.slideshare.net/jacobian/the-best-and-worst-of-django which is 
the slides of a presentation by one of the "fathers" of django.

1) create a settings folder in your project.
2) copy settings.py into it, rename it to base.py, and remove the import of 
local_settings.  
3) copy local_settings.py into it and have it import * from base.py
4) make as many copies as you need different environments.

My default settings start out like this (this is default_settings.py with 
dots where there should be white space so that nesting is preserved)

# this system uses structured settings.py as defined in 
http://www.slideshare.net/jacobian/the-best-and-worst-of-django
> #
> # this third-level staging file overrides some definitions in staging.py
> # You may wish to alter it to agree with your local environment
> #
>
> from staging import *  # get most settings from staging.py (which in turn, 
> imports from base.py)
>
> # # # now override the settings which came from staging # # # #
>
> # choose a different database...
> # sqlite
> DATABASES = {
> .'default': {
> ..'ENGINE': 'django.db.backends.sqlite3',
> ..'NAME': 'db.sqlite3',
> .}
> }
>
> DATABASE_ROUTERS = []  # turn off second database
>
> # Make a unique unique key just for testing, and don't share it with anybody.
> SECRET_KEY = 'mlfs33^s1l4xf6a36$0#j%dd*sisfoi&)&4s-v=91#^l01v)*j'
>
>
  I have gone a step further by altering my manage.py to more easily call 
multiple settings files, and to remind me which one I am using at any 
moment.  My present version of manage.py looks like this:

> #!/usr/bin/env python
> # encoding=utf-8
> from __future__ import print_function
> import os
> import sys
>
> if __name__ == "__main__":
> .# altered for new settings layout
> .if not any([arg.startswith('--settings=') for arg in sys.argv]):
> ..os.environ.setdefault("DJANGO_SETTINGS_MODULE", 
> "formhub.settings.default_settings")
> ..print('Your environment 
> is:"{}"'.format(os.environ['DJANGO_SETTINGS_MODULE']))
> .
> .from django.core.management import execute_from_command_line
> .
> .execute_from_command_line(sys.argv)
>
>

On Wednesday, September 18, 2013 11:36:17 PM UTC-6, Victor Hooi wrote:
>
> Hi,
>
> I have several settings in my Django settings.py file that are specific 
>
> Currently, I'm grabbing these from environment variables in settings.py:
>
> import os
>> ...
>> # TODO - We need to gracefully catch if these aren't set.
>> SOME_VARIABLE = os.environ['SOME_VARIABLE']
>
>
> This includes things like API keys, database IPs, database 
> username/passwords, static file locations etc.
>
> I then set these in the virtualenv activate script.
>
> Is this a good practice in Django?
>
> Also, is there a graceful way of catching when these aren't set? 
> Currently, I'm using some of those settings variables in models.py, and 
> it's failing silently. Should I put each os.environ call in a try/except 
> block, or is there a more Pythonic way?
>
> Cheers,
> Victor
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.