Re: Tutorial database problem

2012-05-28 Thread phantom21
OK, problem solved.  The location I thought was working for django 1.4
was different than was actually the case.  I'm reinstalling to a new
location and hope it will work correctly this time.

The advice on adding the divide by 0 line helped since it didn't
execute.

Thanks,

Mark


On May 28, 4:57 am, Gelonida N  wrote:
> On 05/27/2012 05:38 AM, phantom21 wrote:
>
>
>
>
>
>
>
>
>
> > I've tried to set up the database as sqlite3.  I keep getting an error
> > on the ENGINE line, but can't figure out why as it looks correct.
>
> > Here is the database section:
>
> > DATABASES = {
> >      'default': {
> >          'ENGINE': 'django.db.backends.sqlite3',
> >          'NAME': '/usr/bin/sqlite3/mark.db',  # Or path to database
> > file if using sqlite3
> >          'USER': '',                      # Not used with sqlite3.
> >          'PASSWORD': '',                  # Not used with sqlite3.
> >          'HOST': '',                      # Set to empty string for
> > localhost. Not used with sqlite3.
> >          'PORT': '',                      # Set to empty string for
> > default. Not used with sqlite3.
> >      }
> > }
>
> > And here is the error I receive:
>
> > Traceback (most recent call last):
> >    File "manage.py", line 10, in
> >      execute_from_command_line(sys.argv)
> >    File "/usr/local/lib/python2.7/dist-packages/django/core/management/
> > __init__.py", line 443, in execute_from_command_line
> >      utility.execute()
> >    File "/usr/local/lib/python2.7/dist-packages/django/core/management/
> > __init__.py", line 382, in execute
> >      self.fetch_command(subcommand).run_from_argv(self.argv)
> >    File "/usr/local/lib/python2.7/dist-packages/django/core/management/
> > base.py", line 196, in run_from_argv
> >      self.execute(*args, **options.__dict__)
> >    File "/usr/local/lib/python2.7/dist-packages/django/core/management/
> > base.py", line 232, in execute
> >      output = self.handle(*args, **options)
> >    File "/usr/local/lib/python2.7/dist-packages/django/core/management/
> > base.py", line 371, in handle
> >      return self.handle_noargs(**options)
> >    File "/usr/local/lib/python2.7/dist-packages/django/core/management/
> > commands/syncdb.py", line 57, in handle_noargs
> >      cursor = connection.cursor()
> >    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/
> > dummy/base.py", line 15, in complain
> >      raise ImproperlyConfigured("settings.DATABASES is improperly
> > configured. "
> > django.core.exceptions.ImproperlyConfigured: settings.DATABASES is
> > improperly configured. Please supply the ENGINE value. Check settings
> > documentation for more details.
>
> Well your DATABASES settings look fine (except of the path of the NAME
> entry as others have already pointed out.
> To be very sure there are no permission problems
>
> Do you get the error already when running the command
>
> python manage.py syncdb
>
> For testing you could add following line as LAST line in settings.py
>
> print 'DATABASES = %r' % DATABASES
>
> and paste the results to your next answer.
> Printing with %r has also the advantage of revealing any hidden characters.
>
> Are you sure, that django uses the setting.py file, that you modified???
>
> If you're not sure, than add following line as the FIRST line in settings.py
> a = 1 / 0
>
> If Django fails now with a division by zero you're sure it's using the
> file you think it's using and you can remove this line again.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-registration simple backend help

2012-05-28 Thread psychok7
i followed your tips and  got my answer here 
http://stackoverflow.com/questions/3441436/the-next-parameter-redirect-django-contrib-auth-login
 

thanks ;)

On Monday, May 28, 2012 9:43:34 PM UTC+1, Rafael Durán Castañeda wrote:
>
>  El 28/05/12 22:13, Rafael Dur�n Casta�eda escribi�: 
>
> El 28/05/12 21:28, psychok7 escribi�: 
>
> yes i read that part before posting, but i just dont understand the 
> beahaviour of the normal login that redirects me somewhere and the login 
> after registration that redirects me elsewhere. wich one should i use?
>
> On Monday, May 28, 2012 8:15:28 PM UTC+1, Rafael Dur�n Casta�eda 
> wrote: 
>>
>>  El 28/05/12 20:18, psychok7 escribi�: 
>>
>> anyone?
>>
>> On Monday, May 28, 2012 1:54:20 AM UTC+1, psychok7 wrote: 
>>>
>>> hi there i am writing an app using django-registration 0.8 installed 
>>> from pip and using the simple-backend 
>>>
>>>  my problem is, when i register a new user it logs me in after 
>>> inserting in the db and redirects me to /users// but if i login 
>>> normally using the�django.contrib.auth it redirects me to 
>>> accounts/profile.
>>>
>>>  my question is, how do i unify this redirect since it should take me 
>>> to the same place?
>>>
>>>  thanks
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/okwBS3_w15gJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>> From django-registration docs:
>>
>> Upon successful registration, the default redirect is to the URL 
>> specified by the get_absolute_url() method of the newly-created Userobject; 
>> by default, this will be 
>> /users//, although it can be overridden in either of two ways:
>>
>>1. Specify a custom URL pattern for the 
>> register()view,
>>  passing the keyword argument 
>>success_url. 
>>2. Override the default get_absolute_url() of the User model in your 
>>Django configuration, as covered in Django�s settings 
>> documentation
>>. 
>>
>> http://docs.b-list.org/django-registration/0.8/simple-backend.html
>>  HTH
>>  
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/T_tBN05Lbk4J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
> Django, by default, redirects you to LOGIN_URL after successful login 
> unless next is given as query string (see 
> https://docs.djangoproject.com/en/dev/topics/auth/#the-login-required-decorator),
>  
> accounts/profile in your case, and registration backend is redirecting you 
> to /users/. So you can change LOGIN_URL or override registration 
> redirects as docs explain.
>
> Bye
>
> I've just realized, my las message is wrong, LOGIN_REDIRECT is where users 
> are redirected by default (
> https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url) 
> and I didn't mention that also depends of your login view (but I think not 
> in this case).
>
> Bye
>  

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



Re: Taggit fragmentation (open letter)

2012-05-28 Thread Russell Keith-Magee
Hi Simon,

On Tue, May 29, 2012 at 1:39 AM, Simon Bächler  wrote:
> I was just checking on github if there was a new version of django-taggit
> and was quite shocked what I saw. The original repository had not been
> updated for over a year. Yet there are 41 issues and 12 pull requests. There
> are 114 forks, 17 of which had commits within the last month.
>
> Shortly, it is a big mess. I'm sure some of the forks have important
> bugfixes while other just add features required for a certain project. But
> it is really necessary that either Alex Gaynor or someone else gets that app
> back on track.

At this point, I feel it necessary to point out that you've missed one
very important person off the list of people that can help get this
app back on track - YOU.

I'm sure this wasn't your intention, but your message sounds like
you're demanding that someone else volunteer to fix your problems.

If Alex isn't on top of his pull requests, there's a reason. Given
that he's just graduated from college and is starting full time work,
I'm going to guess that it's because he's busy with other projects,
and his personal use case for django-taggit isn't as strong as it once
was. And while that may be very disappointing to you personally, it is
ultimately *your* problem. If you're not happy with django-taggit, I'm
sure Alex will offer you a 100% refund of everything you paid for it.

So - if you're not happy with the state of django-taggit, then it's up
to *you* -- not anybody else -- to fix the problem. Roll up your
sleeves and get involved. Start addressing some of the tickets.
Generate a private branch that merges all the pull requests. You say
the hcarvalhoalves fork is the most maintained? Start submitting pull
requests to them, instead of Alex. If they don't respond, start
publicising your own fork. And when you've put in enough effort to
show that you're serious, consider contacting Alex directly and see if
he's interested in sharing ownership of the project, or passing the
project off to you completely.

This is the beauty of open source. You have all the tools you need to
solve any problem you have. However, you have to get involved.
Standing on the sidelines complaining doesn't get anything done.

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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



My first troll

2012-05-28 Thread Antoni Aloy
Hello,

Recently I had my first troll on my blog (http://trespams.com). In my
blog I usually write about Python and Django, and about the books I
read and other IT problems. When I write about Django I tag the posts
so it can appear in the Django Planet.
My mother language is Catalan, so I usually write my posts in this language..

The troll, lets call him Jim, as this is the nick he has chosen,
complains about having a non English entry in what he thinks is a
English only planet.
I'm a proud member of the Django communtiy since dec-2005, and one of
the thinks I liked about the planet and the Django community is that
is not just English focused. In the planet you can see posts in
languages other than English, although is true that most posts are in
this language. But Django itself, from its beginning has had a great
care in i18n and l10n, with the translation utilities, local flavour,
languages support, translations. So a multi language planet it just
another way to say we support many languages an communities.

Of course one can have more visibility writing in English, but I have
another point of view: for open source project is important to show
that there are local support. We a company has to decide if he's going
to use one tool or another, support is one of the things he evaluates.
A Planet showing multiple languages, multiple entries, shows that the
community is live, that the Django adoption is global.

So sorry Jim in not my fault, but I really appreciate your trolling,
as the trolls usually means the project is mature enought, and Django
really is.

Thanks for reading!


-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-registration simple backend help

2012-05-28 Thread Rafael Durán Castañeda

El 28/05/12 22:13, Rafael Durán Castañeda escribió:

El 28/05/12 21:28, psychok7 escribió:
yes i read that part before posting, but i just dont understand the 
beahaviour of the normal login that redirects me somewhere and the 
login after registration that redirects me elsewhere. wich one should 
i use?


On Monday, May 28, 2012 8:15:28 PM UTC+1, Rafael Durán Castañeda wrote:

El 28/05/12 20:18, psychok7 escribió:

anyone?

On Monday, May 28, 2012 1:54:20 AM UTC+1, psychok7 wrote:

hi there i am writing an app using django-registration 0.8
installed from pip and using the simple-backend

my problem is, when i register a new user it logs me in
after inserting in the db and redirects me to
/users// but if i login normally using
the django.contrib.auth it redirects me to accounts/profile.

my question is, how do i unify this redirect since it should
take me to the same place?

thanks

-- 
You received this message because you are subscribed to the

Google Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/okwBS3_w15gJ
.
To post to this group, send email to
django-users@googlegroups.com
.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
.

From django-registration docs:

Upon successful registration, the default redirect is to the URL
specified by the get_absolute_url() method of the newly-created
User object; by default, this will be /users//,
although it can be overridden in either of two ways:

 1. Specify a custom URL pattern for the register()


view, passing the keyword argument success_url.
 2. Override the default get_absolute_url() of the User model in
your Django configuration, as covered in Django’s settings
documentation

.

http://docs.b-list.org/django-registration/0.8/simple-backend.html 


HTH

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/T_tBN05Lbk4J.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.
Django, by default, redirects you to LOGIN_URL after successful login 
unless next is given as query string (see 
https://docs.djangoproject.com/en/dev/topics/auth/#the-login-required-decorator), 
accounts/profile in your case, and registration backend is redirecting 
you to /users/. So you can change LOGIN_URL or override 
registration redirects as docs explain.


Bye
I've just realized, my las message is wrong, LOGIN_REDIRECT is where 
users are redirected by default 
(https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url) 
and I didn't mention that also depends of your login view (but I think 
not in this case).


Bye

--
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Set additional conditions for JOIN

2012-05-28 Thread akaariai
On May 28, 10:59 pm, Boris Shemigon  wrote:
> Hi,
>
> I wonder is there a way to generate a query with joins with more than one
> condition? For example:
>
> SELECT o.id FROM object
> JOIN object_value AS ov1 ON ov1.o_id=object.id AND ov1.field_id=1 AND
> ov1.value=2
> JOIN object_value AS ov2 ON ov2.o_id=object.id AND ov2.field_id=2 AND
> ov2.value>=1
> JOIN object_value AS ov3 ON ov3.o_id=object.id AND ov3.field_id=3 AND
> ov3.value>=2
>
> It's supposed to find all objects that have all fields with corresponding
> values.
>
> Does anybody know how to code that in the frame of Django ORM. Or the only
> solution is to go down to SQL?

There is currently no way to add conditions to the join clause, not
even by using internal APIs.

 - Anssi

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-registration simple backend help

2012-05-28 Thread Rafael Durán Castañeda

El 28/05/12 21:28, psychok7 escribió:
yes i read that part before posting, but i just dont understand the 
beahaviour of the normal login that redirects me somewhere and the 
login after registration that redirects me elsewhere. wich one should 
i use?


On Monday, May 28, 2012 8:15:28 PM UTC+1, Rafael Durán Castañeda wrote:

El 28/05/12 20:18, psychok7 escribió:

anyone?

On Monday, May 28, 2012 1:54:20 AM UTC+1, psychok7 wrote:

hi there i am writing an app using django-registration 0.8
installed from pip and using the simple-backend

my problem is, when i register a new user it logs me in after
inserting in the db and redirects me to /users//
but if i login normally using the django.contrib.auth it
redirects me to accounts/profile.

my question is, how do i unify this redirect since it should
take me to the same place?

thanks

-- 
You received this message because you are subscribed to the

Google Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/okwBS3_w15gJ
.
To post to this group, send email to
django-users@googlegroups.com .
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
.

From django-registration docs:

Upon successful registration, the default redirect is to the URL
specified by the get_absolute_url() method of the newly-created
User object; by default, this will be /users//, although
it can be overridden in either of two ways:

 1. Specify a custom URL pattern for the register()


view, passing the keyword argument success_url.
 2. Override the default get_absolute_url() of the User model in
your Django configuration, as covered in Django’s settings
documentation

.

http://docs.b-list.org/django-registration/0.8/simple-backend.html


HTH

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/T_tBN05Lbk4J.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.
Django, by default, redirects you to LOGIN_URL after successful login 
unless next is given as query string (see 
https://docs.djangoproject.com/en/dev/topics/auth/#the-login-required-decorator), 
accounts/profile in your case, and registration backend is redirecting 
you to /users/. So you can change LOGIN_URL or override 
registration redirects as docs explain.


Bye

--
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Set additional conditions for JOIN

2012-05-28 Thread Boris Shemigon
Hi,

I wonder is there a way to generate a query with joins with more than one 
condition? For example:

SELECT o.id FROM object
JOIN object_value AS ov1 ON ov1.o_id=object.id AND ov1.field_id=1 AND 
ov1.value=2
JOIN object_value AS ov2 ON ov2.o_id=object.id AND ov2.field_id=2 AND 
ov2.value>=1
JOIN object_value AS ov3 ON ov3.o_id=object.id AND ov3.field_id=3 AND 
ov3.value>=2

It's supposed to find all objects that have all fields with corresponding 
values. 

Does anybody know how to code that in the frame of Django ORM. Or the only 
solution is to go down to SQL?

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



Re: Multiprocess Queryset memory consumption increase (DEBUG=False and using iterator)

2012-05-28 Thread akaariai
On May 28, 5:42 pm, pc  wrote:
> I am stumped. I am trying process a lot of data (2 million records and
> up) and once I have a QuerySet, I immediately feed it to a
> queryset_iterator that fetched results in chunks of 1000 rows each. I
> use MySQL and the DB server is on another machine (so I don't think it
> is MySQL caching).
>
> I kick off 4 sub-processes using multiprocessing.Process, but even if
> I keep it to 1, eventually, I will run out of memory.
>
> RAM usage just steadily seems to increase. When I finish processing a
> resultset, I would allocate a new resultset to the variable and I
> would expect gc to get my memory back.
>
> Any ideas?
>
> def run(self):
>      .
>
> messages=queryset_iterator(MessageDAO.get_all_messages_for_date(now))
>             self.process_messages(job,messages)
>             messages=None
>             gc.collect()
> ...
>
> def queryset_iterator(queryset, chunksize=1000):
>     pk = 0
>     last_pk = queryset.order_by('-pk')[0].pk
>     queryset = queryset.order_by('pk')
>     while pk < last_pk:
>         for row in queryset.filter(pk__gt=pk)[:chunksize]:
>             pk = row.pk
>             yield row
>         gc.collect()

Are you sure the leak is not in process_messages?

I tested something similar on PostgreSQL, and the queryset_iterator
doesn't seem to leak memory:
def queryset_iterator(queryset, chunksize=100):
pk = 0
last_pk = queryset.order_by('-pk')[0].pk
queryset = queryset.order_by('pk')
while pk < last_pk:
print len(connection.queries)
for row in queryset.filter(pk__gt=pk)[:chunksize]:
pk = row.pk
yield row
gc.collect()

for i in queryset_iterator(TestModel.objects.all()):
print memory()

where memory() is from 
http://stackoverflow.com/questions/938733/python-total-memory-used

The result seems stable, and don't indicate any memory leak.

TestModel contains 10 objects.

 - Anssi

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django GeoIP Module not found; can't remedy

2012-05-28 Thread Thomas Lockhart

...
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", 
line 353, in __init__

self._handle = _dlopen(self._name, mode)
OSError: dlopen(/usr/local/lib/libGeoIP.dylib, 6): no suitable image 
found.  Did find:

/usr/local/lib/libGeoIP.dylib: mach-o, but wrong architecture"

I've been using macports and virtualenv so have not run into this 
(pretty much everything gets built and installed in /usr/local, 
including a new build of python itself).


But you are using Apple's python and a homebrew build of GeoIP and 
python is clearly complaining that you do not have a compatible build of 
the library.


Use the "file" command to examine the python installation and your 
libGeoIP library (example from my system; yours has some different paths):


$ otool -L /usr/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/Python 
(compatibility version 2.7.0, current version 2.7.1)

...
$ file /System/Library/Frameworks/Python.framework/Versions/2.7/Python
/System/Library/Frameworks/Python.framework/Versions/2.7/Python: Mach-O 
universal binary with 2 architectures
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (for 
architecture x86_64):  Mach-O 64-bit dynamically linked shared 
library x86_64
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (for 
architecture i386):Mach-O dynamically linked shared library i386


I would include the geoip library in my example but it is having trouble 
building from MacPorts. Am looking into that :/


hth

   - Tom

--
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-registration simple backend help

2012-05-28 Thread psychok7
yes i read that part before posting, but i just dont understand the 
beahaviour of the normal login that redirects me somewhere and the login 
after registration that redirects me elsewhere. wich one should i use?

On Monday, May 28, 2012 8:15:28 PM UTC+1, Rafael Durán Castañeda wrote:
>
>  El 28/05/12 20:18, psychok7 escribió: 
>
> anyone?
>
> On Monday, May 28, 2012 1:54:20 AM UTC+1, psychok7 wrote: 
>>
>> hi there i am writing an app using django-registration 0.8 installed from 
>> pip and using the simple-backend 
>>
>>  my problem is, when i register a new user it logs me in after inserting 
>> in the db and redirects me to /users// but if i login normally 
>> using the django.contrib.auth it redirects me to accounts/profile.
>>
>>  my question is, how do i unify this redirect since it should take me to 
>> the same place?
>>
>>  thanks
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/okwBS3_w15gJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
> From django-registration docs:
>
> Upon successful registration, the default redirect is to the URL specified 
> by the get_absolute_url() method of the newly-created User object; by 
> default, this will be /users//, although it can be overridden 
> in either of two ways:
>
>1. Specify a custom URL pattern for the 
> register()view,
>  passing the keyword argument 
>success_url. 
>2. Override the default get_absolute_url() of the User model in your 
>Django configuration, as covered in Django’s settings 
> documentation
>. 
>
> http://docs.b-list.org/django-registration/0.8/simple-backend.html
>  HTH
>  

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



Re: django-registration simple backend help

2012-05-28 Thread Rafael Durán Castañeda

El 28/05/12 20:18, psychok7 escribió:

anyone?

On Monday, May 28, 2012 1:54:20 AM UTC+1, psychok7 wrote:

hi there i am writing an app using django-registration 0.8
installed from pip and using the simple-backend

my problem is, when i register a new user it logs me in after
inserting in the db and redirects me to /users// but if
i login normally using the django.contrib.auth it redirects me to
accounts/profile.

my question is, how do i unify this redirect since it should take
me to the same place?

thanks

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/okwBS3_w15gJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

From django-registration docs:

Upon successful registration, the default redirect is to the URL 
specified by the get_absolute_url() method of the newly-created User 
object; by default, this will be /users//, although it can be 
overridden in either of two ways:


1. Specify a custom URL pattern for the register()
   

   view, passing the keyword argument success_url.
2. Override the default get_absolute_url() of the User model in your
   Django configuration, as covered in Django's settings documentation
   .

http://docs.b-list.org/django-registration/0.8/simple-backend.html

HTH

--
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-registration simple backend help

2012-05-28 Thread psychok7
anyone?

On Monday, May 28, 2012 1:54:20 AM UTC+1, psychok7 wrote:
>
> hi there i am writing an app using django-registration 0.8 installed from 
> pip and using the simple-backend
>
> my problem is, when i register a new user it logs me in after inserting in 
> the db and redirects me to /users// but if i login normally using 
> the django.contrib.auth it redirects me to accounts/profile.
>
> my question is, how do i unify this redirect since it should take me to 
> the same place?
>
> thanks
>

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



Taggit fragmentation (open letter)

2012-05-28 Thread Simon Bächler
I was just checking on github if there was a new version of django-taggit 
and was quite shocked what I saw. The original repository had not been 
updated for over a year. Yet there are 41 issues and 12 pull requests. 
There are 114 forks, 17 of which had commits within the last month. 

Shortly, it is a big mess. I'm sure some of the forks have important 
bugfixes while other just add features required for a certain project. But 
it is really necessary that either Alex Gaynor or someone else gets that 
app back on track.

Taggit is the most advanced tagging app. But the main repo has some major 
issues. Unicode being one of them, whitespace another one.

It looks like hcarvalhoalves fork is the most maintained one now.

Regards
Simon

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



Re: Python IDLE

2012-05-28 Thread yati sagade
After you've fixed your file extension association problems as outlined in
the previous answer, PLEASE do not use IDLE to do anything remotely close
to editing. Go search for "Notepad++", download it and use it to always
edit your Python files. To get the contents of the file into IDLE for
testing, just import the module. The very thought of using IDLE to edit
files gave me goosebumps.

Cheers!

On Mon, May 28, 2012 at 7:08 PM, Andre Terra  wrote:

> For one thing, I don't know of anybody who uses IDLE as their editor for
> writing complex code like when developing a website with Django.
>
> You can always type 'python manage.py runserver' instead of just
> 'manage.py runserver' to make sure python is the program that's opening
> your .py file.
>
> It seems like you have a problem with your file associations. To fix this,
> go to the registry (Start Menu, Run, regedit) and browse to:
>
> *HKEY_CLASSES_ROOT\Python.File\shell\open\command*
>
> You should have a string there named '(Default') and its value should be
> exactly this (including quotes): *"C:\Python26\python.exe" "%1" %**
>
> You could have a different python path depending on your installation
> (say, C:\Program Files\Python27), but you get the gist. Don't forget the
> quotes and the trailing %*
>
>
> Cheers,
> AT
>
>
> On Mon, May 28, 2012 at 9:37 AM, coded kid  wrote:
>
>> I'm in a big mess now, I've lost my projects due to this errror. I'm
>> on windows, This is how I encounter the problem; I try to edit my
>> settings.py in IDLE. After right clicking on the files, I choose open
>> program with these default file. I choose idle window bat file, and I
>> clicked Ok. It didn't open, I try to run manage.py runserver on my
>> DOS. Not working, it will pop up the IDLE Shell and mange.py script by
>> displaying it in IDLE. It didn't run the server. The logo of my python
>> files have changed. How can I revert it back to open with IDLE? And
>> use it as default for my python script?
>>
>> --
>> 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+unsubscr...@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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Yati Sagade 

Twitter: @yati_itay 

Organizing member of TEDx EasternMetropolitanBypass
http://www.ted.com/tedx/events/4933
https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django Models Foreign Key Issue!

2012-05-28 Thread Eugene NGONTANG
I encountered a problem using Django foreign key unique_together for
one of my models.

I have three models (representing three tables in the database), host,
user, and job.

- user has a host foreign key
- job has a user foreign key and a host foreign key : Because we can
have the same user on two different host, and the same job for the
users. But we can't (should not) have the same job name duplicate for
the same user and host id.

I use this in my class model :

class Meta:
 unique_together = ("job_name", "user", "host")

It works for "./manage.py sqall my_app", and "./manage.py syncdb"

Things go fine untill i try to create a job with the same name in  the
admin interface for two different users on the same host.

The django admin accept the request, but it blocks at the sql level,
and returns this execption in the error page:

 Exception Value: (1062, "Duplicate entry 'my_command-5' for key
'job_name'")

I can't use this :
class Meta:
 unique_together = (("job_name", "user"), ("user",
"host")).

It will be take as to two unique_together case.

That's what the "./manage.py sqall my_app" has generated in the
standard output:
..
   UNIQUE (`job_name`, `user_id`, `host_id`)
.

But how to tell django to tell the sgbd that unicité is to be applied
on the job_name, the user_id and the host_id?


Has anyone encontered this issue?

Thanks for looking.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Multiprocess Queryset memory consumption increase (DEBUG=False and using iterator)

2012-05-28 Thread pc
I am stumped. I am trying process a lot of data (2 million records and
up) and once I have a QuerySet, I immediately feed it to a
queryset_iterator that fetched results in chunks of 1000 rows each. I
use MySQL and the DB server is on another machine (so I don't think it
is MySQL caching).

I kick off 4 sub-processes using multiprocessing.Process, but even if
I keep it to 1, eventually, I will run out of memory.

RAM usage just steadily seems to increase. When I finish processing a
resultset, I would allocate a new resultset to the variable and I
would expect gc to get my memory back.

Any ideas?


def run(self):
 .
 
messages=queryset_iterator(MessageDAO.get_all_messages_for_date(now))
self.process_messages(job,messages)
messages=None
gc.collect()
...

def queryset_iterator(queryset, chunksize=1000):
pk = 0
last_pk = queryset.order_by('-pk')[0].pk
queryset = queryset.order_by('pk')
while pk < last_pk:
for row in queryset.filter(pk__gt=pk)[:chunksize]:
pk = row.pk
yield row
gc.collect()

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Python IDLE

2012-05-28 Thread Andre Terra
For one thing, I don't know of anybody who uses IDLE as their editor for
writing complex code like when developing a website with Django.

You can always type 'python manage.py runserver' instead of just 'manage.py
runserver' to make sure python is the program that's opening your .py file.

It seems like you have a problem with your file associations. To fix this,
go to the registry (Start Menu, Run, regedit) and browse to:

*HKEY_CLASSES_ROOT\Python.File\shell\open\command*

You should have a string there named '(Default') and its value should be
exactly this (including quotes): *"C:\Python26\python.exe" "%1" %**

You could have a different python path depending on your installation (say,
C:\Program Files\Python27), but you get the gist. Don't forget the quotes
and the trailing %*


Cheers,
AT


On Mon, May 28, 2012 at 9:37 AM, coded kid  wrote:

> I'm in a big mess now, I've lost my projects due to this errror. I'm
> on windows, This is how I encounter the problem; I try to edit my
> settings.py in IDLE. After right clicking on the files, I choose open
> program with these default file. I choose idle window bat file, and I
> clicked Ok. It didn't open, I try to run manage.py runserver on my
> DOS. Not working, it will pop up the IDLE Shell and mange.py script by
> displaying it in IDLE. It didn't run the server. The logo of my python
> files have changed. How can I revert it back to open with IDLE? And
> use it as default for my python script?
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: track change

2012-05-28 Thread Carsten Jantzen
Thank you

I like this concept and will try to do it this way.

Thanks for the input.

/Carsten

On May 25, 12:05 pm, bruno desthuilliers
 wrote:
> On May 24, 11:00 pm, Carsten Jantzen  wrote:
>
>
>
> > Not sure what you mean by detecting skill change using properties, I
> > havn't looked into that.
> > Could you point to some documentation about it.
>
> Python has a strong support for computed attributes[1], and offers a
> builtin "property" type for the most common use cases[2]. This let you
> turn a plain attribute into a computed one (using a getter/setter
> pair) without breaking client code. What I had in ming was to turn
> your "skill" fields into computed attributes (using either properties
> or a custom descriptor) to track change.
>
> Now having looked at django-audit implementation (http://
> code.google.com/p/django-audit/), I think their approach using the
> __setattr__ hook[3] would be better here. Here's a very Q and naïve
> implementation example:
>
> import datetime
>
> class SkillChange(models.Model):
>     player = models.ForeignKey(Player)
>     skill = models.CharField()
>     value = models.IntegerField()
>     date = models.DatetimeField()
>
> class Player(models.Model):
>    # your fields definitions here
>    skill_x = models.IntegerField()
>    skill_y = models.IntegerField()
>
>    # which fields we want to track
>    _tracked_fields = ['skill_x', 'skill_y']
>
>    def __init__(self, *args, **kw):
>        super(Player, self).__init__(*args, **kw)
>        self._changed = {}
>
>   def __setattr__(self, attr, value)
>       if attr in self._tracked_fields:
>           old_val = getattr(self, attr, None)
>           if old_val != value:
>              self._changed[attr] = value
>       super(Player, self).__setattr__(attr, value)
>
>   def save(self, *args, **kw):
>       super(Player, self).save(*args, **kw)
>       now = datetime.datetime.now()
>       for skill, value in self._changed.items():
>           SkillChange.objects.create(
>               player=self,
>               skill=skill,
>               value=value,
>               date=now
>               )
>       self._changed = {}
>
> Untested code, of course, it's just meant as a (possible) proof of
> concept. You'll probably have to deal with a few special cases like
> what happens when creating a new Player instance etc
>
> HTH
>
> [1]http://docs.python.org/release/2.6.7/reference/datamodel.html#impleme...
> [2]http://docs.python.org/release/2.6.7/library/functions.html#property
> [3]http://docs.python.org/release/2.6.7/reference/datamodel.html#object

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Python IDLE

2012-05-28 Thread coded kid
I'm in a big mess now, I've lost my projects due to this errror. I'm
on windows, This is how I encounter the problem; I try to edit my
settings.py in IDLE. After right clicking on the files, I choose open
program with these default file. I choose idle window bat file, and I
clicked Ok. It didn't open, I try to run manage.py runserver on my
DOS. Not working, it will pop up the IDLE Shell and mange.py script by
displaying it in IDLE. It didn't run the server. The logo of my python
files have changed. How can I revert it back to open with IDLE? And
use it as default for my python script?

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



New library released: django-unaccent, adding unaccent operators to the Django ORM for unaccented search in PostgreSQL

2012-05-28 Thread djcoin [Simon Thépot]
Hi all,

the subject says it all: i'm glad (and relieved !) to contribute back
to Django by releasing the django-unaccent module:
https://github.com/djcoin/django-unaccent/

Basically it enables you (in a properly set up postgreSQL database -
with unaccent module installed) to make unaccented search a breeze.
Example:
>>> User.objects.create(username=u"Ôtâèkù")
>>> User.objects.filter(name__icontains_unaccent='tae')


Check out the example in the README and the tests (https://github.com/
djcoin/django-unaccent/blob/master/src/django_unaccent/tests.py) to
get the idea.

Of course, any feedback and commits are most welcome (I am even
looking for a maintainer as I'm not intensively using Django since a
few months).

Cheers !
Simon Thépot

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Is Django Right for Me?

2012-05-28 Thread yati sagade
Hi
As per a previous answer, Django is a server side framework, and should
handle most of your use cases. But you're on your own with the offline
caching thing. You have to build some logic in the client side of the app.
If I were you, I would have created a RESTful API using django-piston (a
Django app to easily create RESTful APIs). Then, my server side interface
would essentially be technology agnostic. On typical web clients like a
browser, you could use HTML5 offine storage capabilities( a new feature)
and AJAX to accomplish your task. Then from a tablet app, also, you can
make requests to these REST endpoints you created to push the data to the
server, and  offline storage for this type of a client should be easy to
get I guess(I have no Android experience). This design will make your app
very loosely coupled and highly flexible. Also, do share with us whatever
you end up creating(as long as it is not Flash :P).

Cheers!

On Mon, May 28, 2012 at 9:45 AM, ivan sugiarto wrote:

> furthermore if you want to integrate Django, Tablet and PC you should make
> Django webservice (either using Json or XML), after that you must create
> Tablet and PC application that fetch django webservice.
>
> So the rough architecture would be :
>
> Web Apps (ie Django, PHP or Java) --->create Web Service (XML or JSON)
> ---> Fetched by (using either GET or POST method) Android or PC apps
>
> the android or pc apps must use database to store data for offline use, I
> recommend sqlite http://www.sqlite.org/, i have used it in numerous apps
> and it runs smoothly :)
>
> PS sorry of my bad english
>
>
> On Mon, May 28, 2012 at 6:45 AM, Russell Keith-Magee <
> russ...@keith-magee.com> wrote:
>
>> On Mon, May 28, 2012 at 12:28 AM, KevinE 
>> wrote:
>> > Not a web developer but have a bit of software savy and looking to
>> develop a
>> > custom app for use in my business which is consulting engineering. I
>> want to
>> > develop application that helps me in documenting inspections I make on a
>> > jobsite. Basicly what happens is I would go out with a tablet and use my
>> > webapp to collect and document construction progress mainly to document
>> > construction deficiencies and monitor progress of construction. From the
>> > data collected on the job site I would push this data through a
>> reporting
>> > engine to prepare a pdf style site review report which would get
>> emailed to
>> > the project architect, all the consultants, owner and contractor - the
>> > intent is to have this happen while on the job site. On the office side
>> I
>> > want to develop a basic project based document management system where
>> I can
>> > document when field reviews were conducted, summarize deficiencies and
>> also
>> > ensure that deficiencies are completed and signed off on (as the
>> engineer I
>> > take legal responsibility for all the deficiencies). I also want to be
>> able
>> > to manage all my projects find projects by client, owner, architect etc.
>> >
>> > By the looks of it Django should be able to do all this but the one
>> issue
>> > that I am unsure about is an offline mode. The idea is to have a tablet
>> with
>> > a data connection but if there is no data connection I still need to
>> > complete the forms and cache the data until it can be sync'd later on.
>> From
>> > what I have read, data syncing can get a bit knarly, something I don't
>> want
>> > to get into myself.
>> >
>> > I envision a custom android app for the tablet - for this I need access
>> to
>> > the GPS and camera (my ultra cool feature will be my tablet
>> automatically
>> > pulling up a project page as I drive up to the job site based on the GPS
>> > coordinates!). Will this be a web page or will it be an actual app?
>> >
>> > Guess I am looking for some basic advice on how to architect this with
>> the
>> > above issues in mind.
>>
>> From what you've described, Django will certainly be able to help out
>> here. However, you're going to need to combine Django with some other
>> tools to solve all your problems.
>>
>> Django is a server-side framework -- that is, it deals with the
>> database and web server that doles out content to whatever client asks
>> for it -- be it web browser, mobile app, or whatever. In terms of your
>> problem, that means that Django will be able to provide the interface
>> by which data is submitted to the server, store the data that is
>> collected, and provide a web presence to serve that data back to
>> users. Django doesn't have any built-in PDF generation capability, but
>> there are a lot of Python libraries that can be used to generate PDFs,
>> and it's easy to use Django to extract data and feed it into a PDF
>> generator. Django's documentation contains some simple examples of how
>> this can be done. [1]
>>
>> [1] https://docs.djangoproject.com/en/1.4/howto/outputting-pdf/
>>
>> So - Django will be great on the server side. However, the bigger part
>> of your 

Re: a problem when PATH_INFO == SCRIPT_NAME

2012-05-28 Thread heng zhao
I read the comment in  https://code.djangoproject.com/ticket/8490,  I
found someone met the same problem 3years ago. why don't merge it into
chunk?

On Mon, May 28, 2012 at 2:56 PM, heng zhao  wrote:
> I'm using Django-1.4 and nginx with fastcgi mode.
> when I use runserver  mode everything goes well,  But in nginx &
> fastcgi ,whatever URL i visit, I get a response "/"
> I trace the code and found that , when PATH_INFO == SCRIPT_NAME,
> path_info has been set to  u'/' (core/handlers/wsgi.py WSGIRequest
> __init__)
> so all the request redirect to /
> for example , I visit /foo/, nginx send a fastcgi request with
> PATH_INFO = ‘/foo/’ & SCRIPT_NAME = '/foo/' ,and Django redirect it
> to ‘/’
> I change :
>
>    if not path_info or path_info == script_name :
>            path_info = u'/'
> to:
>
>   if not path_info :
>            path_info = u'/'
>   if path_info == script_name:
>            script_name = u''
>
> I found this problem has been reported and fixed in
> https://code.djangoproject.com/ticket/8490,
> but he treat it in a strange way,  i'm still wondering it's a django bug or 
> not.
>
> excuse for my pool english :)



-- 

HangZhou, China
Tel: 1320581255

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



a problem when PATH_INFO == SCRIPT_NAME

2012-05-28 Thread heng zhao
I'm using Django-1.4 and nginx with fastcgi mode.
when I use runserver  mode everything goes well,  But in nginx &
fastcgi ,whatever URL i visit, I get a response "/"
I trace the code and found that , when PATH_INFO == SCRIPT_NAME,
path_info has been set to  u'/' (core/handlers/wsgi.py WSGIRequest
__init__)
so all the request redirect to /
for example , I visit /foo/, nginx send a fastcgi request with
PATH_INFO = ‘/foo/’ & SCRIPT_NAME = '/foo/' ,and Django redirect it
to ‘/’
I change :

if not path_info or path_info == script_name :
path_info = u'/'
to:

   if not path_info :
path_info = u'/'
   if path_info == script_name:
script_name = u''

I found this problem has been reported and fixed in
https://code.djangoproject.com/ticket/8490,
but he treat it in a strange way,  i'm still wondering it's a django bug or not.

excuse for my pool english :)

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Tutorial database problem

2012-05-28 Thread Gelonida N

On 05/27/2012 05:38 AM, phantom21 wrote:

I've tried to set up the database as sqlite3.  I keep getting an error
on the ENGINE line, but can't figure out why as it looks correct.

Here is the database section:


DATABASES = {
 'default': {
 'ENGINE': 'django.db.backends.sqlite3',
 'NAME': '/usr/bin/sqlite3/mark.db',  # Or path to database
file if using sqlite3
 'USER': '',  # Not used with sqlite3.
 'PASSWORD': '',  # Not used with sqlite3.
 'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
 'PORT': '',  # Set to empty string for
default. Not used with sqlite3.
 }
}


And here is the error I receive:

Traceback (most recent call last):
   File "manage.py", line 10, in
 execute_from_command_line(sys.argv)
   File "/usr/local/lib/python2.7/dist-packages/django/core/management/
__init__.py", line 443, in execute_from_command_line
 utility.execute()
   File "/usr/local/lib/python2.7/dist-packages/django/core/management/
__init__.py", line 382, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/usr/local/lib/python2.7/dist-packages/django/core/management/
base.py", line 196, in run_from_argv
 self.execute(*args, **options.__dict__)
   File "/usr/local/lib/python2.7/dist-packages/django/core/management/
base.py", line 232, in execute
 output = self.handle(*args, **options)
   File "/usr/local/lib/python2.7/dist-packages/django/core/management/
base.py", line 371, in handle
 return self.handle_noargs(**options)
   File "/usr/local/lib/python2.7/dist-packages/django/core/management/
commands/syncdb.py", line 57, in handle_noargs
 cursor = connection.cursor()
   File "/usr/local/lib/python2.7/dist-packages/django/db/backends/
dummy/base.py", line 15, in complain
 raise ImproperlyConfigured("settings.DATABASES is improperly
configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is
improperly configured. Please supply the ENGINE value. Check settings
documentation for more details.





Well your DATABASES settings look fine (except of the path of the NAME 
entry as others have already pointed out.

To be very sure there are no permission problems


Do you get the error already when running the command

python manage.py syncdb





For testing you could add following line as LAST line in settings.py

print 'DATABASES = %r' % DATABASES

and paste the results to your next answer.
Printing with %r has also the advantage of revealing any hidden characters.


Are you sure, that django uses the setting.py file, that you modified???

If you're not sure, than add following line as the FIRST line in settings.py
a = 1 / 0

If Django fails now with a division by zero you're sure it's using the 
file you think it's using and you can remove this line again.





--
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Webservice return pdf

2012-05-28 Thread Madhu
Hi! all
I create client & through client i call the web service.
which returns pdf file, i want to stored that file directly.
I use this
response['Content-Disposition'] = 'attachment; filename= 'demo.pdf'
but it will ask the user to store the file, but i want to store it 
automatically on server.
can anybody please suggest me, how it should be done?

Thanks

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