Monday, February 28, 2011

Re: Collaborative text editor with Django

@piotr zalewa:
jsFiddle is of course a nice
Is jsFiddle open source?? I couldn't find its source anywhere.
http://www.facebook.com/topic.php?uid=183790024998&topic=14241

So, friends,
This etherpad is in comet (java) and can anyone tell how to integrate etherpad, keeping it as it is, with other django apps???
Some iFrame ideas??? Please file-in your views.
Is that a really bad idea???

regards,
Anoop

atm
___
Life is short, Live it hard.




On 26 February 2011 15:10, Piotr Zalewa <zaloon@gmail.com> wrote:

Not all code is a part of bigger infrastructure, but here it is: pair
programming in jsFiddle (which is a django project).

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

django, postgresql and eliminating duplicates

hi,

I have a model which allowed duplicates to be entered. Subsequently it
was decided to add a unique_together constraint and make the necessary
change in the db structure. Postgresql of course will not make a
unique_together constraint if there are duplicates. Since this is one
off, I wrote a script to eliminate duplicates, the script worked, but
psql is still not accepting the constraint saying there *are*
duplicates. The script is here:

def getdups():
mems = Member.objects.all()

for mem in mems:

dte = datetime.date(2009,1,1)
tod = datetime.datetime.today()
while ((dte.year != tod.year) and (dte.month != tod.month+1)):
if
Scoringrecord.objects.filter(member=mem,scoredate=dte).count() > 1:
for x in
Scoringrecord.objects.filter(member=mem,scoredate=dte)[1:]:
x.delete()
dte = dte+datetime.timedelta(days=1)
return 1
--
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: limit number of rows in change_list

On Feb 28, 1:55 pm, bigfudge <benwhal...@gmail.com> wrote:
> How do I limit the number of rows displayed by default in a
> change_list?
>
> Many thanks,

In the admin.py file, under the class whose number of rows you want to
display - use "list_per_page"

class MyModelAdmin(admin.ModelAdmin):
list_per_page = 10

There is no "global" default that I have been able to find. I simply
set a constant in the admin.py file (say DEFAULT_ROWS = 12) and then
in each class I use:
list_per_page = DEFAULT_ROWS

D.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Accessing foreign key fields

class Article(models.Model):
author = models.ForeignKey(Author)
title = models.CharField(max_length = 100)

(assume an article can have only one author)

article = Article.objects.get(title="Django is awesome)

if I need only author id, I can access author id as 1)
article.author_id or 2) article.author.id

I prefer first article.author_id as it requires less db lookup and
hence better performance.

Any reason to use 2nd way over 1st.

( I understand this approach only works for id and not for say author
name)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Model Question

I'm not sure about your first question; I've never tried overriding a field in a subclass.

For your second question are you trying to check on the whole query set, or an individual model instance?

If you're checking on an individual model instance, you can use hasattr() like:

if hasattr(instance, 'field_name'):
# do stuff

Otherwise, the way you specified it is pretty much the only way I know how to do it. I made it a method on my model that looks like the following:

def get_field_names(self):
return [field.name for field in ModelName._meta.fields]

You would call it by instantiating a 'blank' instance of the model:

fields = ModelName().get_field_names()

On Feb 25, 2011, at 12:11 PM, Noah Nordrum wrote:

> I'm trying to cram the ORM into an existing schema and have an issue I
> can't seem to get around.
>
> I have a number of tables with a timestamp column, but the column name
> is inconsistent. I would like to put the timestamp field in an
> abstract superclass, but I can't seem to figure out how to override
> the column name in the subclass. Can I do this?
>
> Also, is there a better way to check for existence of a field in a
> models.Manager method than the following:
>
> def filteredResults(self):
> qs = super(MyManager, self).get_query_set()
> for field in qs.model._meta.fields:
>
> It works, but not sure how hacky this is...
>
> New to django and python (from primarily Java recently).
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Python/Django AMQP?

+! for Celery, though I haven't used it with django-celery yet.  Soon will, though.

On Feb 24, 2011, at 11:58 AM, Brian Bouterse wrote:

+1 for Celery and django-celery.  I use them also.

On Thu, Feb 24, 2011 at 9:07 AM, Shawn Milochik <shawn@milochik.com> wrote:
+1 on Celery and django-celery. I use them both.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.




--
Brian Bouterse
ITng Services

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Python/Django position in King of Prussia, PA, US

Hi everyone. I thought I'd check in with my "home group" before I post
this up on Dice. Any locals?

Shawn


Python/Django Developer

Greenphire is a growing company in King of Prussia, PA. We are looking
for a bright developer to join us in our quest for truth, justice, and
the Pythonic way. We wear jeans. We write code. If you join us, you
will write production code that will be used by real people and help
them to do their jobs better.

Necessary habits:

Love coding in Python ;o)

Pragmatism; must be able to deliver, first and foremost.
When in a pinch, get the job done instead of getting it perfect.

Desirable habits:

Read programmers' blogs

Attend conferences or user group meetings

Participate in a mailing list for a technology you love

Share code on github or bitbucket

Enjoy keeping up with developments in the Python and Django world

If this sounds like a dream opportunity, e-mail me your resume and cover
letter and let's get the conversation started.

shawn.milochik@greenphire.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django+ oracle, working with apache(mod_python, wsgi) and in runserver, ora-03114 in fastcgi

On Feb 28, 10:04 am, lipt0n <michal.lipin...@gmail.com> wrote:
> Hi
> my application works fine in apache as mod_python and wsgi, also work
> great when I run manage.py runserver
> but I have to move it on nginx.
>
> so I run it by 'python2.6 manage.py runfcgi host=127.0.0.1 port=9001 --
> settings=settings'
> and it works fine until it have to connect to the database (oracle in
> my situation) and i get " Unhandled Exception",
> when I checked logs its what I found :
> "
> OperationalError: ORA-03114: not connected to ORACLE" while reading
> response header from upstream, client: 192.168.1.105, server:
> localhost, request: "POST / HTTP/1.1", upstream: "fastcgi://
> 127.0.0.1:9001", host: "192.168.1.50", referrer: "http://
> 192.168.1.50/"
> "
>
> ORACLE enviroment vars are set correctly, what can I do to fix this?

Could you post the full traceback? That may be helpful in figuring
out what is happening. Also, what versions of Django, Oracle, and
cx_Oracle are you using?

Thanks,
Ian

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Number of Django powered sites?

I've found that using "django tutorial" and "django documentation" in
google insights/trends does a pretty good job of filtering out the
namespace noise. You can also append tutorial or documentation to the
names of other frameworks to get an idea of relative trends.

Ted

On Feb 25, 9:10 pm, Russell Keith-Magee <russ...@keith-magee.com>
wrote:
> On Sat, Feb 26, 2011 at 6:49 AM, Adrian Andreias <adi.andre...@gmail.com> wrote:
> > Hello,
>
> > I'm looking for some global statistics like:
> > - number of django powered web sites
> > - number of python powered sites
> > - web framework popularity index
> > - number of django developers
>
> > I know it's the most popular py web framework, I'm just looking for
> > numbers, absolute or relative.
>
> > I'm already a Django developer, so it's not about choosing a
> > framework, I just need numbers for a research.
>
> I'd like these number too :-)
>
> Seriously -- this is something that's really hard to give concrete
> numbers for, because Django doesn't require any specific registration
> process, and there's no 'telltale sign' that can be used to
> automatically identify a Django site when it's in the wild.
>
> It's an imprecise science, but here's a few suggestions for ways you
> can get numbers that reflect the size of the Django audience:
>
>  * Number of subscribers to django-dev and django-users mailing lists.
> However, these numbers aren't comprehensive -- almost everyone I know
> that is using Django professionally *isn't* on these mailing lists.
>
>  * Number of job ads mentioning Django.
>
>  * Alexa numbers djangoproject.com. Inaccurate an incomplete, but
> easily available.
>
>  * Google trend numbers for Django. Problematic because "django" also
> describes a Jazz musician, an Italian spaghetti western movie, and a
> professional pool player (amongst others).
>
> The other approach that's worth looking into: rather than looking for
> specific numbers, look for case studies that demonstrate large
> established companies that are using Django. We've got a
> work-in-progress list of some such success stories on our wiki [1];
> we're hoping to turn this in a more useful resource.
>
> [1]http://code.djangoproject.com/wiki/CaseStudyLeads
>
> Sorry I can't give any better answer than that. If you manage to find
> any other source of useful data, I'm certainly interested to hear
> about it.
>
> Yours,
> Russ Magee %-)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Foreignkey troubles : some key look ups give me a ValueError: invalid literal for int() with base 10 error

I posted this question as a ticket :

kmtracey suggested the fix  ( http://code.djangoproject.com/ticket/15513) which is to use the ForeignKey.to_field to specify the column in the Parent table that the relation is mapped to.

I am copy-pasting his comments here:

The cause of the exception you are seeing is that per your Django models, the target column of the ForeignKey field in your Child model is the primary key field of Parent, not the ssn field. Primary key field of parent is an integer, so attempting to lookup a non-integer value raises an exception.

In order to tell Django that the target column for the ForeignKey field in child is the parent's ssn field, you need to specify to_field='ssn' on that ForeignKey definition. See: http://docs.djangoproject.com/en/1.2/ref/models/fields/#django.db.models.ForeignKey.to_field

Note though that your existing table definitions don't meet the requirements for a ForeignKey field here, because the Parent ssn field is not unique. Django's ForeignKey is a many-to-one relation, so the target column must be unique. See #11702. If you are not actually creating the tables via syncdb you may not initially see any error related to this failure to meet the requirements for a ForeignKey -- but if in fact you have duplicated values in that target field, you may see errors later on.

Your Django models also show evidence of bug #5725. The max_length values for all your CharFields are 3x higher than they should be. Easiest fix is to manually correct them to be the right value.



On Fri, Feb 25, 2011 at 3:29 PM, hari jayaram <harijay@gmail.com> wrote:
Hi Everyone ,

I am using the svn version of django to write a django app to hook into a legacy database.
I am having some problem with querying by a ForeignKey which is not a Primary key. The sql datatype for the foreign key  is  VARCHAR(256) , but lookups only succeed with integer fields . The original database has integer and non-integer values for this field. Only Non-int fields throw a ValueError when I try to use the filter in django.


here is my test case:

I have a Parent table and a child table.  Both parent and child have their own primary keys. The child table has the parent attribute called ssn ( in SQL a VARCHAR(256)) as a foreign key constraint. The SQL for my test case is given below.
After creating this test database  and then creating my models with django manage.py inspectdb and running syncdb , I get the following behavior (see below). The ForeignKey Lookup succeeds only for int fields but fails for non int fields. The test db and models.py is pasted below.

What am i doing wrong

Thanks 
Hari


 
 
>>> c = Child.objects.filter(parents_ssn="2354234234")

Suceeds!

>>> print c[0].name
werwer sdfgsdg

The following lookup fails

>>> cfails = Child.objects.filter(parents_ssn="g354234234c")
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/hari/djtrunk/django/db/models/manager.py", line 141, in filter
    return self.get_query_set().filter(*args, **kwargs)
  File "/home/hari/djtrunk/django/db/models/query.py", line 550, in filter
    return self._filter_or_exclude(False, *args, **kwargs)
  File "/home/hari/djtrunk/django/db/models/query.py", line 568, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))
  File "/home/hari/djtrunk/django/db/models/sql/query.py", line 1170, in add_q
    can_reuse=used_aliases, force_having=force_having)
  File "/home/hari/djtrunk/django/db/models/sql/query.py", line 1105, in add_filter
    connector)
  File "/home/hari/djtrunk/django/db/models/sql/where.py", line 67, in add
    value = obj.prepare(lookup_type, value)
  File "/home/hari/djtrunk/django/db/models/sql/where.py", line 316, in prepare
    return self.field.get_prep_lookup(lookup_type, value)
  File "/home/hari/djtrunk/django/db/models/fields/related.py", line 136, in get_prep_lookup
    return self._pk_trace(value, 'get_prep_lookup', lookup_type)
  File "/home/hari/djtrunk/django/db/models/fields/related.py", line 209, in _pk_trace
    v = getattr(field, prep_func)(lookup_type, v, **kwargs)
  File "/home/hari/djtrunk/django/db/models/fields/__init__.py", line 882, in get_prep_lookup
    return super(IntegerField, self).get_prep_lookup(lookup_type, value)
  File "/home/hari/djtrunk/django/db/models/fields/__init__.py", line 292, in get_prep_lookup
    return self.get_prep_value(value)
  File "/home/hari/djtrunk/django/db/models/fields/__init__.py", line 876, in get_prep_value
    return int(value)
ValueError: invalid literal for int() with base 10: 'g354234234c'


################
models.py has:
################

from django.db import models

class Parent(models.Model):
    id = models.IntegerField(primary_key=True)
    name = models.CharField(max_length=384, blank=True)
    ssn = models.CharField(max_length=768, blank=True)
    class Meta:
        db_table = u'Parent'
        app_label = u'mydjapp'

class Child(models.Model):
    id = models.IntegerField(primary_key=True)
    name = models.CharField(max_length=384, blank=True)
    parents_ssn = models.ForeignKey(Parent, null=True, db_column='parents_ssn', blank=True)
    class Meta:
        db_table = u'child'
        app_label= u'mydjapp'

~                                       
#####################
The database columns are:
######################

mysql> select * from Parent;
+----+--------------+--------------+
| id | name         | ssn          |
+----+--------------+--------------+
|  1 | Aefwesk baob | 42s354234234 |
|  2 | Ask bob      | 2354234234   |
|  3 | Seelan Cyata | 2354234234c  |
|  4 | Hdel Abnot   | g354234234c  |
+----+--------------+--------------+
4 rows in set (0.00 sec)


mysql> select * from child;
+----+----------------+-------------+
| id | name           | parents_ssn |
+----+----------------+-------------+
|  1 | werwer sdfgsdg | 2354234234  |
|  2 | Hyadr Abnot    | g354234234c |
+----+----------------+-------------+
2 rows in set (0.00 sec)



##########################
The raw SQL test was setup :
#######################
CREATE TABLE `Parent` (
 `id` int(11) NOT NULL,
 `name` varchar(128) DEFAULT NULL,
 `ssn` varchar(256) DEFAULT NULL,
 PRIMARY KEY (`id`),
 KEY `parents_ssn_fk` (`ssn`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |


CREATE TABLE `child` (
 `id` int(11) NOT NULL,
 `name` varchar(128) DEFAULT NULL,
 `parents_ssn` varchar(256) DEFAULT NULL,
 PRIMARY KEY (`id`),
 KEY `parents_ssn` (`parents_ssn`),
 CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parents_ssn`) REFERENCES `Parent` (`ssn`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

multi model forms

hi guys
I am new to django.

I have got two model User(Django built in ) and a model customer, user
is foreign key in customer

class Customer(models.Model):
user = models.ForeignKey(User, related_name='customers')
street = models.CharField(max_length=200)
city = models.CharField(max_length=100)
postal_code = models.IntegerField()
country = models.CharField(max_length=70)

i have written a view as below

def userForm(request):

if request.method == 'POST':
userform = UserForm(request.POST)
customerform = CustomerForm(request.POST)
if userform.is_valid() and customerform.is_valid():

u = userform.save()
customer = Customer()
customer.user = u
customerform.save()
return HttpResponseRedirect('/webshop/')

else:
userform = UserForm()
customerform = CustomerForm()
context = RequestContext(request, {'userform':userform,
'customerform':customerform,})
return render_to_response('userRegister.html', context)

but i get an erro saying xception Type: IntegrityError
Exception Value:

mainsiteapp_customer.lastname may not be NULL

please if anyonw can help
thanks

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: django and mod_wsgi



On Monday, February 28, 2011 11:23:14 PM UTC+11, atm wrote:
Try adding,
 

import os

import sys

 

path = 'C:\\Programme\\Apache Software Foundation\\Time2\\Time2\\'

path1 = 'C:\\Programme\\Apache Software Foundation\\Time2\\'


if path not in sys.path:

    sys.path.append(path)

    sys.path.append(path1)

 

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' (I've tried to replace mysite with the name of my app but that doesn't work either)

And if your projects is actually called 'Time2', then DJANGO_SETTINGS_MODULE should then be set to 'Time2.settings'. Ie., don't use 'mysite', that is an example name only.

Graham 

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()


atm
___
Life is short, Live it hard.




On 28 February 2011 17:49, Szabo, Patrick (LNG-VIE) <patric...@lexisnexis.at> wrote:

I'm trying to get my django-app running on apache 2.2  on windows XP.

I've installed everything and the Hello Worlf wsgi ran fine.

 

Now i wanted to run my django ap and did the following in a django.wsgi :

 

import os

import sys

 

path = 'C:\\Programme\\Apache Software Foundation\\Time2\\Time2\\'

if path not in sys.path:

    sys.path.append(path)

 

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' (I've tried to replace mysite with the name of my app but that doesn't work either)

 

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

 

I get the following error:

 

[Mon Feb 28 13:11:06 2011] [error] [client 10.122.64.212] ImportError: Could not import settings 'mysite.settings' (Is it on sys.path? Does it have syntax errors?): No module named mysite.settings

 

My project is called Time2.

 

Like i said a test file from the wsig tutorial runs fine so wsgi should be installed correctly.

 

Can anyone help me ?!

 

Kind regards

 

 

. . . . . . . . . . . . . . . . . . . . . . . . . .

Patrick Szabo
XSLT-Entwickler

LexisNexis
Marxergasse 25, 1030 Wien

patric...@lexisnexis.at

Tel.: +43 (1) 534 52 - 1573

Fax: +43 (1) 534 52 - 146



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: DatabaseError at / no such table: cms_page

I suspect you had already done a syncdb before creating that field. If yes, the database would not create it just like that.
When I had similar problem, here's what I did.
I removed the database file from my project root and then ran a syncdb again. It worked.
There's a price to pay however, you would lose everything in the database and you have to repopulate again.
HTH
Sent from my BlackBerry wireless device from MTN

-----Original Message-----
From: electrocoder <electrocoder@gmail.com>
Sender: django-users@googlegroups.com
Date: Mon, 28 Feb 2011 11:44:34
To: Django users<django-users@googlegroups.com>
Reply-To: django-users@googlegroups.com
Subject: DatabaseError at / no such table: cms_page

How do
"DatabaseError at /

no such table: cms_page"

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

DatabaseError at / no such table: cms_page

How do
"DatabaseError at /

no such table: cms_page"

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: urls.py usage

I only followed manuals! Please, Mr. Daniel, give me more details!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: urls.py usage

On Monday, February 28, 2011 4:26:57 PM UTC, Vladimir wrote:

>   That you have duplicate registration of one model in your admin.py
> somewhere (I believe, I may be wrong).
There is no admin.py file in this project.

Well, why not? That is the cause of your problem. Putting admin registration in models.py will frequently lead to this error, which is the whole reason for having a separate admin.py.
--
DR.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: How to check if string is in Hebrew

On Sun, Feb 27, 2011 at 3:01 PM, ydjango <traderashish@gmail.com> wrote:
> Hebrew is within the unicode range 0x590 to 0x5ff.
>
> I tried
> if lang_string[0] >= u'0x590' and lang_string[0] <= u'0x5ff':
>
> but it does not seem to work.

That isn't the correct syntax for unicode string literals. What you
are trying to do should look like this:

if lang_string[0] >= u'\u0590' and lang_string[0] <= u'\u05ff':

(See http://docs.python.org/reference/lexical_analysis.html#strings
for all the details on \u, \U, \x and their friends)

Testing just the first character of the string may or may not work for
general input; that depends entirely on your problem (and your users).
If it were me, I would define a utility function like this:

def char_is_hebrew(char):
return char >= u'\u0590' and char <= u'\u05ff'

and then test all of the characters in the string, either with

if any(map(char_is_hebrew, lang_string)):
<some character is in the range>

or

if all(map(char_is_hebrew, lang_string)):
<every character is in the range>

--
Regards,
Ian Clelland
<clelland@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: python mysqldb installation problem



On Mon, Feb 28, 2011 at 1:19 PM, Pulkit Mehrotra <mehrotra.pulkit@gmail.com> wrote:
OS: Ubuntu 10.04
I am learning web developing with Django.I downloaded and installed
python-mysql but i couldn't connect.I think problem is database
settings.
Here is the process:

django-admin.py startproject mysite #creating a project and a mysite
folder

files in 'mysite' folder:
/__init__.py
/urls.py
/manage.py
/views.py
/settings.py

Then i edited the 'settings.py' file.There are alse database settings
in it.

Here are the settings:

DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'mydb'
DATABASE_USER = 'me'
DATABASE_PASSWORD = 'pwd'
DATABASE_HOST = ''
DATABASE_PORT = ''

then i write the codes below with terminal:

python manage.py shell

from django.db import connection
cursor=connection.cursor()

Then the error occurs as:

Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/django/db/backends/mysql/
base.py", line 99, in cursor
self.connection = Database.connect(**kwargs)
File "/var/lib/python-support/python2.5/MySQLdb/__init__.py", line 74,
in Connect
return Connection(*args, **kwargs)
File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line
170, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2002, "Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2)")


It looks like that error occurs from DATABASE_HOST but i don't think
so because when using MySQL DATABASE_HOST may be left blank

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Have you created access to mysql with the username and password in your settings file?  You need to do this in mysql I believe


--
Joel Goldstick

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: sqlite path

Make sure the directory containing your sqlite database is writable by the user your web server is running as.  sqlite occasionally creates some temporary files in the same directory side-by-side your actual sqlite file.

Brian

On Mon, Feb 28, 2011 at 10:45 AM, Tim <jtim.arnold@gmail.com> wrote:
On Feb 28, 10:05 am, Tim <jtim.arn...@gmail.com> wrote:
> On Feb 26, 9:25 am, spa...@gmail.com wrote:
>
>
>
>
>
>
>
>
>
> > Have you tried updating the DB path in settings.py and creating a new db
> > file?
>
> > On Sat, Feb 26, 2011 at 2:30 AM, Andre Terra <andrete...@gmail.com> wrote:
> > > Try appending the custom location to the beginning of your PYTHONPATH.
>
> > > Sincerely,
> > > Andre Terra
>
> > > On Fri, Feb 25, 2011 at 5:28 PM, Tim <jtim.arn...@gmail.com> wrote:
>
> > >> hi,
> > >> I'm using Django 1.2.3 and I have a new sqlite (3.7.5) installed in a
> > >> custom location.
> > >> There is an old sqlite (3.6.23.1) installed in /usr/local/bin/.
>
> > >> How do I tell Django to use the new sqlite? I'm on FreeBSD 8.0.
>
> > >> thanks,
> > >> --Tim Arnold
>
> > >> --
> > >> You received this message because you are subscribed to the Google Groups
> > >> "Django users" group.
> > >> To post to this group, send email to django-users@googlegroups.com.
> > >> To unsubscribe from this group, send email to
> > >> django-users+unsubscribe@googlegroups.com.
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/django-users?hl=en.
>
> > >  --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscribe@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> > --http://spawgi.wordpress.com
> > We can do it and do it better.
>
> hi, I converted my original mysql database to sqlite3. Firefox sqlite
> extension can view the database and it looks okay.  It looks like the
> Django settings are okay to me--here they are:
>
> DATABASES = {
>     'default': {
>         'ENGINE': 'django.db.backends.sqlite3',
>         'NAME': '/Apps/web/myproject.sqlite',
>         'USER': '',
>         'PASSWORD': '',
>         'HOST': '',
>         'PORT': '',
>    }}
>
> And here are the dir permissions of /Apps/web:
>
> drwxrwxrwx  4 tiarno  wheel     4096 Feb 25 14:54 ./
> drwxr-xr-x  8 tiarno  wheel     4096 Feb 23 17:24 ../
> drwxrwxrwx  5 tiarno  wheel     4096 Feb 25 15:16 django/
> drwxr-xr-x  2 tiarno  wheel     4096 Sep 17 15:45 home/
> -rwxrwxrwx  1 tiarno  wheel  1588224 Feb 25 13:51 myproject.sqlite*
>
> I run validate and get '0 errors found'. I run syncdb and get this:
>
>  python manage.py syncdb
> Traceback (most recent call last):
>   File "manage.py", line 11, in <module>
>     execute_manager(settings)
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> __init__.py", line 438, in execute_manager
>     utility.execute()
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> __init__.py", line 379, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> base.py", line 191, in run_from_argv
>     self.execute(*args, **options.__dict__)
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> base.py", line 220, in execute
>     output = self.handle(*args, **options)
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> base.py", line 351, in handle
>     return self.handle_noargs(**options)
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> commands/syncdb.py", line 55, in handle_noargs
>     tables = connection.introspection.table_names()
>   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> __init__.py", line 498, in table_names
>     return self.get_table_list(cursor)
>   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> sqlite3/introspection.py", line 51, in get_table_list
>     ORDER BY name""")
>   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> util.py", line 15, in execute
>     return self.cursor.execute(sql, params)
>   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> sqlite3/base.py", line 200, in execute
>     return Database.Cursor.execute(self, query, params)
> django.db.utils.DatabaseError: disk I/O error
>
> thanks for any ideas,
> --Tim

More info. This isn't a django issue after all. I just tried a simple
select * using the sqlite shell and got a disk io error. If I move the
database to my home directory, the select works, so there's something
weird going on with the mounted disk where my django app lives (a
netapp device).

sorry for the noise,
--Tim

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.




--
Brian Bouterse
ITng Services

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

python mysqldb installation problem

OS: Ubuntu 10.04
I am learning web developing with Django.I downloaded and installed
python-mysql but i couldn't connect.I think problem is database
settings.
Here is the process:

django-admin.py startproject mysite #creating a project and a mysite
folder

files in 'mysite' folder:
/__init__.py
/urls.py
/manage.py
/views.py
/settings.py

Then i edited the 'settings.py' file.There are alse database settings
in it.

Here are the settings:

DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'mydb'
DATABASE_USER = 'me'
DATABASE_PASSWORD = 'pwd'
DATABASE_HOST = ''
DATABASE_PORT = ''

then i write the codes below with terminal:

python manage.py shell

from django.db import connection
cursor=connection.cursor()

Then the error occurs as:

Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/django/db/backends/mysql/
base.py", line 99, in cursor
self.connection = Database.connect(**kwargs)
File "/var/lib/python-support/python2.5/MySQLdb/__init__.py", line 74,
in Connect
return Connection(*args, **kwargs)
File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line
170, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2002, "Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2)")


It looks like that error occurs from DATABASE_HOST but i don't think
so because when using MySQL DATABASE_HOST may be left blank

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Django include templates problem, from 0.96 to 1.2

Hi folks,

I using google app engine, in 0.96 I have no problem to include a
template as following

{% include "../header.html" %}

However, in 1.2 the code above not functioning??

Any idea?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: jquery document ready aggregation

If I'm remembering correctly, the context is composed of a list of dictionaries.
When you reference a value, the layers are searched, most recently added
first, until one is found that has the variable you want (or not). When you
set a variable, it always uses the top layer, even if the same variable exists
in a lower layer.

Various things add layers, for example, the "with" and "for" tags. When you
pass the corresponding end tag, the layer is discarded. So if some of your
domready invocations are within one of these constructs, and your
domready_render is outside, it's not going to see the stuff that was defined
inside.

A way of handling this is to make your renderer a tag that requires an end
tag. It can create the variable (probably pushing it's own layer onto the
context stack) in its opening tag, making its value a mutable, such as a
python list. The domready tags would then append to the list. This avoids
making a new version of the same variable in some inner layer because
you only read the variable, you don't set it: it still has the
original list, it is
the list that is modified. The render renders its template contents, then,
as a final act, emits the javascript in its variable. This is like it being
rendered at the end tag.

You might want to make both tags accept a string argument to use as the
variable name, just in case you discover a need to nest them, say to
accumulate stuff that must occur in an order different from that in which it
appears in the template. You could, of course, default the variable to a
standard name.

Bill

On Fri, Feb 25, 2011 at 10:26 AM, kost BebiX <kost88@gmail.com> wrote:
> Hi! I would like to write two simple tags, one would be called {% domready
> %}, and another one is {% domready_render %}, first will add some js to some
> buffer and second will just join it alltogather and print it (at base
> template in some $(document).ready(...)). So my question is: where/how do I
> need to store some variables between those tags? (maybe some current request
> context or what?)
> I mean, I wrote something like:
> @register.tag
> def domready(parser, token):
>     nodelist = parser.parse(('enddomready',))
>     parser.delete_first_token()
>     return DomreadyNode(nodelist)
> class DomreadyNode(template.Node):
>     def __init__(self, nodelist):
>         self.nodelist = nodelist
>
>     def render(self, context):
>         if 'dom_ready' not in context:
>             context['dom_ready'] = []
>
>         context['dom_ready'].append(self.nodelist.render(context))
>         return ''
> @register.tag
> def domready_render(parser, token):
>     return DomreadyRenderNode()
> class DomreadyRenderNode(template.Node):
>     def render(self, context):
>         if 'dom_ready' in context:
>             return u"\n".join(context['dom_ready'])
>         return ''
> But it doesn't work in different templates (contexts are different?).
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

new project settings file not found

this is a first for me. i set up a project like i normally do and get
things set up... run syncdb for the first time for the project. Havent
had this happen before and things seem to be working on other projects
just fine. I've even go so far as to comment out the handful of apps.
I presume there

now, is there a requirement that the apache stuff be set up to run
syncdb? that is the only thing i can think of as i just set up the
subdomain and http.conf for it on the server. doesn't seem to make
sense to me that that would be the case though...

file/directory permissions are the same as my other projects as well

python manage syncdb
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/core/management/__init__.py", line 257, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name,
name))
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/core/management/commands/syncdb.py", line 7, in <module>
from django.core.management.sql import custom_sql_for_model,
emit_post_sync_signal
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/core/management/sql.py", line 5, in <module>
from django.contrib.contenttypes import generic
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/contrib/contenttypes/generic.py", line 6, in <module>
from django.db import connection
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/db/__init__.py", line 14, in <module>
if not settings.DATABASES:
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/utils/functional.py", line 276, in __getattr__
self._setup()
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/conf/__init__.py", line 40, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/conf/__init__.py", line 75, in __init__
raise ImportError("Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e))
ImportError: Could not import settings 'blog.settings' (Is it on
sys.path? Does it have syntax errors?): No module named settings

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: how-to-design-a-django-driven-cms-hosting-like-solution

Check out Practical Django Projects by James Bennette.
Sent from my BlackBerry wireless device from MTN

-----Original Message-----
From: BearCode <beardov@gmail.com>
Sender: django-users@googlegroups.com
Date: Sat, 26 Feb 2011 14:50:27
To: Django users<django-users@googlegroups.com>
Reply-To: django-users@googlegroups.com
Subject: how-to-design-a-django-driven-cms-hosting-like-solution

Hi to all,

This is my first posting here, so I apologize up-front if posting a
link to stackoverflow is not how things are done around here...

I came up with this question, regarding the best way to go about
designing a system that's similar to a CMS-hosting system-

http://stackoverflow.com/questions/5127791/how-to-design-a-django-driven-cms-hosting-like-solution

any help would be appreciated.
thanks,
bearcode

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: urls.py usage

>   That you have duplicate registration of one model in your admin.py
> somewhere (I believe, I may be wrong).
There is no admin.py file in this project.
Model.py file contains:
from django.db import models
from django.contrib import admin
class BlogPost(models.Model):
title = models.CharField(max_length=150)
body = models.TextField()
timestamp = models.DateTimeField()
class Meta:
ordering = ('-timestamp',)
class BlogPostAdmin(admin.ModelAdmin):
list_display = ('title', 'timestamp')
admin.site.register(BlogPost, BlogPostAdmin)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: GENERIC VIEW CONCERNS AND EXPLANATION REQUIREMENTS

Short answer: yes.
The generic views are there for a reason, to provide a simple implementation of most generic operations like detail views, listings ... 
A complete different things is the "if I have to", you don't!
One thing is DRY other is use the tools and possibilities that the framework gives allows you to, depending on the case you might find some limitations on the usage of generic views. It's all about "generic" you need your views to be!

N.

On Mon, Feb 28, 2011 at 4:55 PM, Dipo Elegbede <delegbede@dudupay.com> wrote:
Hi all,

I am currently trying to read up generic views.

I can do most of my django stuff at my level without the generic view but it appears almost in all texts i read and also seem to be a key part of django's underlying principles of DRY and keeping things from redundancy.

My question is, if i have to use generic views syntaxes in my urls.py, does it mean I don't have to write a function for the url in my views.py file?

I am currently reading Practical Django Projects by James Bennette.

Kindly help with some explanations.

Thank You.

--
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise Application Development

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
Norberto Leite

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django+ oracle, working with apache(mod_python, wsgi) and in runserver, ora-03114 in fastcgi

also when i first run fast cgi it is working, but only first page,
second return error, after killing fcgi and run it again a can get
another page (but only one)
it;s looks like this:
1)python2.6 manage.py runfcgi host=127.0.0.1 port=9001 --
settings=settings
2) go to http://localhost <- page is working
3) go to http://localhost <- error
4) kill fcgi, run "1" point again
5) go to http://localhost <- page is working
6) go to http://localhost <- error

On 28 Lut, 16:04, lipt0n <michal.lipin...@gmail.com> wrote:
> Hi
> my application works fine in apache as mod_python and wsgi, also work
> great when I run manage.py runserver
> but I have to move it on nginx.
>
> so I run it by 'python2.6 manage.py runfcgi host=127.0.0.1 port=9001 --
> settings=settings'
> and it works fine until it have to connect to the database (oracle in
> my situation) and i get " Unhandled Exception",
> when I checked logs its what I found :
> "
> OperationalError: ORA-03114: not connected to ORACLE" while reading
> response header from upstream, client: 192.168.1.105, server:
> localhost, request: "POST / HTTP/1.1", upstream: "fastcgi://
> 127.0.0.1:9001", host: "192.168.1.50", referrer: "http://
> 192.168.1.50/"
> "
>
> ORACLE enviroment vars are set correctly, what can I do to fix this?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

GENERIC VIEW CONCERNS AND EXPLANATION REQUIREMENTS

Hi all,

I am currently trying to read up generic views.

I can do most of my django stuff at my level without the generic view but it appears almost in all texts i read and also seem to be a key part of django's underlying principles of DRY and keeping things from redundancy.

My question is, if i have to use generic views syntaxes in my urls.py, does it mean I don't have to write a function for the url in my views.py file?

I am currently reading Practical Django Projects by James Bennette.

Kindly help with some explanations.

Thank You.

--
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise Application Development

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: sqlite path

On Feb 28, 10:05 am, Tim <jtim.arn...@gmail.com> wrote:
> On Feb 26, 9:25 am, spa...@gmail.com wrote:
>
>
>
>
>
>
>
>
>
> > Have you tried updating the DB path in settings.py and creating a new db
> > file?
>
> > On Sat, Feb 26, 2011 at 2:30 AM, Andre Terra <andrete...@gmail.com> wrote:
> > > Try appending the custom location to the beginning of your PYTHONPATH.
>
> > > Sincerely,
> > > Andre Terra
>
> > > On Fri, Feb 25, 2011 at 5:28 PM, Tim <jtim.arn...@gmail.com> wrote:
>
> > >> hi,
> > >> I'm using Django 1.2.3 and I have a new sqlite (3.7.5) installed in a
> > >> custom location.
> > >> There is an old sqlite (3.6.23.1) installed in /usr/local/bin/.
>
> > >> How do I tell Django to use the new sqlite? I'm on FreeBSD 8.0.
>
> > >> thanks,
> > >> --Tim Arnold
>
> > >> --
> > >> You received this message because you are subscribed to the Google Groups
> > >> "Django users" group.
> > >> To post to this group, send email to django-users@googlegroups.com.
> > >> To unsubscribe from this group, send email to
> > >> django-users+unsubscribe@googlegroups.com.
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/django-users?hl=en.
>
> > >  --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscribe@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> > --http://spawgi.wordpress.com
> > We can do it and do it better.
>
> hi, I converted my original mysql database to sqlite3. Firefox sqlite
> extension can view the database and it looks okay.  It looks like the
> Django settings are okay to me--here they are:
>
> DATABASES = {
>     'default': {
>         'ENGINE': 'django.db.backends.sqlite3',
>         'NAME': '/Apps/web/myproject.sqlite',
>         'USER': '',
>         'PASSWORD': '',
>         'HOST': '',
>         'PORT': '',
>    }}
>
> And here are the dir permissions of /Apps/web:
>
> drwxrwxrwx  4 tiarno  wheel     4096 Feb 25 14:54 ./
> drwxr-xr-x  8 tiarno  wheel     4096 Feb 23 17:24 ../
> drwxrwxrwx  5 tiarno  wheel     4096 Feb 25 15:16 django/
> drwxr-xr-x  2 tiarno  wheel     4096 Sep 17 15:45 home/
> -rwxrwxrwx  1 tiarno  wheel  1588224 Feb 25 13:51 myproject.sqlite*
>
> I run validate and get '0 errors found'. I run syncdb and get this:
>
>  python manage.py syncdb
> Traceback (most recent call last):
>   File "manage.py", line 11, in <module>
>     execute_manager(settings)
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> __init__.py", line 438, in execute_manager
>     utility.execute()
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> __init__.py", line 379, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> base.py", line 191, in run_from_argv
>     self.execute(*args, **options.__dict__)
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> base.py", line 220, in execute
>     output = self.handle(*args, **options)
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> base.py", line 351, in handle
>     return self.handle_noargs(**options)
>   File "/usr/local/lib/python2.7/site-packages/django/core/management/
> commands/syncdb.py", line 55, in handle_noargs
>     tables = connection.introspection.table_names()
>   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> __init__.py", line 498, in table_names
>     return self.get_table_list(cursor)
>   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> sqlite3/introspection.py", line 51, in get_table_list
>     ORDER BY name""")
>   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> util.py", line 15, in execute
>     return self.cursor.execute(sql, params)
>   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> sqlite3/base.py", line 200, in execute
>     return Database.Cursor.execute(self, query, params)
> django.db.utils.DatabaseError: disk I/O error
>
> thanks for any ideas,
> --Tim

More info. This isn't a django issue after all. I just tried a simple
select * using the sqlite shell and got a disk io error. If I move the
database to my home directory, the select works, so there's something
weird going on with the mounted disk where my django app lives (a
netapp device).

sorry for the noise,
--Tim

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: sqlite path

On Feb 26, 9:25 am, spa...@gmail.com wrote:
> Have you tried updating the DB path in settings.py and creating a new db
> file?
>
>
>
>
>
>
>
>
>
> On Sat, Feb 26, 2011 at 2:30 AM, Andre Terra <andrete...@gmail.com> wrote:
> > Try appending the custom location to the beginning of your PYTHONPATH.
>
> > Sincerely,
> > Andre Terra
>
> > On Fri, Feb 25, 2011 at 5:28 PM, Tim <jtim.arn...@gmail.com> wrote:
>
> >> hi,
> >> I'm using Django 1.2.3 and I have a new sqlite (3.7.5) installed in a
> >> custom location.
> >> There is an old sqlite (3.6.23.1) installed in /usr/local/bin/.
>
> >> How do I tell Django to use the new sqlite? I'm on FreeBSD 8.0.
>
> >> thanks,
> >> --Tim Arnold
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Django users" group.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscribe@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --http://spawgi.wordpress.com
> We can do it and do it better.

hi, I converted my original mysql database to sqlite3. Firefox sqlite
extension can view the database and it looks okay. It looks like the
Django settings are okay to me--here they are:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/Apps/web/myproject.sqlite',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
And here are the dir permissions of /Apps/web:

drwxrwxrwx 4 tiarno wheel 4096 Feb 25 14:54 ./
drwxr-xr-x 8 tiarno wheel 4096 Feb 23 17:24 ../
drwxrwxrwx 5 tiarno wheel 4096 Feb 25 15:16 django/
drwxr-xr-x 2 tiarno wheel 4096 Sep 17 15:45 home/
-rwxrwxrwx 1 tiarno wheel 1588224 Feb 25 13:51 myproject.sqlite*

I run validate and get '0 errors found'. I run syncdb and get this:

python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.7/site-packages/django/core/management/
__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
base.py", line 220, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
base.py", line 351, in handle
return self.handle_noargs(**options)
File "/usr/local/lib/python2.7/site-packages/django/core/management/
commands/syncdb.py", line 55, in handle_noargs
tables = connection.introspection.table_names()
File "/usr/local/lib/python2.7/site-packages/django/db/backends/
__init__.py", line 498, in table_names
return self.get_table_list(cursor)
File "/usr/local/lib/python2.7/site-packages/django/db/backends/
sqlite3/introspection.py", line 51, in get_table_list
ORDER BY name""")
File "/usr/local/lib/python2.7/site-packages/django/db/backends/
util.py", line 15, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/site-packages/django/db/backends/
sqlite3/base.py", line 200, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.DatabaseError: disk I/O error

thanks for any ideas,
--Tim

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Django+ oracle, working with apache(mod_python, wsgi) and in runserver, ora-03114 in fastcgi

Hi
my application works fine in apache as mod_python and wsgi, also work
great when I run manage.py runserver
but I have to move it on nginx.

so I run it by 'python2.6 manage.py runfcgi host=127.0.0.1 port=9001 --
settings=settings'
and it works fine until it have to connect to the database (oracle in
my situation) and i get " Unhandled Exception",
when I checked logs its what I found :
"
OperationalError: ORA-03114: not connected to ORACLE" while reading
response header from upstream, client: 192.168.1.105, server:
localhost, request: "POST / HTTP/1.1", upstream: "fastcgi://
127.0.0.1:9001", host: "192.168.1.50", referrer: "http://
192.168.1.50/"
"

ORACLE enviroment vars are set correctly, what can I do to fix this?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: urls.py usage

> AlreadyRegistered at /blog/
> The model BlogPost is already registered

That you have duplicate registration of one model in your admin.py
somewhere (I believe, I may be wrong).

Cheers

Jirka

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: urls.py usage

What does this message (it appears after web browser entering) means:

AlreadyRegistered at /blog/
The model BlogPost is already registered

?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

CSRF token can be only rendered in CSRF protected views

I was not able to describe my problems to ticket on first attempt, so
I try here before creation of another ticket.


We use CSRF protection on almost all POST requests, but we encountered
some limitations of CSRF protection as currently implemented in
django.

- You can not render POST form in unprotected views, not even if user
has CSRF cookie already set.
- If you render such form, you will always end up in CSRF failure
view, because input with csrf_token has value set to some replacement
string
- I had to overcome this problem by copying part of middleware
that sets csrf cookie to request.META. Alternative solution is to call
CSRF check manually and throw away the result
- Call CSRF check manually (not middleware or decorator) is not very
handy, code for that looks like

result = CsrfViewMiddleware().process_view(request, lambda:
None, None, None)
# if None is returned, than it is OK
if result:
# Store data back to session to prevent their loss
return result

This call is not very pretty, especially because second argument is
only used to check if view was exempt from CSRF protection and last
two are mandatory for process_view method of middleware and are not
used in csrf check.

My questions are
- is correct my assumption that rendering CSRF token in unprotected
view should be possible or am I missing something
- is reasonable requirement to call CSRF check manually

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.