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

2013-09-19 Thread Chad Vernon
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.


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

2013-09-19 Thread John DeRosa
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+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.


django-celery connects to localhost but not by ip

2013-09-19 Thread Chad Vernon
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+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: Group by using DJango ORM

2013-09-19 Thread Russell Keith-Magee
On Fri, Sep 20, 2013 at 7:34 AM, Nicolas Mendoza wrote:

> Actually what's the best way for do a group by using django ORM?
>
> I know workarounds like combinate "values" with "Anotate", etc. but I
> wil like know  your favorite workaround without rawSQL and not manager
> based , only Django ORM ;-)
>
> Example.objects.values('type').annotate(dcount=Count('type')) 
>

The thing is -- your question is wrong, and until you understand *why* it's
wrong, you're going to be frustrated with Django's ORM.

Django's ORM *isn't* SQL. It's an object model. The ORM *very deliberately*
avoids exposing SQL concepts. Asking "How do I do a GROUP BY" is the wrong
question to be asking. There *is* no way to do a GROUP BY in Django's ORM -
and that's by design.

What we *do* have is two things:

Firstly a representation of common object-based summaries, expressed in
object terms. What is the average age of this group of authors? What is the
total sum of the value of all books written by this list of authors.
*These* are object-based queries, not GROUP BY statements. You need to pose
your question in terms of the relationships between objects in order for it
to be meaningful.

Secondly, we have a fall through that will give you access to raw SQL. An
ORM is an abstraction, and all abstractions leak, so sometimes to get the
most efficient representation of a query, you'll need to go to the bare
metal.

So - there's actually no way to answer your question. If you have a
specific query you want to represent, we can help you work out how to
express that in the ORM, but asking "how do I GROUP BY" doesn't make any
sense.

Yours,
Russ Magee %-)

-- 
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.


Group by using DJango ORM

2013-09-19 Thread Nicolas Mendoza
Actually what's the best way for do a group by using django ORM?

I know workarounds like combinate "values" with "Anotate", etc. but I
wil like know  your favorite workaround without rawSQL and not manager
based , only Django ORM ;-)

Example.objects.values('type').annotate(dcount=Count('type')) 

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: Need help figuring out why my { key:value } doesn't seem to be passed to my view by my javascript file.

2013-09-19 Thread Leonardo Giordani
I see now that you are not passing the CSRF token, are you?
https://docs.djangoproject.com/en/dev/ref/contrib/csrf/

Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/9/18 <7equivale...@gmail.com>

> "So I think that the ajax() function is calling the URL
> "/pi/?pathID=somevalue," Is that different than how a key:value pair are
> normally sent? I don't know much about this.
> This is the output from the development server...
>
> "GET /pi/ HTTP/1.1" 200 2600
>
> --
> 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: Receive parameter via post

2013-09-19 Thread carlos
Hi, try in the views: print request.POST['id'] for see de value

cheers,


On Thu, Sep 19, 2013 at 7:25 AM, Hélio Miranda  wrote:

> Good.
> I have my client application server, and was trying to send an id
> parameter via a post like this:
> $scope.deleteIMG = function(ID){
>  $http({
> method: 'POST',,
> url: "http://localhost:8080/onpitch/delImagePlayer/;,
>  data: {id:ID},
> headers: {
> "Content-Type": "application/json; charset=utf-8"
>  }
> }).success(function(data){
> console.log(data);
> });
>  }
>
> My issue is that now I do not know how to get the id on the side of Django.
> Someone can help me?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+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: AUTH_USER_MODEL refers to model 'registration.RegistrationProfile' that has not been installed

2013-09-19 Thread Gladson Simplício Brito
Sorry I deleted the file, but are here:
https://gist.github.com/gladson/9426052311ffe0e234e8


2013/9/19 Gladson Simplício Brito 

> Solved:
> from registration.models import RegistrationProfile as User
>
>
> 2013/9/19 Gladson Simplício Brito 
>
>> Django Version:1.5.4
>> Exception Type:ImproperlyConfigured
>> Exception Value:
>> AUTH_USER_MODEL refers to model 'registration.RegistrationProfile' that
>> has not been installed
>>
>> https://gist.github.com/gladson/d2731f4587c4524f90b8
>>
>> Works on my local machine, in ubuntu, but Webfaction of this error.
>> Do not put it in production mode or anything.
>> The same way I did in my place in this Webfaction server.
>> I did it to make sure it was not doing anything different, but I got no
>> result... :(
>>
>
>

-- 
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: AUTH_USER_MODEL refers to model 'registration.RegistrationProfile' that has not been installed

2013-09-19 Thread Gladson Simplício Brito
Solved:
from registration.models import RegistrationProfile as User


2013/9/19 Gladson Simplício Brito 

> Django Version:1.5.4
> Exception Type:ImproperlyConfigured
> Exception Value:
> AUTH_USER_MODEL refers to model 'registration.RegistrationProfile' that
> has not been installed
>
> https://gist.github.com/gladson/d2731f4587c4524f90b8
>
> Works on my local machine, in ubuntu, but Webfaction of this error.
> Do not put it in production mode or anything.
> The same way I did in my place in this Webfaction server.
> I did it to make sure it was not doing anything different, but I got no
> result... :(
>

-- 
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.


AUTH_USER_MODEL refers to model 'registration.RegistrationProfile' that has not been installed

2013-09-19 Thread Gladson Simplício Brito
Django Version:1.5.4
Exception Type:ImproperlyConfigured
Exception Value:
AUTH_USER_MODEL refers to model 'registration.RegistrationProfile' that has
not been installed

https://gist.github.com/gladson/d2731f4587c4524f90b8

Works on my local machine, in ubuntu, but Webfaction of this error.
Do not put it in production mode or anything.
The same way I did in my place in this Webfaction server.
I did it to make sure it was not doing anything different, but I got no
result... :(

-- 
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: migrating from django 1.3.0 to 1.5.4, getting ImproperlyConfigured exceptions (AUTH_USER_MODEL refers to model 'auth.User' that has not been installed)

2013-09-19 Thread Daniel Roseman
On Thursday, 19 September 2013 08:21:49 UTC+1, Leo wrote:

> A question to better understand your problem: do you use a custom User 
> model in Django 1.3?
> Did you perhaps set the AUTH_USER_MODEL=auth.User in your settings.py?
>

There was no such thing as that setting in 1.3. It's new in 1.5.
--
DR. 

-- 
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: session data and logout

2013-09-19 Thread Bill Freeman
About the only meaning that "logout" can have on a web site is "this
session is no longer valid".  The expires stuff has to do with when you
don't log out, but don't visit the page again.


On Thu, Sep 19, 2013 at 8:54 AM, MikeKJ  wrote:

> I have this oddball requirement where an authenticated user is logged in
> so I can create a session variable to use elsewhere then do
> logout(request),so far so good, but it appears that my session variable is
> destroyed by the logout.
> Now I honestly thought that this wouldnt be the case as in settings.py I
> use the session expire on browser close.
> Anyone have any insight they can offer as to why the session variable os
> deleted and how to overcome it and retain the value?
>
> Cheers
>
> --
> 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: Receive parameter via post

2013-09-19 Thread Nicolas Mendoza
Here an example: https://gist.github.com/6625035

2013/9/19 Hélio Miranda :
> Good.
> I have my client application server, and was trying to send an id parameter
> via a post like this:
> $scope.deleteIMG = function(ID){
> $http({
> method: 'POST',,
> url: "http://localhost:8080/onpitch/delImagePlayer/;,
> data: {id:ID},
> headers: {
> "Content-Type": "application/json; charset=utf-8"
> }
> }).success(function(data){
> console.log(data);
> });
> }
>
> My issue is that now I do not know how to get the id on the side of Django.
> Someone can help me?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+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: while loop in django

2013-09-19 Thread Lee Hinde
Just a stab…

https://docs.djangoproject.com/en/1.5/ref/templates/builtins/#ifchanged

The sample code shows you how to move through a selection and how to test 
changes.


On Sep 19, 2013, at 12:53 AM, Harjot Mann  wrote:

> On Thu, Sep 19, 2013 at 12:45 PM, Leonardo Giordani
>  wrote:
>> Can you perhaps better describe what you are trying to do?
>> Do you need it in a view or in a template?
> 
> 
> In views I want to add two values having same job-id in my app but
> having some other differences. Please tell me how can I do that and
> also I dont know how to use while loop.please tell me.
> 
> -- 
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.com/
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/
> 

-- 
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: migrating from django 1.3.0 to 1.5.4, getting ImproperlyConfigured exceptions (AUTH_USER_MODEL refers to model 'auth.User' that has not been installed)

2013-09-19 Thread Leonardo Giordani
The way you are creating the DB is quite complicated, but I suspect that
you are not syncing the base Django applications before doing your magic
stuff. That could be the reason why Django is complaining about the
auth.User not being installed.

I would do the following:

* settings.py with the core apps
* syncdb
* inspectdb
* schemamigration --auto
* migrate

I strongly feel that your problem has to do with Django processing your
models BEFORE doing the base stuff.
Can you try this?

Regards

Leo


Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/9/19 Lauri Carpenter 

> More information:
>
> Interactively, I can get a user_model:
>
> $ python
> Python 2.6.6 (r266:84292, Oct 12 2012, 14:23:48)
> [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from django.contrib.auth import get_user_model
> >>> user_model = get_user_model()
> >>> user_model
> 
> >>>
> >>>
> >>> from django.conf import settings
> >>> settings.AUTH_USER_MODEL
> 'auth.User'
> >>>
>
> (note that the settings.AUTH_USER_MODEL is being calculated by django, not
> set by us; our settings.py file does not include any reference to
> AUTH_USER_anything).
>
> But when this happens during the authentication portion of the web
> interface, it causes the traceback, from somewhere within the
> django.contrib.auth forms for logging in (see traceback in initial
> posting).
>
> -- lauri
>
> On Wednesday, September 18, 2013 12:51:30 PM UTC-5, Lauri Carpenter wrote:
>>
>> We have been using django 1.3.0 for a long time.  We are now trying to
>> migrate to 1.5.4.  We have not changed any schema or model information.  We
>> have been using two layers of middleware and backends (notably something
>> based on SSLAuth Django App to authenticate first by certificate issued
>> from a trusted authority, then django_auth_ldap to login via ldap if no
>> valid certificate is presented). Both of these live on top of whatever
>> user/certificate/client/etc. scheme is supported in django 1.3.0.
>> [snip]
>>
>>  --
> 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: Exception Error

2013-09-19 Thread Leonardo Giordani
You are using self.loan_amount, which is an attribute, as a function:
self.load_amount().
I suspect there is a missing sign (+-*/) between self.loan_amount and the
following (
May you confirm this?

Leo



Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/9/19 Maurice J Elagu 

> # line 264 is the formula for compound interest
>
> self.required_payment =self.loan_amount
> ((1+((self.interest_rate/self.compound_period)/100))**(self.compound_period
> * self.time_years))
>
>
> On Thu, Sep 19, 2013 at 4:18 PM, Leonardo Giordani <
> giordani.leona...@gmail.com> wrote:
>
>> Ok, can you report the content of
>> /home/maurice/Desktop/django/Servant/Dashboard/models.py around line 264?
>> Your error is there.
>>
>> Simply paste the output of "nl models.py | grep 264 -C 20"
>>
>> Regards
>>
>> PS: Rember to reply to the list =)
>>
>>
>> Leonardo Giordani
>> Author of The Digital Cat 
>> My profile on About.me  - My GitHub
>> page  - My Coderwall 
>> profile
>>
>>
>> 2013/9/19 Maurice J Elagu 
>>
>>>  TypeError at /admin/Dashboard/loan/add/
>>>
>>> 'Decimal' object is not callable
>>>
>>> Request Method: POSTRequest URL:
>>> http://127.0.0.1:8777/admin/Dashboard/loan/add/ Django 
>>> Version:1.3.1Exception Type:
>>> TypeError Exception Value:
>>>
>>> 'Decimal' object is not callable
>>>
>>> Exception Location:/home/maurice/Desktop/django/Servant/Dashboard/models.py
>>> in save, line 264 Python Executable: /usr/bin/pythonPython 
>>> Version:2.7.3Python
>>> Path:
>>>
>>> ['/home/maurice/Desktop/django/Servant',
>>>  '/usr/lib/python2.7',
>>>  '/usr/lib/python2.7/plat-linux2',
>>>  '/usr/lib/python2.7/lib-tk',
>>>  '/usr/lib/python2.7/lib-old',
>>>  '/usr/lib/python2.7/lib-dynload',
>>>  '/usr/local/lib/python2.7/dist-packages',
>>>  '/usr/lib/python2.7/dist-packages',
>>>  '/usr/lib/python2.7/dist-packages/PIL',
>>>  '/usr/lib/python2.7/dist-packages/gst-0.10',
>>>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>>>  '/usr/lib/pymodules/python2.7',
>>>  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-client',
>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol',
>>>  '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
>>>
>>> Server time:Wed, 18 Sep 2013 12:17:34 +0300
>>>
>>
>>
>

-- 
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: migrating from django 1.3.0 to 1.5.4, getting ImproperlyConfigured exceptions (AUTH_USER_MODEL refers to model 'auth.User' that has not been installed)

2013-09-19 Thread Lauri Carpenter
Ok, I have found the problem (through digging through to post more 
information about it).

It turns out that in our gui application, the gui-specific settings file 
was setting:
INSTALLED_APPS = (
'ncis_gui',
'ncis_sslauth',
'django_auth_ldap',
)

and did not include the apps that come by default with django.  When I fix 
this to contain the full list,
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'ncis_gui',
'ncis_sslauth',
'django_auth_ldap',
)

things started to work again.

Thank you for helping me to walk through all of this.  Now I wonder why 
this is working at all in django 1.3.0, but at least I know how to move 
forward to make it work in django 1.5.4!

Thanks much, lauri

-- 
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: migrating from django 1.3.0 to 1.5.4, getting ImproperlyConfigured exceptions (AUTH_USER_MODEL refers to model 'auth.User' that has not been installed)

2013-09-19 Thread Lauri Carpenter
More information: 

Interactively, I can get a user_model:

$ python
Python 2.6.6 (r266:84292, Oct 12 2012, 14:23:48) 
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from django.contrib.auth import get_user_model
>>> user_model = get_user_model()
>>> user_model

>>> 
>>> 
>>> from django.conf import settings
>>> settings.AUTH_USER_MODEL
'auth.User'
>>>

(note that the settings.AUTH_USER_MODEL is being calculated by django, not 
set by us; our settings.py file does not include any reference to 
AUTH_USER_anything).

But when this happens during the authentication portion of the web 
interface, it causes the traceback, from somewhere within the 
django.contrib.auth forms for logging in (see traceback in initial 
posting).   

-- lauri

On Wednesday, September 18, 2013 12:51:30 PM UTC-5, Lauri Carpenter wrote:
>
> We have been using django 1.3.0 for a long time.  We are now trying to 
> migrate to 1.5.4.  We have not changed any schema or model information.  We 
> have been using two layers of middleware and backends (notably something 
> based on SSLAuth Django App to authenticate first by certificate issued 
> from a trusted authority, then django_auth_ldap to login via ldap if no 
> valid certificate is presented). Both of these live on top of whatever 
> user/certificate/client/etc. scheme is supported in django 1.3.0.
> [snip]
>
>

-- 
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.


Receive parameter via post

2013-09-19 Thread Hélio Miranda
Good.
I have my client application server, and was trying to send an id parameter 
via a post like this:
$scope.deleteIMG = function(ID){
 $http({
method: 'POST',,
url: "http://localhost:8080/onpitch/delImagePlayer/;,
data: {id:ID},
headers: {
"Content-Type": "application/json; charset=utf-8"
}
}).success(function(data){
console.log(data);
});
}

My issue is that now I do not know how to get the id on the side of Django.
Someone can help me?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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: migrating from django 1.3.0 to 1.5.4, getting ImproperlyConfigured exceptions (AUTH_USER_MODEL refers to model 'auth.User' that has not been installed)

2013-09-19 Thread Lauri Carpenter
Yes, it is installed:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
)

-- lauri

On Wednesday, September 18, 2013 1:41:48 PM UTC-5, Daniel Roseman wrote:
>
> On Wednesday, 18 September 2013 18:51:30 UTC+1, Lauri Carpenter wrote:
>
>> We have been using django 1.3.0 for a long time.  We are now trying to 
>> migrate to 1.5.4.  We have not changed any schema or model information.  We 
>> have been using two layers of middleware and backends (notably something 
>> based on SSLAuth Django App to authenticate first by certificate issued 
>> from a trusted authority, then django_auth_ldap to login via ldap if no 
>> valid certificate is presented). Both of these live on top of whatever 
>> user/certificate/client/etc. scheme is supported in django 1.3.0.
>>
>> But under django 1.5.4 we are 
>> seeing django.core.exceptions.ImproperlyConfigured exceptions 
>> "AUTH_USER_MODEL refers to model 'auth.User' that has not been installed" 
>> on the gui page when trying to log in.  The chunk'o'code that handles 
>> looking for certificate and creating a user if the certificate is presented 
>> gets this error (so that nobody can use their certificates to log in); then 
>> the fallback "login" view kicks in, and gets the traceback shown here;
>> Traceback:
>> File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in 
>> get_response
>>   115. response = callback(request, 
>> *callback_args, **callback_kwargs)
>> File "/var/www/lauri/dj/ncis_gui/ncis_gui/src/ncis_gui.py" in login
>>   244. return views.login(request, *args, template_name='login.html', 
>> extra_context=ncis_context, **kwargs)
>> File "/usr/lib/python2.6/site-packages/django/views/decorators/debug.py" 
>> in sensitive_post_parameters_wrapper
>>   75. return view(request, *args, **kwargs)
>> File "/usr/lib/python2.6/site-packages/django/utils/decorators.py" in 
>> _wrapped_view
>>   91. response = view_func(request, *args, **kwargs)
>> File "/usr/lib/python2.6/site-packages/django/views/decorators/cache.py" 
>> in _wrapped_view_func
>>   89. response = view_func(request, *args, **kwargs)
>> File "/usr/lib/python2.6/site-packages/django/contrib/auth/views.py" in 
>> login
>>   53. form = authentication_form(request)
>> File "/usr/lib/python2.6/site-packages/django/contrib/auth/forms.py" in 
>> __init__
>>   177. UserModel = get_user_model()
>> File "/usr/lib/python2.6/site-packages/django/contrib/auth/__init__.py" 
>> in get_user_model
>>   129. raise ImproperlyConfigured("AUTH_USER_MODEL refers to 
>> model '%s' that has not been installed" % settings.AUTH_USER_MODEL)
>>
>> Exception Type: ImproperlyConfigured at /login/
>> Exception Value: AUTH_USER_MODEL refers to model 'auth.User' that has not 
>> been installed
>>
>>
>> After googling and reading whatever I could find on the subject (most 
>> notably 
>> http://procrastinatingdev.com/django/using-configurable-user-models-in-django-1-5/
>>  where 
>> it expressly says that if you're happy with the existing stuff you don't 
>> have to change any code) -- I am thoroughly vexed.
>>
>> What migration step have I missed in order to really use the stuff we 
>> were using before without changes?
>>
>> -- lauri
>>
>>
> Is 'django.contrib.auth' included in your INSTALLED_APPS? Potentially 
> Django is stricter about this now than it used to be.
> --
> DR. 
>

-- 
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: Exception Error

2013-09-19 Thread Leonardo Giordani
Ok, can you report the content of
/home/maurice/Desktop/django/Servant/Dashboard/models.py around line 264?
Your error is there.

Simply paste the output of "nl models.py | grep 264 -C 20"

Regards

PS: Rember to reply to the list =)


Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/9/19 Maurice J Elagu 

> TypeError at /admin/Dashboard/loan/add/
>
> 'Decimal' object is not callable
>
> Request Method: POSTRequest URL:
> http://127.0.0.1:8777/admin/Dashboard/loan/add/ Django Version:1.3.1Exception 
> Type:
> TypeError Exception Value:
>
> 'Decimal' object is not callable
>
> Exception Location:/home/maurice/Desktop/django/Servant/Dashboard/models.py
> in save, line 264 Python Executable: /usr/bin/pythonPython Version: 
> 2.7.3Python
> Path:
>
> ['/home/maurice/Desktop/django/Servant',
>  '/usr/lib/python2.7',
>  '/usr/lib/python2.7/plat-linux2',
>  '/usr/lib/python2.7/lib-tk',
>  '/usr/lib/python2.7/lib-old',
>  '/usr/lib/python2.7/lib-dynload',
>  '/usr/local/lib/python2.7/dist-packages',
>  '/usr/lib/python2.7/dist-packages',
>  '/usr/lib/python2.7/dist-packages/PIL',
>  '/usr/lib/python2.7/dist-packages/gst-0.10',
>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>  '/usr/lib/pymodules/python2.7',
>  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-client',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol',
>  '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
>
> Server time:Wed, 18 Sep 2013 12:17:34 +0300
>

-- 
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.


DatabaseError during executing in ibm_db_dbi.py

2013-09-19 Thread Dennis Jade Toribio
Hi,

i am new to using DB2 in Django. So far, my problem was with using 
ibm_db_django adapter as I see it. Since using ibm_db has no problem 
saving/getting data.

I was wondering what causes the problem here. It seems to me the 
*execute*method inside ibm_db_dbi.py => _execute_helper =>  return_value = 
ibm_db.execute(self.stmt_handler, parameters) cause the error not really 
100% no idea :) as this is my 3rd with db2-django :(







-- 
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: Exception Value: 'Decimal' object is not callable dont no where this is coming from, Any help will be kindly appreciated

2013-09-19 Thread MAurice


On Wednesday, September 18, 2013 1:07:57 AM UTC+3, MAurice wrote:
>
> class Loan(models.Model):
> id = models.AutoField(primary_key=True,default=1)
> loan_type   =models.CharField(max_length=20, 
> choices=LTYPE,default=1)
> def number():
> no =Account.objects.count()
> if no == None:
> return 10
> else:
> return no + 11
>
>
> 
> loan_statement_no=models.IntegerField(('loan_statement_no'),max_length=10, 
> unique =True, default=number)
> branch_cod  =models.IntegerField(blank=True, null=True)
> comp_per_ya =models.IntegerField(default=1, help_text="Number 
> of compoundings in a year")
> time_years  =models.DecimalField(default=1.0, max_digits=10, 
> decimal_places=1)
> loan_number =models.SlugField(unique=True)
> #branch =models.ManyToManyField(Branche)
> start_date  =models.DateField(blank=True, 
> null=True,default=datetime.datetime.now())
> end_date=models.DateField(blank=True, null=True)
> no_days =models.IntegerField(default=1)
> account_name=models.ForeignKey(Account)
> loan_amount =models.DecimalField(default=1.0, max_digits=10, 
> decimal_places=2)
> interest_rate   =models.DecimalField(default=1.0, max_digits=10, 
> decimal_places=2, null=True, blank=True)
> compound_period =models.IntegerField(max_length=64, 
> choices=compound_period, default=Yearly)
> loan_fee=models.DecimalField(default=1.0, max_digits=10, 
> decimal_places=2, null=True, blank=True)
> ammount_repaid= models.DecimalField(default=1.0, max_digits=10, 
> decimal_places=2, null=True, blank=True)
> sd_amount   =models.DecimalField(default=1.0, max_digits=10, 
> decimal_places=2, null=True, blank=True)
> dd_amount   =models.DecimalField(default=1.0, max_digits=10, 
> decimal_places=2, null=True, blank=True)
> #interest (base) rate
> ib_rate =models.DecimalField(default=1.0, max_digits=10, 
> decimal_places=2, null=True, blank=True)
> #interest (penal) rate
> ip_rate =models.DecimalField(default=1.0, max_digits=10, 
> decimal_places=2, null=True, blank=True)
> #interest repayment frequency
> ir_frequency
> =models.IntegerField(max_length=64,choices=IRFREQUENCY,default=WEEKLY)
> pr_frequency
> =models.IntegerField(max_length=64,choices=PRFREQUENCY,default=DAILY,help_text="Suggested
>  
> value automatically generated from title. Must be unique.")
>
>
> last_edit_time  = models.TimeField(auto_now=True)
> last_edit_date  = models.DateField(auto_now=True)
>no_of_instalments = models.DecimalField(default=1.0, 
> max_digits=10, decimal_places=2, null=True, blank=True)
> no_of_instalments_interest =models.DecimalField(default=1.0, 
> max_digits=10, decimal_places=2, null=True, blank=True)
> interest_charged = models.DecimalField(default=1.0, max_digits=10, 
> decimal_places=2, editable=False)
>
>
> def save(self, *args, **kwargs):
> i
> self.no_days =(self.end_date - self.start_date).days
> self.required_payment =self.loan_amount 
> ((1+(((self.interest_rate)/(self.compound_period))/100))**((self.compound_period)
>  
> * (self.time_years)))
> self.no_of_instalments = (self.no_days) / (self.pr_frequency)
> self.no_of_instalments_interest = (self.no_days) / 
> (self.ir_frequency)
>  def name(self):
> return self.account_name.name
>  
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: migrating from django 1.3.0 to 1.5.4, getting ImproperlyConfigured exceptions (AUTH_USER_MODEL refers to model 'auth.User' that has not been installed)

2013-09-19 Thread Lauri Carpenter
I don't think we used a custom User model in Django 1.3, but perhaps we did 
without knowing it.  How would I know for sure?  We aren't setting any 
AUTH_USER_*** anything in our settings file, that's certain.

- We use django-admin.py syncdb to create the authentication tables and 
whatever else is needed for the INSTALLED_APPS, where our installed_apps 
looks like:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
)

The tables created are:
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site

- We do not use django to generate our database, we use a different tool 
(dezign).Dezign generates a "create_db.sql" script from an ER diagram. 
 A Makefile runs the "create_db.sql" script to create the tables after the 
original django-admin.py command has created the initial administrative 
tables.  We add one foreign key constraint to one of our tables 
(client_certificates.user_id references auth_user.id). 

- We use django-admin.py inspectdb (plus automated massaging of that 
output) to generate the models.  Our models do include classes all of the 
admin tables listed above.

So, are we using the django user model, or a custom model?  I would think 
we are using the django user model, but...

-- lauri

On Thursday, September 19, 2013 2:21:49 AM UTC-5, Leo wrote:
>
> A question to better understand your problem: do you use a custom User 
> model in Django 1.3?
> Did you perhaps set the AUTH_USER_MODEL=auth.User in your settings.py?
>
> If you do not need a custom user model just drop the AUTH_USER_MODEL 
> setting variable. Otherwise subclassthe AbstractBaseUser and set your 
> application's user model in the settings.py file.
>
> Let me know if I correctly understood your issue.
>
> Regards
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub 
> page  - My Coderwall 
> profile
>  
>
> 2013/9/18 Lauri Carpenter 
>
>> We have been using django 1.3.0 for a long time.  We are now trying to 
>> migrate to 1.5.4.  We have not changed any schema or model information.  We 
>> have been using two layers of middleware and backends (notably something 
>> based on SSLAuth Django App to authenticate first by certificate issued 
>> from a trusted authority, then django_auth_ldap to login via ldap if no 
>> valid certificate is presented). Both of these live on top of whatever 
>> user/certificate/client/etc. scheme is supported in django 1.3.0.
>>
>> But under django 1.5.4 we are 
>> seeing django.core.exceptions.ImproperlyConfigured exceptions 
>> "AUTH_USER_MODEL refers to model 'auth.User' that has not been installed" 
>> on the gui page when trying to log in.  The chunk'o'code that handles 
>> looking for certificate and creating a user if the certificate is presented 
>> gets this error (so that nobody can use their certificates to log in); then 
>> the fallback "login" view kicks in, and gets the traceback shown here;
>> Traceback:
>> File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in 
>> get_response
>>   115. response = callback(request, 
>> *callback_args, **callback_kwargs)
>> File "/var/www/lauri/dj/ncis_gui/ncis_gui/src/ncis_gui.py" in login
>>   244. return views.login(request, *args, template_name='login.html', 
>> extra_context=ncis_context, **kwargs)
>> File "/usr/lib/python2.6/site-packages/django/views/decorators/debug.py" 
>> in sensitive_post_parameters_wrapper
>>   75. return view(request, *args, **kwargs)
>> File "/usr/lib/python2.6/site-packages/django/utils/decorators.py" in 
>> _wrapped_view
>>   91. response = view_func(request, *args, **kwargs)
>> File "/usr/lib/python2.6/site-packages/django/views/decorators/cache.py" 
>> in _wrapped_view_func
>>   89. response = view_func(request, *args, **kwargs)
>> File "/usr/lib/python2.6/site-packages/django/contrib/auth/views.py" in 
>> login
>>   53. form = authentication_form(request)
>> File "/usr/lib/python2.6/site-packages/django/contrib/auth/forms.py" in 
>> __init__
>>   177. UserModel = get_user_model()
>> File "/usr/lib/python2.6/site-packages/django/contrib/auth/__init__.py" 
>> in get_user_model
>>   129. raise ImproperlyConfigured("AUTH_USER_MODEL refers to 
>> model '%s' that has not been installed" % settings.AUTH_USER_MODEL)
>>
>> Exception Type: ImproperlyConfigured at /login/
>> Exception Value: AUTH_USER_MODEL refers to model 'auth.User' that has not 
>> been installed
>>
>>
>> After googling and reading whatever I 

session data and logout

2013-09-19 Thread MikeKJ
I have this oddball requirement where an authenticated user is logged in so 
I can create a session variable to use elsewhere then do logout(request),so 
far so good, but it appears that my session variable is destroyed by the 
logout.  
Now I honestly thought that this wouldnt be the case as in settings.py I 
use the session expire on browser close.
Anyone have any insight they can offer as to why the session variable os 
deleted and how to overcome it and retain the value?

Cheers

-- 
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: Upload de musicas (music upload)

2013-09-19 Thread Kelvin Wong
I just wrote a blog post on uploading files using generic class based 
views. It has a sample app as well.

https://bit.ly/14m6Q65

Let me know if you have any questions.

K


On Monday, September 16, 2013 8:41:06 AM UTC-7, Carlos Andre wrote:
>
> Olá pessoal, tudo bom?
> Eu gostaria de uma ajuda de como fazer upload de músicas no banco de 
> dados, como faço upload de arquivo. Gostaria de exemplos.
>
> Hello guys, how are you?
> I would like some help on how to upload songs in the database, how do I 
> upload file. I would like examples.
>

-- 
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.


Template unable to show media files in production

2013-09-19 Thread vittorio
*Context: Ubuntu linux server 12, Apache 2.2 server, django 1.5.3*
*
*
My project, /home/victor/magazantea is dealt with by admin and it works 
fine in the development environment (/manage.py runserver 
192.168.1.19:8000). 
I built a view which gets data from the following fields from model 
"Articoli" 

*models.py*
class Articoli(models.Model):
.
codice = 
models.CharField(primary_key=True,db_index=True,max_length=15,db_column='Codice')
descrizione = models.CharField(max_length=255, db_column='Descrizione', 
db_index=True)
categoria = models.IntegerField(choices=categoria, 
db_column='Categoria',default=2)

@property
def codice_a_barre(self):
self.codice = self.codice.strip()
cod= self.codice.replace(" ", "_").replace("/","_")
return (str(cod)+ '.png')

and produces a template *"listarticoli.html"  *where* *codice, 
descrizione,categoria are listed together with the image of the png file 
referred to by the string codice_a_barre, got from the media dir 
"/home/victor/magazantea/magazantea/media". 
It works like a charm in development but when I put it *in production the 
png files aren't shown* (instead a small blue square whit a question mark 
inside is shown in each line).
These are the relevant files  in production:

*settings.py *
import os
ABSOLUTE_PATH='%s/' % 
os.path.abspath(os.path.dirname(locals.__name__)).replace('\\','/')
DEBUG = False
ALLOWED_HOSTS=['*']
...
MEDIA_ROOT='/home/victor/magazantea/magazantea/media/'
MEDIA_URL = '/media/'
STATIC_ROOT = ''
STATIC_URL = '/static/'
.
ROOT_URLCONF = 'magazantea.urls'
...
..

*urls.py*
from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^magazzino/', include(admin.site.urls)),
url(r'^listarticoli/', 'magazzino.views.listbarcode', 
name='listbarcode'),
url(r'^listarticoli/(?P.*)$', 
'django.views.static.serve',{'document_root': 
'/home/victor/magazantea/magazantea/media/'}),
)

And finally the *Apache config*

Listen 8000
WSGIScriptAlias / /home/victor/magazantea/django.wsgi
WSGIPythonPath /home/victor/magazantea


AliasMatch ^/([^/]*\.css) /home/victor/magazantea/magazantea/static/
AliasMatch ^/([^/]*\.png) /home/victor/magazantea/magazantea/media/

Alias /media/ /home/victor/magazantea/magazantea/media/
Alias /static/ /home/victor/magazantea/magazantea/static/
Alias /templates/ /home/victor/magazantea/magazantea/templates/


Order deny,allow
Allow from all



Order deny,allow
Allow from all



Order deny,allow
Allow from all


ServerAdmin webmaster@localhost



Order deny,allow
Allow from all







-- 
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: Make a realtime video and Teleconsultation

2013-09-19 Thread aini jalil
Can i ask why you need this path: ultrasound --> laptop --> Web Server on 
REALTIME?
Do you want do some Video Streaming ? or just backup your Image/Video on a 
Web Server ? Can this [1] help you?

The reason I need this path "ultrasound --> laptop --> Web Server" because 
I want to do the video streaming
I want to make an application with my own flowchart,and there must have 
functions to key in and saving data patient and streaming video.
If [1],the software already there, I want to do similar with that but with 
my own flowchart and own code.
So,any advice?


On Wednesday, July 24, 2013 3:17:50 PM UTC+8, Christina wrote:
>
> I want to upload the realtime image/ video to my website.
> I have one ultrasound machine,I will transfer ultrasound video/image using 
> video grabber and transfer to my laptop.
> I want to upload this image/ video to my website as realtime,is that 
> possible?
> I'm beginner,previously already developed only a very basic project using 
> Django framework,so I don't have enough experience. 
>
> Please tell me where should I start.What topic I need to highlight when 
> studying the code.
> And is there any tutorial or similar project I can refer?
>
> Thank you.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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: Preview video

2013-09-19 Thread Rafael E. Ferrero
You can use HTML5 or some free flash player this is one i use
http://www.longtailvideo.com/jw-player/about/

See ya


2013/9/19 Hélio Miranda 

> Good staff.
>
> I'm here with a problem which is: I'm uploading videos and now wanted to
> show the video, but not sure how. I have to use a player?
> Someone can help me.
>
> For example the images I'm uploading and then viewing the'm doing
> something like this
>
> def viewAcademyPhotos (request, id):
>
>  mongoengine.fields.GridFSProxy = fs ()
>  fs.get picture = (id = ObjectId (id)). read ()
>
>  return HttpResponse (photo, content_type = 'image / jpeg')
>
>
> In the videos, how about it? Change the *content_type* for eg *video / avi
> *
>
> --
> 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.
>



-- 
Rafael E. Ferrero

-- 
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: Image Maps + Django

2013-09-19 Thread Tom Evans
On Tue, Sep 17, 2013 at 9:54 AM, +Emmanuel  wrote:
> I am intending to implement something similar to this:
> https://opendata.go.ke/facet/counties
> That has been developed in Ruby on Rails. How does Django handle image maps?
> Are there any additional Python/ Django libraries I will require? Is there a
> specific approach (best practices) way of solving this?
> Thanks.

As an image map is simply HTML interpreted on the client side,  Django
doesn't handle any image map, the browser does. Use any tool you like
to generate the image map polygons.

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


Fixing missing permissions (not in contrib.auth.models.Permission table in db)

2013-09-19 Thread graeme
As far as I can see the permissions should be there. I checked the South 
migration I used to add the Model and it seems correct: the schema 
migration creates the table and then 
calls db.send_create_signal('managed_villas', ['GuestReview'])

How do I fix it? The ContentType exists and seems correct, and everything 
else I can think of seems OK, except for the missing permissions:

i.e. Permission.all() does not included the expected permissions.

Should I fix by manually creating the permissions, or is there a better way?

-- 
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: Image Maps + Django

2013-09-19 Thread Nigel Legg
GeoDjango uses ESRI shape files in the example in the Djang documentation,
not Google maps?? (I don't want to use google maps either). To me it looks
ideal for your purpose

Cheers, Nigel
07914 740972



On 19 September 2013 10:50, +Emmanuel  wrote:

> @Nigel,
> If I understand it well, GeoDjango seems to be for a more robust GIS
> application that utilizes Google Maps. In contrast, I want to use a simple
> image map with no Google Maps. Thanks
> On Tuesday, September 17, 2013 12:34:49 PM UTC+3, Nigel Legg wrote:
>>
>> Read the documentation on GeoDjango, it's all there
>>
>> Cheers, Nigel
>> 07914 740972
>>
>>
>>
>> On 17 September 2013 09:54, +Emmanuel  wrote:
>>
>>> I am intending to implement something similar to this:
>>> https://opendata.go.ke/**facet/counties
>>> That has been developed in Ruby on Rails. How does Django handle image
>>> maps? Are there any additional Python/ Django libraries I will require? Is
>>> there a specific approach (best practices) way of solving this?
>>> 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...@**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.


Problem with authentication middleware, session and cache

2013-09-19 Thread Alessandro Pasotti
Hi,

I' have some problems trying to cache most of my websites when
 authentication mw is in place.

I only want to  cache anonymous users:

CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

anyway, I also want to show a different menu to authenticated users, so I
also check for user.is_authenticated in a template tag for the menu.

It seems like like this check accesses the session and the mw then sets
Vary=Cookie in the response, this prevents caching for users even if they
are anonymous.

To make things more complicated I also need to use sessions in a few view
(which are of course not cached).

Any suggestion about how to allow caching of my pages for anonymous users?


-- 
Alessandro Pasotti
w3:   www.itopen.it

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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: add marks of same roll number of different of different semestrs

2013-09-19 Thread Lachlan Musicman
I will presume that you have 2 Student details with the same roll_no
but with different class numbers. If that is not the case, then you
will need to revisit the modelling of your data.

Anyway, something like this would work.

student_details = StudentDetail.objects.get(roll_no=)


for student_detail in student_details:
 

Does that make sense? This would work in the shell, but for a
template, you would need a view for the first bit, and the second in
the template.

cheers
L.

On 19 September 2013 12:22, Harjot Mann  wrote:
> On Thu, Sep 19, 2013 at 7:39 AM, Lachlan Musicman  wrote:
>> Harjot,
>>
>> The answer to your question requires more information.
>>
>> We would need to see your model structure at the least.
>
>
> I want to add the marks of same roll number in different classes as
> given in the screenshot both the rows are of same roll number I want
> to add the marks of physics of class 11th ans 12th according to roll
> number.
> Here id my models. Its simple.
>
> class StudentDetail(models.Model):
> roll_no=models.IntegerField()
> Class=models.CharField(max_length=100, blank=True, null=True)
> physics=models.IntegerField(blank=True, null =True)
> maths=models.IntegerField(blank=True, null =True)
> chemistry=models.IntegerField(blank=True, null =True)
>
> --
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.com/
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/
>
> --
> 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.



-- 
Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013:
When you used to be punk, and now you are still punk but not as punk,
are you post-punk or decaying punk or ex-punk or just not punk anymore

-- 
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: Image Maps + Django

2013-09-19 Thread +Emmanuel
@Nigel,
If I understand it well, GeoDjango seems to be for a more robust GIS 
application that utilizes Google Maps. In contrast, I want to use a simple 
image map with no Google Maps. Thanks
On Tuesday, September 17, 2013 12:34:49 PM UTC+3, Nigel Legg wrote:
>
> Read the documentation on GeoDjango, it's all there 
>
> Cheers, Nigel 
> 07914 740972
>
>
>
> On 17 September 2013 09:54, +Emmanuel wrote:
>
>> I am intending to implement something similar to this: 
>> https://opendata.go.ke/facet/counties
>> That has been developed in Ruby on Rails. How does Django handle image 
>> maps? Are there any additional Python/ Django libraries I will require? Is 
>> there a specific approach (best practices) way of solving this?
>> 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...@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.


Preview video

2013-09-19 Thread Hélio Miranda
Good staff.

I'm here with a problem which is: I'm uploading videos and now wanted to 
show the video, but not sure how. I have to use a player?
Someone can help me.

For example the images I'm uploading and then viewing the'm doing something 
like this

def viewAcademyPhotos (request, id):

 mongoengine.fields.GridFSProxy = fs ()
 fs.get picture = (id = ObjectId (id)). read ()

 return HttpResponse (photo, content_type = 'image / jpeg')


In the videos, how about it? Change the *content_type* for eg *video / avi*

-- 
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: while loop in django

2013-09-19 Thread Leonardo Giordani
Harjot,

with so little information is very difficult to help you, you should try to
give a description of your models and exactly what you want to do. What are
the "values" and the "job-id" you are talking about? And what about
"differences"?

About the while loop: in Python it is used this way
http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/whilestatements.html
In Django views (being them Python) you can do the same. In the Django
Template Language there is no while loop available. You can write a tag on
your own, but I suggest you to try and clarify your issue, so that we can
come up with a solution.

Regards,

Leo

Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/9/19 Harjot Mann 

> On Thu, Sep 19, 2013 at 12:45 PM, Leonardo Giordani
>  wrote:
> > Can you perhaps better describe what you are trying to do?
> > Do you need it in a view or in a template?
>
>
> In views I want to add two values having same job-id in my app but
> having some other differences. Please tell me how can I do that and
> also I dont know how to use while loop.please tell me.
>
> --
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.com/
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/
>
> --
> 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: while loop in django

2013-09-19 Thread Harjot Mann
On Thu, Sep 19, 2013 at 12:45 PM, Leonardo Giordani
 wrote:
> Can you perhaps better describe what you are trying to do?
> Do you need it in a view or in a template?


In views I want to add two values having same job-id in my app but
having some other differences. Please tell me how can I do that and
also I dont know how to use while loop.please tell me.

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

-- 
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: Need help figuring out why my { key:value } doesn't seem to be passed to my view by my javascript file.

2013-09-19 Thread Leonardo Giordani
In Django key:value are sent the way you specify in your urls
configuration. E.g., say that you want to show an object that you can
extract from your DB with year=2013 and month=09 ('year' and 'month' are
here a primary key for that model if used together). The URL schema is
completely up to you, so you could implement the following solutions

basepath/2013/09/
basepath/2013_09/
basepath/?year=2013=09
etc, etc

You have just to implement the correct regular expressions in your URL
specification. (I would strongly adverse the second and the third example,
I used them only to exemplify what you can do).

This is what happens with standard GET requests in your views. POST
requests follow the same schema, but they encompass the form data in the
POST section of the HTTP request (that is available through
self.request.POST in your view).

So the problem you have to figure now is: what is jQuery.ajax() doing?
Sorry but I do not know jQuery AJAX, so I cannot help you on this topic.
Reading the documentation I understand that it is issuing a GET on
"/pi/?pathID=somevalue", so I would implement an URL pattern and a view to
catch this request.

Let me know what happens. Regards

Leo



Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/9/18 <7equivale...@gmail.com>

> "So I think that the ajax() function is calling the URL
> "/pi/?pathID=somevalue," Is that different than how a key:value pair are
> normally sent? I don't know much about this.
> This is the output from the development server...
>
> "GET /pi/ HTTP/1.1" 200 2600
>
> --
> 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: migrating from django 1.3.0 to 1.5.4, getting ImproperlyConfigured exceptions (AUTH_USER_MODEL refers to model 'auth.User' that has not been installed)

2013-09-19 Thread Leonardo Giordani
A question to better understand your problem: do you use a custom User
model in Django 1.3?
Did you perhaps set the AUTH_USER_MODEL=auth.User in your settings.py?

If you do not need a custom user model just drop the AUTH_USER_MODEL
setting variable. Otherwise subclassthe AbstractBaseUser and set your
application's user model in the settings.py file.

Let me know if I correctly understood your issue.

Regards

Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/9/18 Lauri Carpenter 

> We have been using django 1.3.0 for a long time.  We are now trying to
> migrate to 1.5.4.  We have not changed any schema or model information.  We
> have been using two layers of middleware and backends (notably something
> based on SSLAuth Django App to authenticate first by certificate issued
> from a trusted authority, then django_auth_ldap to login via ldap if no
> valid certificate is presented). Both of these live on top of whatever
> user/certificate/client/etc. scheme is supported in django 1.3.0.
>
> But under django 1.5.4 we are
> seeing django.core.exceptions.ImproperlyConfigured exceptions
> "AUTH_USER_MODEL refers to model 'auth.User' that has not been installed"
> on the gui page when trying to log in.  The chunk'o'code that handles
> looking for certificate and creating a user if the certificate is presented
> gets this error (so that nobody can use their certificates to log in); then
> the fallback "login" view kicks in, and gets the traceback shown here;
> Traceback:
> File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in
> get_response
>   115. response = callback(request,
> *callback_args, **callback_kwargs)
> File "/var/www/lauri/dj/ncis_gui/ncis_gui/src/ncis_gui.py" in login
>   244. return views.login(request, *args, template_name='login.html',
> extra_context=ncis_context, **kwargs)
> File "/usr/lib/python2.6/site-packages/django/views/decorators/debug.py"
> in sensitive_post_parameters_wrapper
>   75. return view(request, *args, **kwargs)
> File "/usr/lib/python2.6/site-packages/django/utils/decorators.py" in
> _wrapped_view
>   91. response = view_func(request, *args, **kwargs)
> File "/usr/lib/python2.6/site-packages/django/views/decorators/cache.py"
> in _wrapped_view_func
>   89. response = view_func(request, *args, **kwargs)
> File "/usr/lib/python2.6/site-packages/django/contrib/auth/views.py" in
> login
>   53. form = authentication_form(request)
> File "/usr/lib/python2.6/site-packages/django/contrib/auth/forms.py" in
> __init__
>   177. UserModel = get_user_model()
> File "/usr/lib/python2.6/site-packages/django/contrib/auth/__init__.py" in
> get_user_model
>   129. raise ImproperlyConfigured("AUTH_USER_MODEL refers to model
> '%s' that has not been installed" % settings.AUTH_USER_MODEL)
>
> Exception Type: ImproperlyConfigured at /login/
> Exception Value: AUTH_USER_MODEL refers to model 'auth.User' that has not
> been installed
>
>
> After googling and reading whatever I could find on the subject (most
> notably
> http://procrastinatingdev.com/django/using-configurable-user-models-in-django-1-5/
>  where
> it expressly says that if you're happy with the existing stuff you don't
> have to change any code) -- I am thoroughly vexed.
>
> What migration step have I missed in order to really use the stuff we were
> using before without changes?
>
> -- lauri
>
>  --
> 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: while loop in django

2013-09-19 Thread Leonardo Giordani
Can you perhaps better describe what you are trying to do?
Do you need it in a view or in a template?

Regards

Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/9/19 Harjot Mann 

> Please tell me how to use while loop indjango so that marks of
> students can be added untill the same roll number is going on?
>
> --
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.com/
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/
>
> --
> 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: Using environment variables in settings.py - good practice? How to handle missing variables gracefully?

2013-09-19 Thread Mike Dewhirst

On 19/09/2013 3:59pm, Victor Hooi wrote:

Hi,

Hmm, in many cases there isn't really a sensible default (e.g. API keys
or passwords).

I was asking more in terms of - is this the "right" way of doing it in
Django, or are people using some other technique to handle configuration
you don't want in the repo?

And is there a special exception type you should throw if it's not being
set, or is there a better way to handle it?


Well worth checking out Two Scoops of Django - it has half a chapter on 
exactly this topic. In summary, the authors say to use environment 
variables and to raise ImproperlyConfigured if they don't work.




Cheers,
Victor

On Thursday, 19 September 2013 15:54:15 UTC+10, Dig wrote:

Hi,

   Do you means some thing like this?

os.environ.get('SOME_VARIABLE', 'default_value')

Regards,
Dig

On Sep 19, 2013 1:37 PM, "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...@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.