Re: "ResourceWarning: unclosed" error using mysql-connector-python

2014-06-12 Thread Zemian Deng
Anyone?

On Tuesday, June 10, 2014 11:26:18 PM UTC-4, Zemian Deng wrote:
>
> Hi there,
>
> I am using mysql-connector-python (1.1.6) with Django (1.6.5) and myapp 
> is working fine. But each SQL call to DB will result the following warning 
> messages:
>
> Exception ignored in:  type=SocketType.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 62622), 
> raddr=('127.0.0.1', 3306)>
>
> ResourceWarning: unclosed  family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=6, 
> laddr=('127.0.0.1', 62622), raddr=('127.0.0.1', 3306)>
>
>
> Has anyone seen this and know a way to resolve it?
> Also, FYI, I am using the following in my settings file.
> DATABASES = {
> 'default': {
>'ENGINE': 'mysql.connector.django',
>'NAME': 'mydb',
>'USER': 'test',
>'PASSWORD': 'test',
> },
> }
>
> Thanks,
> Zemian
>

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


Is anyone using MariaDB for Django on CentOS

2014-06-12 Thread Bill Freeman
I'm having trouble installing mysql-python because the MariaDB installed
libmysqlclient_r.a is "incompatible" (missing dependencies according
to 
http://data-matters.blogspot.com/2013/08/install-mysql-python-with-mariadb.html).
There is rumored to be a fixed package for deb based systems, but neither
yum nor googling finds an RPM for CentOS 6.


Has anyone gotten past this?  (My google-fu is apparently inadequate.)

Bill

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


Re: How do I detect when a related object has been modified?

2014-06-12 Thread Mezzy
I see. I had feared that might be the answer when I was trying to think of 
a way to implement it.

Incrementing the counter was just meant as a quick example not an actual 
use case. Maybe firing off a small function where accuracy can be fudged a 
bit when changes are detected.

Thanks for your response.

On Thursday, June 12, 2014 11:44:35 AM UTC-4, Tom Evans wrote:
>
> On Thu, Jun 12, 2014 at 3:48 PM, Mezzy  
> wrote: 
> > Hello 
> > 
> > How do I detect when related models have changed; If I have models such 
> as 
> > the following: 
> > 
> > .. models.py 
> > class Model1(models.Model): 
> > 
> > field = models.CharField(max_length=255, default="Some value") 
> > 
> > 
> > class Model2(models.Model): 
> > 
> > field = models.CharField(max_length=255, default="Some value") 
> > 
> > 
> > class Model3(models.Model): 
> > 
> > field = models.CharField(max_length=255, default="Some value") 
> > 
> > 
> > class Model4(models.Model): 
> > 
> > one = models.OneToOneField(Model1) 
> > 
> > foreign = models.ForeignKey(Model2) 
> > 
> > many = models.ManyToManyField(Model3) 
> > 
> > counter = models.IntegerField(default=1) 
> > 
> > 
> > 
> > .. test.py 
> > one = Model1.objects.create() 
> > foreign = Model2.objects.create() 
> > many = [Model3.objects.create() for i in xrange(0,5)] 
> > x = Model2.objects.create(one=one, foreign=foreign) 
> > x.many = many 
> > x.save() 
> > 
> > 
> > 
> > 
> > 
> > 
> > Then I perform the following operations: 
> > one.field = "new value" 
> > one.save() 
> > foreign.field = "newer value" 
> > foreign.save() 
> > many[0].field = "newest value" 
> > many[0].save() 
> > 
> > 
> > How do I detect when these objects have changed? Is there a signal for 
> this 
> > type of thing? 
> > For example if I want to increment Model4's counter field every time one 
> of 
> > these objects change, what should I do? 
>
> There isn't such a signal because of the complexity (and 
> impossibility, in some cases) of doing so. 
>
> For instance, if a Model2 object is modified, there is potentially one 
> Model1 instance to signal that a related object has changed, but if a 
> Model3 or Model4 object is modified, potentially all Model1 instances 
> might require to be signalled. 
>
> There are signals for when a model instance itself changes; if you so 
> wish you can hook in to that and add application specific logic to 
> discover which Model1 instances are related to that changed instance, 
> and fire events for each of them. 
>
> Putting a counter on the Model1 is a denormalisation; using signals to 
> keep a denormalisation up to date is fragile, especially when using 
> django signals where there are multiple ways that data could change 
> without a signal firing. 
>
> Cheers 
>
> Tom 
>

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


Re: Django OneToOne field problem

2014-06-12 Thread Max Demars
You will have to do content.link_set to retrieve the Link model related to 
the Content model instance.

See: 
https://docs.djangoproject.com/en/dev/topics/db/queries/#following-relationships-backward

On Thursday, June 12, 2014 2:54:48 PM UTC-4, Satinderpal Singh wrote:
>
> Suppose there are two tables defined in Django models: 
>
> class Link(models.Model): 
> links = models.CharField(max_length=50 ,blank=True) 
>
> and 
>
> class Content(models.Model): 
> link = models.OneToOneField(Link, primary_key=True) 
> title = models.CharField(max_length=50, blank=True) 
> content = models.CharField(max_length=1000, blank=True) 
> footer = models.CharField(max_length=150, blank=True) 
>
> In the above table "Content" the OneToOne field contains the Link.id 
> attribute of the 
> table"Link", but how could i get it as, Link.links. 
>
> -- 
> Satinderpal Singh 
> http://satindergoraya91.blogspot.in/ 
>

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


Django OneToOne field problem

2014-06-12 Thread Satinderpal Singh
Suppose there are two tables defined in Django models:

class Link(models.Model):
links = models.CharField(max_length=50 ,blank=True)

and

class Content(models.Model):
link = models.OneToOneField(Link, primary_key=True)
title = models.CharField(max_length=50, blank=True)
content = models.CharField(max_length=1000, blank=True)
footer = models.CharField(max_length=150, blank=True)

In the above table "Content" the OneToOne field contains the Link.id
attribute of the
table"Link", but how could i get it as, Link.links.

-- 
Satinderpal Singh
http://satindergoraya91.blogspot.in/

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


Combine page content (html) and model instance (json) in ajax response

2014-06-12 Thread Max Demars
I would like my view to return the page content and some parameters that I 
would like to use in the Ext.Ajax.request success function.

views.py

def importFile(request):
form = ImportVectorForm()
html_response = render_to_response("page_content.html", {'form': 
form, 'folder':folder, 
'nodes':nodes},context_instance=RequestContext(request))
if request.POST:
form = ImportVectorForm(request.POST, request.FILES)
if form.is_valid():
## here im dealing with the form...
object = MyObject.objects.create()
html_response = render_to_response("page_content.html", 
{'form': form},context_instance=RequestContext(request))
json_param = serializers.serialize('json', object)
return StreamingHttpResponse(html_response, 
content_type="plain/text")

else:
html_response = render_to_response("page_content.html", 
{'form': form},context_instance=RequestContext(request))

return StreamingHttpResponse(html_response, 
content_type="plain/text")


ajax.js:

  importFileAjax = function(node_id){
Ext.Ajax.request({
  method: "GET",
  form: "importForm",
  url: "/basqui/file/import/" + node_id + "/",
  success: function(r){
  // here I would like to access the model instance 
created properties
  Ext.get('table').update(r.responseText); //this 
update the page content
   }
});
  }

I would like to pass both html_response and json_param to Ajax. The fist to 
update a div and the second to access its properties.

What is the right way of doing that?

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


Re: How to install psycpg2 in virtual enviroment with help easy_install.

2014-06-12 Thread Віталій Лисенко
Linux Mint 15 Olivia


On 12 June 2014 18:48, Wellington Cordeiro  wrote:

> Just out of curiosity what OS are you on?
>
> On Thursday, June 12, 2014 7:48:43 AM UTC-6, Віталій Лисенко wrote:
>
>> Thank you.
>>
>> I am not have more questions. Thank.
>>
>>
>> On 12 June 2014 16:11, Lachlan Musicman  wrote:
>>
>>> Yep, "pip install" should be enough. Pip install is your friend in
>>> virtual environments.
>>>
>>> Jump into your environment ("workon ENV" or
>>> "./path/to/ve/ENV/bin/activate"), and then
>>>
>>> pip install Django postgresql_psycopg2
>>>
>>>
>>>
>>> Is that what you were asking?
>>>
>>>
>>>
>>> On 12 June 2014 22:09, Віталій Лисенко  wrote:
>>> > Hi.
>>> >
>>> > 1. I installed easy_install
>>> > 2. I installed virtual enviroment with help easy_install
>>> > 3. I activated this enviroment
>>> > 4. after this I created django project
>>> > 5. Now I am need create database with help Postgresql:
>>> >
>>> > So, I am need to install backend namely postgresql_psycopg2
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "Django users" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> an
>>> > email to django-users...@googlegroups.com.
>>> > To post to this group, send email to django...@googlegroups.com.
>>>
>>> > Visit this group at http://groups.google.com/group/django-users.
>>> > To view this discussion on the web visit
>>> > https://groups.google.com/d/msgid/django-users/e2cc84df-
>>> 5296-40f7-ad0d-009f64de34ad%40googlegroups.com.
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>
>>> --
>>> The idea is that a beautiful image is frameable. Everything you need
>>> to see is there: It’s everything you want, and it’s very pleasing
>>> because there’s no extra information that you don’t get to see.
>>> Everything’s in a nice package for you. But sublime art is
>>> unframeable: It’s an image or idea that implies that there’s a bigger
>>> image or idea that you can’t see: You’re only getting to look at a
>>> fraction of it, and in that way it’s both beautiful and scary, because
>>> it’s reminding you that there’s more that you don’t have access to.
>>> It’s now sort of left the piece itself and it’s become your own
>>> invention, so it’s personal as well as being scary as well as being
>>> beautiful, which is what I really like about art like that.
>>> 
>>> ---
>>> Adventure Time http://theholenearthecenteroftheworld.com/
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>> topic/django-users/W6T_BoWks1A/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>>
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/CAGBeqiPvMxJktE58H1TaYGkdnbCWi
>>> qhp3ogPt2i%3DbpYV1gRkZw%40mail.gmail.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Best regards Vitaly Lisenko from village Markove (Ukraine)
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/W6T_BoWks1A/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0db81e1c-7623-4ba4-8e2c-d44eaac59cf1%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Best regards Vitaly Lisenko from village Markove (Ukraine)

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


Re: How to install psycpg2 in virtual enviroment with help easy_install.

2014-06-12 Thread Wellington Cordeiro
Just out of curiosity what OS are you on? 

On Thursday, June 12, 2014 7:48:43 AM UTC-6, Віталій Лисенко wrote:
>
> Thank you.
>
> I am not have more questions. Thank.
>
>
> On 12 June 2014 16:11, Lachlan Musicman  
> wrote:
>
>> Yep, "pip install" should be enough. Pip install is your friend in
>> virtual environments.
>>
>> Jump into your environment ("workon ENV" or
>> "./path/to/ve/ENV/bin/activate"), and then
>>
>> pip install Django postgresql_psycopg2
>>
>>
>>
>> Is that what you were asking?
>>
>>
>>
>> On 12 June 2014 22:09, Віталій Лисенко  
>> wrote:
>> > Hi.
>> >
>> > 1. I installed easy_install
>> > 2. I installed virtual enviroment with help easy_install
>> > 3. I activated this enviroment
>> > 4. after this I created django project
>> > 5. Now I am need create database with help Postgresql:
>> >
>> > So, I am need to install backend namely postgresql_psycopg2
>> >
>> > --
>> > You received this message because you are subscribed to the Google 
>> Groups
>> > "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an
>> > email to django-users...@googlegroups.com .
>> > To post to this group, send email to django...@googlegroups.com 
>> .
>> > Visit this group at http://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> > 
>> https://groups.google.com/d/msgid/django-users/e2cc84df-5296-40f7-ad0d-009f64de34ad%40googlegroups.com
>> .
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> The idea is that a beautiful image is frameable. Everything you need
>> to see is there: It’s everything you want, and it’s very pleasing
>> because there’s no extra information that you don’t get to see.
>> Everything’s in a nice package for you. But sublime art is
>> unframeable: It’s an image or idea that implies that there’s a bigger
>> image or idea that you can’t see: You’re only getting to look at a
>> fraction of it, and in that way it’s both beautiful and scary, because
>> it’s reminding you that there’s more that you don’t have access to.
>> It’s now sort of left the piece itself and it’s become your own
>> invention, so it’s personal as well as being scary as well as being
>> beautiful, which is what I really like about art like that.
>>
>> ---
>> Adventure Time http://theholenearthecenteroftheworld.com/
>>
>> --
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/django-users/W6T_BoWks1A/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAGBeqiPvMxJktE58H1TaYGkdnbCWiqhp3ogPt2i%3DbpYV1gRkZw%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Best regards Vitaly Lisenko from village Markove (Ukraine)
>  

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


Re: How do I detect when a related object has been modified?

2014-06-12 Thread Tom Evans
On Thu, Jun 12, 2014 at 3:48 PM, Mezzy  wrote:
> Hello
>
> How do I detect when related models have changed; If I have models such as
> the following:
>
> .. models.py
> class Model1(models.Model):
>
> field = models.CharField(max_length=255, default="Some value")
>
>
> class Model2(models.Model):
>
> field = models.CharField(max_length=255, default="Some value")
>
>
> class Model3(models.Model):
>
> field = models.CharField(max_length=255, default="Some value")
>
>
> class Model4(models.Model):
>
> one = models.OneToOneField(Model1)
>
> foreign = models.ForeignKey(Model2)
>
> many = models.ManyToManyField(Model3)
>
> counter = models.IntegerField(default=1)
>
>
>
> .. test.py
> one = Model1.objects.create()
> foreign = Model2.objects.create()
> many = [Model3.objects.create() for i in xrange(0,5)]
> x = Model2.objects.create(one=one, foreign=foreign)
> x.many = many
> x.save()
>
>
>
>
>
>
> Then I perform the following operations:
> one.field = "new value"
> one.save()
> foreign.field = "newer value"
> foreign.save()
> many[0].field = "newest value"
> many[0].save()
>
>
> How do I detect when these objects have changed? Is there a signal for this
> type of thing?
> For example if I want to increment Model4's counter field every time one of
> these objects change, what should I do?

There isn't such a signal because of the complexity (and
impossibility, in some cases) of doing so.

For instance, if a Model2 object is modified, there is potentially one
Model1 instance to signal that a related object has changed, but if a
Model3 or Model4 object is modified, potentially all Model1 instances
might require to be signalled.

There are signals for when a model instance itself changes; if you so
wish you can hook in to that and add application specific logic to
discover which Model1 instances are related to that changed instance,
and fire events for each of them.

Putting a counter on the Model1 is a denormalisation; using signals to
keep a denormalisation up to date is fragile, especially when using
django signals where there are multiple ways that data could change
without a signal firing.

Cheers

Tom

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


How do I detect when a related object has been modified?

2014-06-12 Thread Mezzy
Hello

How do I detect when related models have changed; If I have models such as 
the following:

.. models.py
class Model1(models.Model):

field = models.CharField(max_length=255, default="Some value")


class Model2(models.Model):

field = models.CharField(max_length=255, default="Some value")

 
class Model3(models.Model):

field = models.CharField(max_length=255, default="Some value")


class Model4(models.Model):

one = models.OneToOneField(Model1)

foreign = models.ForeignKey(Model2)

many = models.ManyToManyField(Model3)

counter = models.IntegerField(default=1) 

 

.. test.py
one = Model1.objects.create()
foreign = Model2.objects.create()
many = [Model3.objects.create() for i in xrange(0,5)]
x = Model2.objects.create(one=one, foreign=foreign)
x.many = many
x.save()






Then I perform the following operations:
one.field = "new value"
one.save()
foreign.field = "newer value"
foreign.save()
many[0].field = "newest value"
many[0].save()


How do I detect when these objects have changed? Is there a signal for this 
type of thing?
For example if I want to increment Model4's counter field every time one of 
these objects change, what should I do?


Thanks for any guidance.

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


Security release for Django REST framework: 2.3.14.

2014-06-12 Thread Tom Christie
Cross-posting this 
 
for the benefit of any Django REST framework users who aren't on the REST 
framework mailing list...

The 2.3.14 version of REST framework has just been released to PyPI.

Most importantly this includes a serious security fix related to the 
browsable API, and all users are advised to upgrade as soon as possible.

When generating the login and logout links on the browsable API the request 
path is included as part of the URL, allowing the application to redirect 
back to the original URL after performing the login/logout.  The request 
path here was not being escaped, allowing an attacker to create a link that 
when clicked by the user would run javascript in the context of the 
browsable API.

This exploit appears to work against the latest version of Firefox, but not 
against the latest versions of Chrome, Safari and Internet Explorer.

In summary:

* Users of the current version of firefox, and of some older versions of 
other browsers may be vulnerable.
* The attack requires the user to follow a link that has been generated by 
the attacker.
* The vulnerability requires the browsable API to be enabled, and the user 
to be authenticated in the browser.

Many thanks to the reporter of the issue, Dan Peled (BugSec/CyberSpear).

As always if you believe you have found a security issue with REST 
framework, please raise the issue on the private security mailing list: 
rest-framework-secur...@googlegroups.com

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


django-allauth--"cannot import name SignupForm"

2014-06-12 Thread willyhakim
Good morning the good people of django.


I customized django-allauth signup page with following this advice 

 
from the author himself.
https://stackoverflow.com/questions/12303478/how-to-customize-user-profile-when-using-django-allauth

but I keep getting an error: Error importing form class myusers.forms: 
"cannot import name SignupForm"

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


Re: How to install psycpg2 in virtual enviroment with help easy_install.

2014-06-12 Thread Віталій Лисенко
Thank you.

I am not have more questions. Thank.


On 12 June 2014 16:11, Lachlan Musicman  wrote:

> Yep, "pip install" should be enough. Pip install is your friend in
> virtual environments.
>
> Jump into your environment ("workon ENV" or
> "./path/to/ve/ENV/bin/activate"), and then
>
> pip install Django postgresql_psycopg2
>
>
>
> Is that what you were asking?
>
>
>
> On 12 June 2014 22:09, Віталій Лисенко  wrote:
> > Hi.
> >
> > 1. I installed easy_install
> > 2. I installed virtual enviroment with help easy_install
> > 3. I activated this enviroment
> > 4. after this I created django project
> > 5. Now I am need create database with help Postgresql:
> >
> > So, I am need to install backend namely postgresql_psycopg2
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/e2cc84df-5296-40f7-ad0d-009f64de34ad%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> The idea is that a beautiful image is frameable. Everything you need
> to see is there: It’s everything you want, and it’s very pleasing
> because there’s no extra information that you don’t get to see.
> Everything’s in a nice package for you. But sublime art is
> unframeable: It’s an image or idea that implies that there’s a bigger
> image or idea that you can’t see: You’re only getting to look at a
> fraction of it, and in that way it’s both beautiful and scary, because
> it’s reminding you that there’s more that you don’t have access to.
> It’s now sort of left the piece itself and it’s become your own
> invention, so it’s personal as well as being scary as well as being
> beautiful, which is what I really like about art like that.
>
> ---
> Adventure Time http://theholenearthecenteroftheworld.com/
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/W6T_BoWks1A/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGBeqiPvMxJktE58H1TaYGkdnbCWiqhp3ogPt2i%3DbpYV1gRkZw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Best regards Vitaly Lisenko from village Markove (Ukraine)

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


Re: Admin site doesn't work

2014-06-12 Thread Glen J
Running on linux mint.  I'll keep plugging away and see what I can find.

On Thursday, June 12, 2014 3:56:08 AM UTC-4, Sanjay Bhangar wrote:
>
> Hey Glen, 
>
> Hm, whatever it is, is not apparent to me, sorry :/. The only thing I 
> can think of is possibly inconsistent indentation. Some comments / 
> questions inline -- 
>
> On Thu, Jun 12, 2014 at 3:39 AM, Glen J  
> wrote: 
> > 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('', 
> > # Examples: 
> > # url(r'^$', 'mysite.views.home', name='home'), 
> > # url(r'^mysite/', include('mysite.foo.urls')), 
> > 
> > # Uncomment the admin/doc line below to enable admin documentation: 
> > # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), 
> > 
> > # Uncomment the next line to enable the admin: 
> >  url(r'^admin/', include(admin.site.urls)), 
> > ) 
> > 
> > 
> > settings.py: 
> > # Django settings for mysite project. 
> > 
> > DEBUG = True 
> > TEMPLATE_DEBUG = DEBUG 
> > 
> > ADMINS = ( 
> > # ('Your Name', 'your_...@example.com '), 
> > ) 
> > 
> > MANAGERS = ADMINS 
> > 
> > DATABASES = { 
> > 'default': { 
> > 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 
> > 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 
> > 'NAME': 'mysite',  # Or path to database 
> file if 
> > using sqlite3. 
> > # The following settings are not used with sqlite3: 
> > 'USER': 'glen', 
> > 'PASSWORD': 'P0rchl1ght!', 
> > 'HOST': '192.168.122.120',  # Empty for 
> > localhost through domain sockets or '127.0.0.1' for localhost through 
> TCP. 
> > 'PORT': '5432',  # Set to empty string for 
> > default. 
> > } 
> > } 
> > 
>
> Please do not post any sort of passwords on a public mailing list - 
> even though I realize this is for a local database. Please take the 
> time to quickly sanitize your pastes and remove potentially sensitive 
> information. 
>
> > # Hosts/domain names that are valid for this site; required if DEBUG is 
> > False 
> > # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts 
> > ALLOWED_HOSTS = [] 
> > 
> > # Local time zone for this installation. Choices can be found here: 
> > # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name 
> > # although not all choices may be available on all operating systems. 
> > # In a Windows environment this must be set to your system time zone. 
> > TIME_ZONE = 'America/Chicago' 
> > 
> > # Language code for this installation. All choices can be found here: 
> > # http://www.i18nguy.com/unicode/language-identifiers.html 
> > LANGUAGE_CODE = 'en-us' 
> > 
> > SITE_ID = 1 
> > 
> > # If you set this to False, Django will make some optimizations so as 
> not 
> > # to load the internationalization machinery. 
> > USE_I18N = True 
> > 
> > # If you set this to False, Django will not format dates, numbers and 
> > # calendars according to the current locale. 
> > USE_L10N = True 
> > 
> > # If you set this to False, Django will not use timezone-aware 
> datetimes. 
> > USE_TZ = True 
> > 
> > # Absolute filesystem path to the directory that will hold user-uploaded 
> > files. 
> > # Example: "/var/www/example.com/media/" 
> > MEDIA_ROOT = '' 
> > 
> > # URL that handles the media served from MEDIA_ROOT. Make sure to use a 
> > # trailing slash. 
> > # Examples: "http://example.com/media/;, "http://media.example.com/; 
> > MEDIA_URL = '' 
> > 
> > # Absolute path to the directory static files should be collected to. 
> > # Don't put anything in this directory yourself; store your static files 
> > # in apps' "static/" subdirectories and in STATICFILES_DIRS. 
> > # Example: "/var/www/example.com/static/" 
> > STATIC_ROOT = '' 
> > 
> > # URL prefix for static files. 
> > # Example: "http://example.com/static/;, "http://static.example.com/; 
> > STATIC_URL = '/static/' 
> > 
> > # Additional locations of static files 
> > STATICFILES_DIRS = ( 
> > # Put strings here, like "/home/html/static" or 
> "C:/www/django/static". 
> > # Always use forward slashes, even on Windows. 
> > # Don't forget to use absolute paths, not relative paths. 
> > ) 
> > 
> > # List of finder classes that know how to find static files in 
> > # various locations. 
> > STATICFILES_FINDERS = ( 
> > 'django.contrib.staticfiles.finders.FileSystemFinder', 
> > 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 
> > #'django.contrib.staticfiles.finders.DefaultStorageFinder', 
> > ) 
> > 
> > # Make this unique, and don't share it with anybody. 
> > SECRET_KEY = 'vp4@9d))k610$v1me&*0)2)*06j@aop=u3' 
> > 
>
> Since you have posted this on a public mailing list, please make sure 
> you change it before pushing to any production 

Re: How to install psycpg2 in virtual enviroment with help easy_install.

2014-06-12 Thread Lachlan Musicman
Yep, "pip install" should be enough. Pip install is your friend in
virtual environments.

Jump into your environment ("workon ENV" or
"./path/to/ve/ENV/bin/activate"), and then

pip install Django postgresql_psycopg2



Is that what you were asking?



On 12 June 2014 22:09, Віталій Лисенко  wrote:
> Hi.
>
> 1. I installed easy_install
> 2. I installed virtual enviroment with help easy_install
> 3. I activated this enviroment
> 4. after this I created django project
> 5. Now I am need create database with help Postgresql:
>
> So, I am need to install backend namely postgresql_psycopg2
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e2cc84df-5296-40f7-ad0d-009f64de34ad%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
The idea is that a beautiful image is frameable. Everything you need
to see is there: It’s everything you want, and it’s very pleasing
because there’s no extra information that you don’t get to see.
Everything’s in a nice package for you. But sublime art is
unframeable: It’s an image or idea that implies that there’s a bigger
image or idea that you can’t see: You’re only getting to look at a
fraction of it, and in that way it’s both beautiful and scary, because
it’s reminding you that there’s more that you don’t have access to.
It’s now sort of left the piece itself and it’s become your own
invention, so it’s personal as well as being scary as well as being
beautiful, which is what I really like about art like that.
---
Adventure Time http://theholenearthecenteroftheworld.com/

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


How to install psycpg2 in virtual enviroment with help easy_install.

2014-06-12 Thread Віталій Лисенко
Hi.

1. I installed easy_install
2. I installed virtual enviroment with help easy_install
3. I activated this enviroment
4. after this I created django project 
5. Now I am need create database with help Postgresql:

So, I am need to install backend namely postgresql_psycopg2 

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


Re: How to install psycopg2 using Pip?

2014-06-12 Thread Sugatang Itlog
Hi - When installing psycopg2 and errors like ...

Error: pg_config executable not found

do the following 

[root@localhost ~]# which -a pg_config
/usr/bin/which: no pg_config in 
(/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

[root@localhost ~]# find / -iname 'pg_config' 2>/dev/null
/usr/pgsql-9.3/bin/pg_config

[root@localhost ~]# ln -s /usr/pgsql-9.3/bin/pg_config /usr/bin/pg_config

Then install psycopg2 via pip. If still got errors install the postgresql 
devel then do the above steps again.

Thanks.
SGTItlog


On Thursday, March 24, 2011 10:01:43 AM UTC-5, Andre Lopes wrote:
>
> Hi,
>
> This question is not directly related with Django, but with Python.
>
> I have installed "virtualenv" to have a virtual environment. Now I
> need to instal "psycopg2" in my virtual environment, but I have not
> successfully installed.
>
> My steps:
>
> [quote]
> pip install
>
> http://pypi.python.org/packages/source/p/psycopg2/psycopg2-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
> [/quote]
>
> And I got this message with an error:
>
> [quote]
> Downloading/unpacking
> http://pypi.python.org/packages/source/p/psycopg2/psycopg2
> -2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
>   Downloading psycopg2-2.4.tar.gz (607Kb): 607Kb downloaded
>   Running setup.py egg_info for package from
> http://pypi.python.org/packages/sou
>
> 
> rce/p/psycopg2/psycopg2-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
> Error: pg_config executable not found.
>
> Please add the directory containing pg_config to the PATH
> or specify the full executable path with the option:
>
> python setup.py build_ext --pg-config 
> /path/to/pg_config build ...
>
> or with the pg_config option in 'setup.cfg'.
> Complete output from command python setup.py egg_info:
> running egg_info
>
> creating pip-egg-info\psycopg2.egg-info
>
> writing pip-egg-info\psycopg2.egg-info\PKG-INFO
>
> writing top-level names to 
> pip-egg-info\psycopg2.egg-info\top_level.txt
>
> writing dependency_links to 
> pip-egg-info\psycopg2.egg-info\dependency_links.txt
>
> writing manifest file 'pip-egg-info\psycopg2.egg-info\SOURCES.txt'
>
> warning: manifest_maker: standard file '-c' not found
>
> Error: pg_config executable not found.
>
> Please add the directory containing pg_config to the PATH
>
> or specify the full executable path with the option:
>
> python setup.py build_ext --pg-config /path/to/pg_config 
> build ...
>
> or with the pg_config option in 'setup.cfg'.
>
> 
> Command python setup.py egg_info failed with error code 1
> Storing complete log in C:\Documents and 
> Settings\anlopes\Application
> Data\pip\p
> ip.log
> [/quote]
>
> My question:
>
> How can I tell to "pip" where is my pg_config?
>
> Best Regards,
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7eb7c3a5-8d1b-4b2e-9ed4-277538b0623a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to install psycopg2 using Pip?

2014-06-12 Thread Sugatang Itlog
Hi - If you get errors like this when install via pip install psycopg2 ...

Error: pg_config executable not found.

do the the following ...

[root@localhost ~]# which -a pg_config
/usr/bin/which: no pg_config in 
(/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

[root@localhost ~]# find / -iname 'pg_config' 2>/dev/null
/usr/pgsql-9.3/bin/pg_config

[root@localhost ~]# ln -s /usr/pgsql-9.3/bin/pg_config /usr/bin/pg_config

Then, try to install it again via pip. If still has errors install the 
postgresql devel, then do the above steps

Cheers,
SGTItlog

On Thursday, March 24, 2011 10:01:43 AM UTC-5, Andre Lopes wrote:
>
> Hi,
>
> This question is not directly related with Django, but with Python.
>
> I have installed "virtualenv" to have a virtual environment. Now I
> need to instal "psycopg2" in my virtual environment, but I have not
> successfully installed.
>
> My steps:
>
> [quote]
> pip install
>
> http://pypi.python.org/packages/source/p/psycopg2/psycopg2-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
> [/quote]
>
> And I got this message with an error:
>
> [quote]
> Downloading/unpacking
> http://pypi.python.org/packages/source/p/psycopg2/psycopg2
> -2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
>   Downloading psycopg2-2.4.tar.gz (607Kb): 607Kb downloaded
>   Running setup.py egg_info for package from
> http://pypi.python.org/packages/sou
>
> 
> rce/p/psycopg2/psycopg2-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
> Error: pg_config executable not found.
>
> Please add the directory containing pg_config to the PATH
> or specify the full executable path with the option:
>
> python setup.py build_ext --pg-config 
> /path/to/pg_config build ...
>
> or with the pg_config option in 'setup.cfg'.
> Complete output from command python setup.py egg_info:
> running egg_info
>
> creating pip-egg-info\psycopg2.egg-info
>
> writing pip-egg-info\psycopg2.egg-info\PKG-INFO
>
> writing top-level names to 
> pip-egg-info\psycopg2.egg-info\top_level.txt
>
> writing dependency_links to 
> pip-egg-info\psycopg2.egg-info\dependency_links.txt
>
> writing manifest file 'pip-egg-info\psycopg2.egg-info\SOURCES.txt'
>
> warning: manifest_maker: standard file '-c' not found
>
> Error: pg_config executable not found.
>
> Please add the directory containing pg_config to the PATH
>
> or specify the full executable path with the option:
>
> python setup.py build_ext --pg-config /path/to/pg_config 
> build ...
>
> or with the pg_config option in 'setup.cfg'.
>
> 
> Command python setup.py egg_info failed with error code 1
> Storing complete log in C:\Documents and 
> Settings\anlopes\Application
> Data\pip\p
> ip.log
> [/quote]
>
> My question:
>
> How can I tell to "pip" where is my pg_config?
>
> Best Regards,
>
>

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


Re: Admin site doesn't work

2014-06-12 Thread Sanjay Bhangar
Hey Glen,

Hm, whatever it is, is not apparent to me, sorry :/. The only thing I
can think of is possibly inconsistent indentation. Some comments /
questions inline --

On Thu, Jun 12, 2014 at 3:39 AM, Glen J  wrote:
> 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('',
> # Examples:
> # url(r'^$', 'mysite.views.home', name='home'),
> # url(r'^mysite/', include('mysite.foo.urls')),
>
> # Uncomment the admin/doc line below to enable admin documentation:
> # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
> # Uncomment the next line to enable the admin:
>  url(r'^admin/', include(admin.site.urls)),
> )
>
>
> settings.py:
> # Django settings for mysite project.
>
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG
>
> ADMINS = (
> # ('Your Name', 'your_em...@example.com'),
> )
>
> MANAGERS = ADMINS
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add
> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'mysite',  # Or path to database file if
> using sqlite3.
> # The following settings are not used with sqlite3:
> 'USER': 'glen',
> 'PASSWORD': 'P0rchl1ght!',
> 'HOST': '192.168.122.120',  # Empty for
> localhost through domain sockets or '127.0.0.1' for localhost through TCP.
> 'PORT': '5432',  # Set to empty string for
> default.
> }
> }
>

Please do not post any sort of passwords on a public mailing list -
even though I realize this is for a local database. Please take the
time to quickly sanitize your pastes and remove potentially sensitive
information.

> # Hosts/domain names that are valid for this site; required if DEBUG is
> False
> # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
> ALLOWED_HOSTS = []
>
> # Local time zone for this installation. Choices can be found here:
> # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
> # although not all choices may be available on all operating systems.
> # In a Windows environment this must be set to your system time zone.
> TIME_ZONE = 'America/Chicago'
>
> # Language code for this installation. All choices can be found here:
> # http://www.i18nguy.com/unicode/language-identifiers.html
> LANGUAGE_CODE = 'en-us'
>
> SITE_ID = 1
>
> # If you set this to False, Django will make some optimizations so as not
> # to load the internationalization machinery.
> USE_I18N = True
>
> # If you set this to False, Django will not format dates, numbers and
> # calendars according to the current locale.
> USE_L10N = True
>
> # If you set this to False, Django will not use timezone-aware datetimes.
> USE_TZ = True
>
> # Absolute filesystem path to the directory that will hold user-uploaded
> files.
> # Example: "/var/www/example.com/media/"
> MEDIA_ROOT = ''
>
> # URL that handles the media served from MEDIA_ROOT. Make sure to use a
> # trailing slash.
> # Examples: "http://example.com/media/;, "http://media.example.com/;
> MEDIA_URL = ''
>
> # Absolute path to the directory static files should be collected to.
> # Don't put anything in this directory yourself; store your static files
> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
> # Example: "/var/www/example.com/static/"
> STATIC_ROOT = ''
>
> # URL prefix for static files.
> # Example: "http://example.com/static/;, "http://static.example.com/;
> STATIC_URL = '/static/'
>
> # Additional locations of static files
> STATICFILES_DIRS = (
> # Put strings here, like "/home/html/static" or "C:/www/django/static".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> )
>
> # List of finder classes that know how to find static files in
> # various locations.
> STATICFILES_FINDERS = (
> 'django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> #'django.contrib.staticfiles.finders.DefaultStorageFinder',
> )
>
> # Make this unique, and don't share it with anybody.
> SECRET_KEY = 'vp4@9d))k610$v1me&*0)2)*06j@aop=u3'
>

Since you have posted this on a public mailing list, please make sure
you change it before pushing to any production environment.

> # List of callables that know how to import templates from various sources.
> TEMPLATE_LOADERS = (
> 'django.template.loaders.filesystem.Loader',
> 'django.template.loaders.app_directories.Loader',
> # 'django.template.loaders.eggs.Loader',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 

Re: How to install psycopg2 using Pip?

2014-06-12 Thread Sugatang Itlog
Hi - If you get errors like this when install via pip install psycopg2 ...

Error: pg_config executable not found.

do the the following ...

[root@localhost ~]# which -a adrian
/usr/bin/which: no pg_config in 
(/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

[root@localhost ~]# find / -iname 'pg_config' 2>/dev/null
/usr/pgsql-9.3/bin/pg_config

[root@localhost ~]# ln -s /usr/pgsql-9.3/bin/pg_config /usr/bin/pg_config

Then, try to install it again via pip. If still has errors install the 
postgresql devel, then do the above steps

Cheers,
SGTItlog

On Thursday, March 24, 2011 10:01:43 AM UTC-5, Andre Lopes wrote:
>
> Hi,
>
> This question is not directly related with Django, but with Python.
>
> I have installed "virtualenv" to have a virtual environment. Now I
> need to instal "psycopg2" in my virtual environment, but I have not
> successfully installed.
>
> My steps:
>
> [quote]
> pip install
>
> http://pypi.python.org/packages/source/p/psycopg2/psycopg2-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
> [/quote]
>
> And I got this message with an error:
>
> [quote]
> Downloading/unpacking
> http://pypi.python.org/packages/source/p/psycopg2/psycopg2
> -2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
>   Downloading psycopg2-2.4.tar.gz (607Kb): 607Kb downloaded
>   Running setup.py egg_info for package from
> http://pypi.python.org/packages/sou
>
> 
> rce/p/psycopg2/psycopg2-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
> Error: pg_config executable not found.
>
> Please add the directory containing pg_config to the PATH
> or specify the full executable path with the option:
>
> python setup.py build_ext --pg-config 
> /path/to/pg_config build ...
>
> or with the pg_config option in 'setup.cfg'.
> Complete output from command python setup.py egg_info:
> running egg_info
>
> creating pip-egg-info\psycopg2.egg-info
>
> writing pip-egg-info\psycopg2.egg-info\PKG-INFO
>
> writing top-level names to 
> pip-egg-info\psycopg2.egg-info\top_level.txt
>
> writing dependency_links to 
> pip-egg-info\psycopg2.egg-info\dependency_links.txt
>
> writing manifest file 'pip-egg-info\psycopg2.egg-info\SOURCES.txt'
>
> warning: manifest_maker: standard file '-c' not found
>
> Error: pg_config executable not found.
>
> Please add the directory containing pg_config to the PATH
>
> or specify the full executable path with the option:
>
> python setup.py build_ext --pg-config /path/to/pg_config 
> build ...
>
> or with the pg_config option in 'setup.cfg'.
>
> 
> Command python setup.py egg_info failed with error code 1
> Storing complete log in C:\Documents and 
> Settings\anlopes\Application
> Data\pip\p
> ip.log
> [/quote]
>
> My question:
>
> How can I tell to "pip" where is my pg_config?
>
> Best Regards,
>
>

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


Re: Massive import in Django database

2014-06-12 Thread Erik Cederstrand
Den 11/06/2014 kl. 15.14 skrev John Carlo :

> Hello everybody,
> 
> I've fallen in love with Django two years ago and I've been using it for my 
> job projects. In the past I found very useful information in this group, so a 
> big thank you guys!
> 
> I have a little doubt.
> I have to import in Django db (sqlite for local development, mySql on the 
> server) about 1.000.000 xml documents.
> 
> The model class is the following:
> 
> class Doc(models.Model):
> doc_code =  models.CharField(max_length=20, unique=True, 
> primary_key=True, db_index = True) 
> doc_text = models.TextField(null=True, blank=True) 
> related_doc= models.ManyToManyField('self', null=True, blank=True, 
> db_index = True) 
> 
> From what I know bulk insertion is not possibile because I have a 
> ManyToManyField relation.

Actually, you *can* bulk insert. You just have to extract the m2m relation into 
an intermediate model 
(https://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships).
 Bulk insert Doc instances first, then the related_doc relations. But if it's a 
one-time import job, then just start it Friday afternoon and skip the extra 
complexity.

Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4CFD77B4-D577-493B-B6E7-01219F5CF23D%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.