Mod_Python and everything loaded, Apache serving HTML files without using Django first

2010-11-01 Thread The End
I've finally got mod_python and mysqldb working with apache (long
story short, can't install wsgi for various reasons and i'm using
python 2.4.3... for various reasons...).

However

Now when i load up the home page (just typing 'localhost' into
firefox) i get the literal HTML representation of index.html, without
the dynamics filling in.  I can only assume that apache is not using
Django to return these requests.

I only have 1 Virtual Host and Location tag in my entire Apache
Configuration File (with all the standard stuff, i didn't turn
anything off):

LoadModule python_module /usr/lib64/httpd/modules/mod_python.so


   ServerName Sweetman
   ServerAdmin sweet...@sweetman.com
   DocumentRoot /srv/www/sweetman/

   
   SetHandler python-program
   PythonHandler django.core.handlers.modpython
   SetEnv DJANGO_SETTINGS_MODULE sweetman.settings
   PythonDebug On
   PythonPath "[ '/sweetman_live/sweetman' , '/usr/lib/
python2.4/site-packages/django/' , '/srv/www/'] + sys.path"



   SetHandler none


ErrorLog /srv/www/sweetman/logs/error.log
CustomLog /srv/www/sweetman/logs/access.log combined


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Using localflavor with admin?

2010-11-01 Thread Victor Hooi
heya,

Thanks for your answer - I posted a reply (doesn't seem to work for
non-US), however, it doesn't seem to have appeared on the web-version
of Groups, so I thought I'd email you directly, just in case you
missed it and happened to know.

Thanks,
Victor

Hmm, I'm actually trying this Australian localisation.
However, the weird thing is, there's a US models.py:
http://code.djangoproject.com/browser/django/trunk/django/contrib/localflavor/us/models.py
But there's no such models.py for other countries. E.g., for
Australia:
http://code.djangoproject.com/browser/django/trunk/django/contrib/localflavor/au
Is there a particular reason for this? Or any way of achieving the
same effect?

On Oct 29, 5:48 am, Frank Wiles  wrote:
> On Thu, Oct 28, 2010 at 12:23 AM, Victor Hooi  wrote:
> > Hi,
>
> > Is there any way to combine the localflavor module (http://
> > docs.djangoproject.com/en/dev/ref/contrib/localflavor/) with Django's
> > in-built admin module?
>
> > For example, I'd like to create a model with say, a Postcode and phone-
> > number field, and have these validated in the admin, as per the rules
> > setup in localflavor?
>
> Hi Victor,
>
> You just need to use the the model fields to achieve this.  So for
> example, if I was going to do a US Phone Number field I would do:
>
> from django.db import models
> from django.contrib.localflavor.us.models import PhoneNumberField
>
> class Test(models.Model):
>     phone = PhoneNumberField()
>
> You'd obviously need to reference the exact field you're looking for,
> but then it just automagically works in the admin.
>
> --
> Frank Wiles
> Revolution Systems |http://www.revsys.com/
> fr...@revsys.com   | (800) 647-6298

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Reverse Query Name Clash?

2010-11-01 Thread Victor Hooi
Hi,

I'm getting a error about reverse query name clashes with my models.

We have a Django app to manage conferences and conference attendees.

In our models.py, two of the models we have are:

1. Person, representing people attending people attending a
conference. Each person also has a "church" field, which represents
the main church they attend.

class Person(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
gender = models.CharField(max_length=1,
choices=GENDER_CHOICES)
spouse = models.ForeignKey('self', null=True, blank=True)
date_of_birth = models.DateField()
church = models.ForeignKey('Church')
...

The "church" FK is in quotation marks, since the Church object is
defined below Person.

2. "Church", which defines a church, and includes an optional field
for the main minister at that church. The minister field is a FK to a
Person.

class Church(models.Model):
name = models.CharField(max_length=50)
address = models.CharField(max_length=50)
suburb = models.CharField(max_length=30)
postcode = models.IntegerField()
state = models.CharField(max_length=3, choices=AUSTRALIAN_STATES)
minister = models.ForeignKey(Person, null=True, blank=True)

So a person has a church, and a church also has a minister (in most
cases the two will be different, except for the case where the
minister themselves is attending a conference, which should of course
be valid).

The issue here is that the model doesn't validate:

Error: One or more models did not validate:
conferences.church: Reverse query name for field 'minister'
clashes with field 'Person.church'. Add a related_name argument to the
definition for 'minister'.

Now, if I change the name of the "church" field under Person, it will
validate - however, I'm still curious as to why this doesn't work? Any
way to fix it? (I assume I could add a related_name argument, I'm just
trying to figure out what's going on, and gain more understanding for
Django).

Cheers,
Victor

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Using localflavor with admin?

2010-11-01 Thread Victor Hooi
heya,

Hmm, I'm actually trying this Australian localisation.

However, the weird thing is, there's a US models.py:

http://code.djangoproject.com/browser/django/trunk/django/contrib/localflavor/us/models.py

But there's no such models.py for other countries. E.g., for
Australia:

http://code.djangoproject.com/browser/django/trunk/django/contrib/localflavor/au

Is there a particular reason for this? Or any way of achieving the
same effect?

Cheers,
Victor

On Oct 29, 5:48 am, Frank Wiles  wrote:
> On Thu, Oct 28, 2010 at 12:23 AM, Victor Hooi  wrote:
> > Hi,
>
> > Is there any way to combine the localflavor module (http://
> > docs.djangoproject.com/en/dev/ref/contrib/localflavor/) with Django's
> > in-built admin module?
>
> > For example, I'd like to create a model with say, a Postcode and phone-
> > number field, and have these validated in the admin, as per the rules
> > setup in localflavor?
>
> Hi Victor,
>
> You just need to use the the model fields to achieve this.  So for
> example, if I was going to do a US Phone Number field I would do:
>
> from django.db import models
> from django.contrib.localflavor.us.models import PhoneNumberField
>
> class Test(models.Model):
>     phone = PhoneNumberField()
>
> You'd obviously need to reference the exact field you're looking for,
> but then it just automagically works in the admin.
>
> --
> Frank Wiles
> Revolution Systems |http://www.revsys.com/
> fr...@revsys.com   | (800) 647-6298

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Mongo and the Admin

2010-11-01 Thread Russell Keith-Magee
On Tue, Nov 2, 2010 at 9:15 AM, Vitaly Babiy  wrote:
> Hey guys,
> I know there has been work done with nosql I was wondering if the admin
> works with mongo yet?

Yes, with an if; no, with a but :-)

In trunk/stable, the answer is no. The ORM doesn't work with MongoDB
yet, so there's no chance that the admin will work.

However, Alex Gaynor's Google Summer of Code project was an attempt at
refactoring the ORM to provide the hooks necessary to write a MongoDB
backend -- and he presented a MongoDB backend as a proof of concept.

There are some catches associated with using this code -- check the
threads on django-dev if you want more details -- but most common CRUD
ORM operations should work. By extension, most basic CRUD operations
in the admin should work, too.

Merging Alex's work into Django trunk is on the todo list for Django 1.4.

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



Mongo and the Admin

2010-11-01 Thread Vitaly Babiy
Hey guys,
I know there has been work done with nosql I was wondering if the admin
works with mongo yet?

Thank,
Vitaly Babiy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 app to support installation of qr code decoder

2010-11-01 Thread CreativeConvergence
Hi,
I'd like to know if someone is already working on a django application
(under BSD or MIT license) to help first time qr-code users select a
qr-code reader compatible with their smartphone.

Frédéric

(Qr-Code are 2D Barcodes with high density and they can encode URL.
They are very usefull for going from print to web.)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



How can I pre-filter the content that goes into the ModelAdmin.filter_horizontal

2010-11-01 Thread codingJoe
Tricky little problem here.  I am using horizontal_filter to assign a
massive amount of students to their advisors.
The horizontal filter works, but I see students from the entire
district.How can I pre-filter the data going into the
filter_horizontal widget to only show students at the Advisor's
school?

Any advice on this and the model is helpful.

class Student(models.Model):
  student_id = models.CharField(max_length=20, primary_key=True)
#school assigned student id
  gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
  last_name = models.CharField(max_length=30)
  first_name = models.CharField(max_length=30)
  grade = models.IntegerField()
  school = models.ForeignKey(School)

#Advisors have a primary school, but can also support many schools.
class Advisor(models.Model):
  last_name = models.CharField(max_length=20)
  first_name= models.CharField(max_length=20)
  primary_school = models.ForeignKey(School)
  school = models.ManyToManyField(School,
related_name='school_advisor')
  student = models.ManyToManyField(Student,
related_name='student_advisor')
  email = models.EmailField()

class School(models.Model):
  school_name = models.CharField(max_length=200)
  school_num = models.IntegerField()


class AdvisorAdmin(admin.ModelAdmin):
  # How can I prefilter this set of students to only show students
  # where student.school = teacher.primary_school
  # currently I see all the students in the district
  filter_horizontal = ['student']

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



xml-rpc

2010-11-01 Thread Lic . José M . Rodriguez Bacallao
is possible tu run xml-rpc code from django_xmlrpc project through
django test server (python manage.py runserver)?

-- 
Lic. José M. Rodriguez Bacallao
Centro de Biofisica Medica
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: about file uploading

2010-11-01 Thread Lic . José M . Rodriguez Bacallao
thanks, I was reading this url right now!!!

On Mon, Nov 1, 2010 at 2:49 PM, James  wrote:
> You can use webdav to help accomplish that goal.
>
> See: 
> http://stackoverflow.com/questions/492307/uploading-big-files-over-http/1499819#1499819
>
> (from the link Cal provided)
>
> -james
>
> On Mon, Nov 1, 2010 at 2:19 PM, Lic. José M. Rodriguez Bacallao
>  wrote:
>> with webdav can I uploading a file, interrupt it the then resume the
>> upload again starting from an offset of the previously uploading file
>> ?
>>
>> On Mon, Nov 1, 2010 at 1:54 PM, James  wrote:
>>> WebDav will not work for you?
>>> -james
>>>
>>> On Mon, Nov 1, 2010 at 1:37 PM, Lic. José M. Rodriguez Bacallao
>>>  wrote:
 yes, I saw that page but this is a complete application, I need
 someting with source code for mimifiying in django

 On Mon, Nov 1, 2010 at 1:35 PM, Cal Leeming [Simplicity Media Ltd]
  wrote:
> Here, let me google that for you..
> http://www.radinks.com/upload/plus/resume.php
> http://www.google.co.uk/search?sourceid=chrome=UTF-8=http+upload+resume
> Please make sure you make reasonable attempt to find the answer yourself 
> on
> Google, otherwise the boards get filled with copy pasta.
> On Mon, Nov 1, 2010 at 6:30 PM, Lic. José M. Rodriguez Bacallao
>  wrote:
>>
>> hi folks, I need to develop an application for uploading big files but
>> one requirement is that I must be able to resume a partially uploaded
>> file. How can I achieve this with django, any ideas?
>>
>> --
>> Lic. José M. Rodriguez Bacallao
>> Centro de Biofisica Medica
>> -
>> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
>> mismo.
>>
>> Recuerda: El arca de Noe fue construida por aficionados, el titanic
>> por profesionales
>> -
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>
>
>
> --
>
> Cal Leeming
>
> Operational Security & Support Team
>
> Out of Hours: +44 (07534) 971120 | Support
> Tickets: supp...@simplicitymedialtd.co.uk
> Fax: +44 (02476) 578987 | Email: cal.leem...@simplicitymedialtd.co.uk
> IM: AIM / ICQ / MSN / Skype (available upon request)
>
> Simplicity Media Ltd. All rights reserved.
> Registered company number 7143564
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>



 --
 Lic. José M. Rodriguez Bacallao
 Centro de Biofisica Medica
 -
 Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo 
 mismo.

 Recuerda: El arca de Noe fue construida por aficionados, el titanic
 por profesionales
 -

 --
 You received this message because you are subscribed to the Google Groups 
 "Django users" group.
 To post to this group, send email to django-us...@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-us...@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.
>>>
>>>
>>
>>
>>
>> --
>> Lic. José M. Rodriguez Bacallao
>> Centro de Biofisica Medica
>> -
>> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.
>>
>> Recuerda: El arca de Noe fue construida por aficionados, el titanic
>> por profesionales
>> -
>>
>> --
>> You 

Re: about file uploading

2010-11-01 Thread James
You can use webdav to help accomplish that goal.

See: 
http://stackoverflow.com/questions/492307/uploading-big-files-over-http/1499819#1499819

(from the link Cal provided)

-james

On Mon, Nov 1, 2010 at 2:19 PM, Lic. José M. Rodriguez Bacallao
 wrote:
> with webdav can I uploading a file, interrupt it the then resume the
> upload again starting from an offset of the previously uploading file
> ?
>
> On Mon, Nov 1, 2010 at 1:54 PM, James  wrote:
>> WebDav will not work for you?
>> -james
>>
>> On Mon, Nov 1, 2010 at 1:37 PM, Lic. José M. Rodriguez Bacallao
>>  wrote:
>>> yes, I saw that page but this is a complete application, I need
>>> someting with source code for mimifiying in django
>>>
>>> On Mon, Nov 1, 2010 at 1:35 PM, Cal Leeming [Simplicity Media Ltd]
>>>  wrote:
 Here, let me google that for you..
 http://www.radinks.com/upload/plus/resume.php
 http://www.google.co.uk/search?sourceid=chrome=UTF-8=http+upload+resume
 Please make sure you make reasonable attempt to find the answer yourself on
 Google, otherwise the boards get filled with copy pasta.
 On Mon, Nov 1, 2010 at 6:30 PM, Lic. José M. Rodriguez Bacallao
  wrote:
>
> hi folks, I need to develop an application for uploading big files but
> one requirement is that I must be able to resume a partially uploaded
> file. How can I achieve this with django, any ideas?
>
> --
> Lic. José M. Rodriguez Bacallao
> Centro de Biofisica Medica
> -
> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
> mismo.
>
> Recuerda: El arca de Noe fue construida por aficionados, el titanic
> por profesionales
> -
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>



 --

 Cal Leeming

 Operational Security & Support Team

 Out of Hours: +44 (07534) 971120 | Support
 Tickets: supp...@simplicitymedialtd.co.uk
 Fax: +44 (02476) 578987 | Email: cal.leem...@simplicitymedialtd.co.uk
 IM: AIM / ICQ / MSN / Skype (available upon request)

 Simplicity Media Ltd. All rights reserved.
 Registered company number 7143564

 --
 You received this message because you are subscribed to the Google Groups
 "Django users" group.
 To post to this group, send email to django-us...@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.

>>>
>>>
>>>
>>> --
>>> Lic. José M. Rodriguez Bacallao
>>> Centro de Biofisica Medica
>>> -
>>> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo 
>>> mismo.
>>>
>>> Recuerda: El arca de Noe fue construida por aficionados, el titanic
>>> por profesionales
>>> -
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Django users" group.
>>> To post to this group, send email to django-us...@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-us...@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.
>>
>>
>
>
>
> --
> Lic. José M. Rodriguez Bacallao
> Centro de Biofisica Medica
> -
> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.
>
> Recuerda: El arca de Noe fue construida por aficionados, el titanic
> por profesionales
> -
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For 

Re: Repost Admin Site Without Graphics

2010-11-01 Thread Robbington
Hi,

By 'with out graphics' do you mean no css or Javascript?

If so you want to make sure the value for these 3 varibles are correct
as its not governed by the templates list.

MEDIA_ROOT = ' /var/www/django_project/media' # Where media is the
copied folder of admin media or a symbolic link if you are using
Linux.

MEDIA_URL = 'media/'

ADMIN_MEDIA_PREFIX = '/media/'

Rob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Cherokee for home developing

2010-11-01 Thread Max Countryman
For example, if you are using uWSGI 0.9.2.6 you can use an XML document similar 
to this:


/srv/python-environments/voxinfinitus/
/srv/python-environments/
DJANGO_SETTINGS_MODULE=voxinfinitus.settings
django.core.handlers.wsgi:WSGIHandler()

6
/tmp/cherokee/voxi-live.sock


Make sure that the user that is executing Cherokee can write to your socket 
path.

Then whenever you want to see changes, just set up a script to rm the socket 
path. No need to reset uWSGI.

Good luck! Let me know if there's any other questions I might be able to help 
with.

On Nov 1, 2010, at 3:21 PM, Max Countryman wrote:

> Karim, I would set it up using a UNIX socket. Then all you have to do is rm 
> the socket path. :) There is no need to kill uWSGI in that case.
> 
> On Nov 1, 2010, at 3:13 PM, Karim Gorjux wrote:
> 
>> On Sun, Oct 31, 2010 at 01:27, Max Countryman  wrote:
>>> Yes, absolutely. :D Good luck!
>> 
>> Max, I'm trying with uwsgi and Cherokee. Seems to work, but if I edit
>> the code, I have to kill the uwsgi process to see the modification on
>> the browser. Is that normal?
>> 
>> -- 
>> K.
>> Blog Personale: http://www.karimblog.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-us...@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-us...@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-us...@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: Cherokee for home developing

2010-11-01 Thread Karim Gorjux
On Mon, Nov 1, 2010 at 21:21, Max Countryman  wrote:
> Karim, I would set it up using a UNIX socket. Then all you have to do is rm 
> the socket path. :) There is no need to kill uWSGI in that case.

Let me study that, because there is always a newbie side in me that
sometimes scream out :D
If this will drive me crazy, I'll write you here again if you let me.

Ciao!

-- 
K.
Blog Personale: http://www.karimblog.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-us...@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: Cherokee for home developing

2010-11-01 Thread Max Countryman
Karim, I would set it up using a UNIX socket. Then all you have to do is rm the 
socket path. :) There is no need to kill uWSGI in that case.

On Nov 1, 2010, at 3:13 PM, Karim Gorjux wrote:

> On Sun, Oct 31, 2010 at 01:27, Max Countryman  wrote:
>> Yes, absolutely. :D Good luck!
> 
> Max, I'm trying with uwsgi and Cherokee. Seems to work, but if I edit
> the code, I have to kill the uwsgi process to see the modification on
> the browser. Is that normal?
> 
> -- 
> K.
> Blog Personale: http://www.karimblog.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-us...@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-us...@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: about file uploading

2010-11-01 Thread Lic . José M . Rodriguez Bacallao
with webdav can I uploading a file, interrupt it the then resume the
upload again starting from an offset of the previously uploading file
?

On Mon, Nov 1, 2010 at 1:54 PM, James  wrote:
> WebDav will not work for you?
> -james
>
> On Mon, Nov 1, 2010 at 1:37 PM, Lic. José M. Rodriguez Bacallao
>  wrote:
>> yes, I saw that page but this is a complete application, I need
>> someting with source code for mimifiying in django
>>
>> On Mon, Nov 1, 2010 at 1:35 PM, Cal Leeming [Simplicity Media Ltd]
>>  wrote:
>>> Here, let me google that for you..
>>> http://www.radinks.com/upload/plus/resume.php
>>> http://www.google.co.uk/search?sourceid=chrome=UTF-8=http+upload+resume
>>> Please make sure you make reasonable attempt to find the answer yourself on
>>> Google, otherwise the boards get filled with copy pasta.
>>> On Mon, Nov 1, 2010 at 6:30 PM, Lic. José M. Rodriguez Bacallao
>>>  wrote:

 hi folks, I need to develop an application for uploading big files but
 one requirement is that I must be able to resume a partially uploaded
 file. How can I achieve this with django, any ideas?

 --
 Lic. José M. Rodriguez Bacallao
 Centro de Biofisica Medica
 -
 Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
 mismo.

 Recuerda: El arca de Noe fue construida por aficionados, el titanic
 por profesionales
 -

 --
 You received this message because you are subscribed to the Google Groups
 "Django users" group.
 To post to this group, send email to django-us...@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.

>>>
>>>
>>>
>>> --
>>>
>>> Cal Leeming
>>>
>>> Operational Security & Support Team
>>>
>>> Out of Hours: +44 (07534) 971120 | Support
>>> Tickets: supp...@simplicitymedialtd.co.uk
>>> Fax: +44 (02476) 578987 | Email: cal.leem...@simplicitymedialtd.co.uk
>>> IM: AIM / ICQ / MSN / Skype (available upon request)
>>>
>>> Simplicity Media Ltd. All rights reserved.
>>> Registered company number 7143564
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-us...@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.
>>>
>>
>>
>>
>> --
>> Lic. José M. Rodriguez Bacallao
>> Centro de Biofisica Medica
>> -
>> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.
>>
>> Recuerda: El arca de Noe fue construida por aficionados, el titanic
>> por profesionales
>> -
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@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-us...@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.
>
>



-- 
Lic. José M. Rodriguez Bacallao
Centro de Biofisica Medica
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Cherokee for home developing

2010-11-01 Thread Karim Gorjux
On Sun, Oct 31, 2010 at 01:27, Max Countryman  wrote:
> Yes, absolutely. :D Good luck!

Max, I'm trying with uwsgi and Cherokee. Seems to work, but if I edit
the code, I have to kill the uwsgi process to see the modification on
the browser. Is that normal?

-- 
K.
Blog Personale: http://www.karimblog.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-us...@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: about file uploading

2010-11-01 Thread James
WebDav will not work for you?
-james

On Mon, Nov 1, 2010 at 1:37 PM, Lic. José M. Rodriguez Bacallao
 wrote:
> yes, I saw that page but this is a complete application, I need
> someting with source code for mimifiying in django
>
> On Mon, Nov 1, 2010 at 1:35 PM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
>> Here, let me google that for you..
>> http://www.radinks.com/upload/plus/resume.php
>> http://www.google.co.uk/search?sourceid=chrome=UTF-8=http+upload+resume
>> Please make sure you make reasonable attempt to find the answer yourself on
>> Google, otherwise the boards get filled with copy pasta.
>> On Mon, Nov 1, 2010 at 6:30 PM, Lic. José M. Rodriguez Bacallao
>>  wrote:
>>>
>>> hi folks, I need to develop an application for uploading big files but
>>> one requirement is that I must be able to resume a partially uploaded
>>> file. How can I achieve this with django, any ideas?
>>>
>>> --
>>> Lic. José M. Rodriguez Bacallao
>>> Centro de Biofisica Medica
>>> -
>>> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
>>> mismo.
>>>
>>> Recuerda: El arca de Noe fue construida por aficionados, el titanic
>>> por profesionales
>>> -
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-us...@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.
>>>
>>
>>
>>
>> --
>>
>> Cal Leeming
>>
>> Operational Security & Support Team
>>
>> Out of Hours: +44 (07534) 971120 | Support
>> Tickets: supp...@simplicitymedialtd.co.uk
>> Fax: +44 (02476) 578987 | Email: cal.leem...@simplicitymedialtd.co.uk
>> IM: AIM / ICQ / MSN / Skype (available upon request)
>>
>> Simplicity Media Ltd. All rights reserved.
>> Registered company number 7143564
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>
>
>
> --
> Lic. José M. Rodriguez Bacallao
> Centro de Biofisica Medica
> -
> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.
>
> Recuerda: El arca de Noe fue construida por aficionados, el titanic
> por profesionales
> -
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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.



Trying to determine the duplicate SQL queries from my view code

2010-11-01 Thread Matteius
In this case there is no form POST data so that code gets skipped.  I
started profiling with the django_debugger_toolbar and my SQL data
results are at the bottom.  There are duplicate SQL select statements
for handin_course and auth_user which doesn't make sense to me as I
understand how views should work ...

#
# courseassignments - Course Assignments View
#
@login_required
def course_assignments(request, enrollment_id):
   # Request enrollment
   enrollment = Enrollment.objects.get(id__exact=enrollment_id)

   # Determine access level and create default behavior
   flag = verifyEnrollment(request, enrollment)
   template = loader.get_template('handin/course_blocked.html')
   context = RequestContext(request, {"user": request.user, "flag":
flag} )

   # If access is granted
   if flag == 1:
  # If we have post data process the form
  if request.POST:

 # Determine if submission is late
 assignment =
Assignment.objects.get(id__exact=request.POST['assignment'])
 onTime = True
 try:
# First see if there is a due date override
dueDate =
DueDateOverride.objects.filter(enrollment=enrollment.id).filter(assignment=assignment.id)
[0]
if
isLateNow( adjustDateDays( adjustDateWeeks(enrollment.start_date,
dueDate.weeks_after), dueDate.days_after)):
   onTime = False
 except IndexError:
# If not, see if there is a global due date
if assignment.apply_due_date:
   if
isLateNow( adjustDateDays( adjustDateWeeks(enrollment.start_date,
assignment.weeks_after), assignment.days_after)):
  onTime = False

 instance = Submission(enrollment_id=enrollment.id,
assignment_id=request.POST['assignment'], on_time=onTime)
 newSubmission = SubmissionForm(request.POST, request.FILES,
instance=instance)
 newSubmission.save()
 return
HttpResponseRedirect(reverse('classcomm.handin.views.course_assignments',
args=(enrollment.id,)))

  # Set the course_id
  course_id = enrollment.course.id

  # Get the requested course
  course = Course.objects.get(id__exact=course_id)

  # Find the assignments for the requested course
  assignments = Assignment.objects.all().filter(course=course_id)

  # Find the grades for the current enrollment
  grades = Grade.objects.all().filter(enrollment=enrollment.id)

  # Find the submissions for the current enrollment
  submissions =
Submission.objects.all().filter(enrollment=enrollment.id)

  # Find the due date overrides for the current enrollment
  dueDateOverrides =
DueDateOverride.objects.all().filter(enrollment=enrollment.id)

  # Create assignmentDataList for easy template cycle
  # [Assignment, current Submission, current Grade, current
DueDateOverride]
  assignmentDataList = list()
  for assignment in assignments:
 # Find the submission
 currentSubmission = None
 for submission in submissions:
if submission.assignment_id == assignment.id:
   currentSubmission = submission
 # Find the grade
 currentGrade = None
 for grade in grades:
if grade.assignment_id == assignment.id:
   currentGrade = grade
 # Find a due date override
 currentDDO = None
 for dueDateOverride in dueDateOverrides:
if dueDateOverride.assignment_id == assignment.id:
   currentDDO = dueDateOverrides
 # Add the tupple to a list
 assignmentDataList.append( (assignment, currentSubmission,
currentGrade, currentDDO) )

  # Create an assignment submission form
  form = SubmissionForm()

  # Set template; Create context
  template = loader.get_template('handin/course_assignments.html')
  context = RequestContext(request, {"user": request.user,
"course": course, "form": form,
 "enrollment": enrollment, "assignmentDataList":
assignmentDataList} )

   # Return page view
   return HttpResponse( template.render(context) )
# End Def







SQL Queries
Time (ms)   Action  Stacktrace  Query
0.61SELECT
EXPLAIN

Toggle Stacktrace

SELECT `django_session`.`session_key`,
`django_session`.`session_data`, `django_session`.`expire_date` FROM
`django_session` WHERE (`django_session`.`session_key` =
97bf63456064cb8d5682f762a4d7faef AND `django_session`.`expire_date` >
2010-11-01 11:55:14 )
LineMethod  File
132 _worker build/bdist.linux-i686/egg/flup/server/threadpool.py
669 run build/bdist.linux-i686/egg/flup/server/fcgi_base.py
705 process_input   build/bdist.linux-i686/egg/flup/server/
fcgi_base.py
805 _do_params  build/bdist.linux-i686/egg/flup/server/fcgi_base.py
789 _start_request  build/bdist.linux-i686/egg/flup/server/
fcgi_base.py
574 run 

Repost Admin Site Without Graphics

2010-11-01 Thread octopusgrabbus
Sorry for reposting a previous question, but Google temporarily
blocked my access to Groups for going back too far, too fast in this
group to find my original post.

My admin site works, but without graphics.

I've done the following to fix this.

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/
django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'/home/amr/django/templates',
'/usr/local/lib/python2.6/site-packages/django/contrib/admin/
templates/registration',
)
in settings.py

What else do I need to do?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: about file uploading

2010-11-01 Thread Lic . José M . Rodriguez Bacallao
yes, I saw that page but this is a complete application, I need
someting with source code for mimifiying in django

On Mon, Nov 1, 2010 at 1:35 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Here, let me google that for you..
> http://www.radinks.com/upload/plus/resume.php
> http://www.google.co.uk/search?sourceid=chrome=UTF-8=http+upload+resume
> Please make sure you make reasonable attempt to find the answer yourself on
> Google, otherwise the boards get filled with copy pasta.
> On Mon, Nov 1, 2010 at 6:30 PM, Lic. José M. Rodriguez Bacallao
>  wrote:
>>
>> hi folks, I need to develop an application for uploading big files but
>> one requirement is that I must be able to resume a partially uploaded
>> file. How can I achieve this with django, any ideas?
>>
>> --
>> Lic. José M. Rodriguez Bacallao
>> Centro de Biofisica Medica
>> -
>> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
>> mismo.
>>
>> Recuerda: El arca de Noe fue construida por aficionados, el titanic
>> por profesionales
>> -
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>
>
>
> --
>
> Cal Leeming
>
> Operational Security & Support Team
>
> Out of Hours: +44 (07534) 971120 | Support
> Tickets: supp...@simplicitymedialtd.co.uk
> Fax: +44 (02476) 578987 | Email: cal.leem...@simplicitymedialtd.co.uk
> IM: AIM / ICQ / MSN / Skype (available upon request)
>
> Simplicity Media Ltd. All rights reserved.
> Registered company number 7143564
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>



-- 
Lic. José M. Rodriguez Bacallao
Centro de Biofisica Medica
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: about file uploading

2010-11-01 Thread Cal Leeming [Simplicity Media Ltd]
Here, let me google that for you..

http://www.radinks.com/upload/plus/resume.php


http://www.google.co.uk/search?sourceid=chrome=UTF-8=http+upload+resume

Please make sure you make reasonable attempt to find the answer yourself on
Google, otherwise the boards get filled with copy pasta.

On Mon, Nov 1, 2010 at 6:30 PM, Lic. José M. Rodriguez Bacallao <
jmr...@gmail.com> wrote:

> hi folks, I need to develop an application for uploading big files but
> one requirement is that I must be able to resume a partially uploaded
> file. How can I achieve this with django, any ideas?
>
> --
> Lic. José M. Rodriguez Bacallao
> Centro de Biofisica Medica
> -
> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
> mismo.
>
> Recuerda: El arca de Noe fue construida por aficionados, el titanic
> por profesionales
> -
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 

Cal Leeming

Operational Security & Support Team

*Out of Hours: *+44 (07534) 971120 | *Support Tickets: *
supp...@simplicitymedialtd.co.uk
*Fax: *+44 (02476) 578987 | *Email: *cal.leem...@simplicitymedialtd.co.uk
*IM: *AIM / ICQ / MSN / Skype (available upon request)
Simplicity Media Ltd. All rights reserved.
Registered company number 7143564

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



about file uploading

2010-11-01 Thread Lic . José M . Rodriguez Bacallao
hi folks, I need to develop an application for uploading big files but
one requirement is that I must be able to resume a partially uploaded
file. How can I achieve this with django, any ideas?

-- 
Lic. José M. Rodriguez Bacallao
Centro de Biofisica Medica
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Ok, thanks all,

So following Bill's advice, i did:
>python manage.py shell
>>> import game.models
>>> list(game.models.Location.objects.filter( \
...   x__gte=34, \
...   x__lte=46, \
...   y__gte=24, \
...   y__lte=36))

...and the result showed up instantly!
So it seems DB is not the issue.
Will do other testing...


On Nov 1, 4:18 pm, Bill Freeman  wrote:
> My experience with Django debug toolbar is that it makes things
> slow all by itself.
>
> I have done a couple of apps that use the equivalent query, using PostgreSQL,
> without noticing a performance issue, with everything running on a Linux 
> server.
>
> 1. Have you tried timing the query by hand?  That is, run the manage.py shell,
> import your model, and type a sample version of the query, wrapped in a list()
> operation to force the query to evaluate right away.  If it's slow,
> then you problem
> is at least mostly in your DB/query choice.
>
> 2. Is the machine in question tight on memory?  That could make things slower
> that it would be on a production instance.
>
> 3.  You might look at the "range" field lookup instead of pairs of
> gte, lte.  I doubt
> that it makes a performance difference, and I don't know if SQLite supports
> BETWEEN, but it's easy to try.
>
> 4. You show x and y as integers, but if that was just by way of example, and
> they are really some complex (non-scalar) data type, the comparisons may not
> be cheap on the database.
>
> Bill
>
> On Mon, Nov 1, 2010 at 8:13 AM, Javier Guerra Giraldez
>
>  wrote:
> > On Mon, Nov 1, 2010 at 5:55 AM, Cal Leeming [Simplicity Media Ltd]
> >  wrote:
> >> 9 out of 10 times, the bottleneck is usually the database
>
> > true, but 8.7 of those 9 are about how the database is used, and not
> > about the engine choice.  simply changing SQLite won't improve
> > significantly the one-user case.
>
> > the trick is: 1) get as few db queries as possible for each page.  2)
> > use appropriate indices for those queries
>
> > but first of all, you have to identify if it is really the DB where
> > you're spending time.  the easiest way to be sure is to install
> > django_debug_toolbar app, it's great to tell you exactly what's going
> > on with the time and the DB accesses.
>
> > --
> > Javier
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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-us...@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: table namespace hygiene: should I try to rename auth_* tables, or should I use a separate database?

2010-11-01 Thread Alex
I poked around a little, and it looks like MySQL actually does support
foreign keys across databases.

I guess my questions are:

As long as the separate databases are not explicitly distributed eg.
to different machines or different CPUs, is there any disadvantage to
joining or constraining across database boundaries?

And/or is there a good way for me to customize the names of the tables
created by eg., auth, to dampen my urge to use a different database
just for the sake of namespace hygiene? (I'm thinking that the answer
to this is "no".)

Thanks
Alex



On Nov 1, 7:58 am, Scott Gould  wrote:
> > If not, I could create a new database, and devote it to the django
> > stuff. Is that a good solution? Are there significant disadvantages to
> > using a separate mysql database just for the django stuff? Is there
> > maintenance overhead for the dba? (I don't know.) Are there any
> > disadvantages, say, to doing trans-database joins, or having trans-
> > database key constraints, vs. within a single database?
>
> I am not a database expert -- only know enough to get by -- but as far
> as I am aware MySQL does not support foreign keys across databases.
> That is, you can put the auth system anywhere you like, but anything
> that references the auth models will need to be in the same database,
> directly or indirectly. Very likely a road you don't want to walk down.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Aggregates are giving the wrong numbers for .annotate()? What am I doing wrong?

2010-11-01 Thread Tom Evans
On Fri, Oct 29, 2010 at 6:30 PM, Jumpfroggy  wrote:
> Hi all,
>
> I've been working in django for a while now, but am still wrapping my
> head around the more complex queryset features.
>
> I have something like this:
>
> class Foo:
>    name = CharField()
>    bars = ForeignKey(Bar)
>    widgets = ForeignKey(Widget)
>
> I can do this:
>
> Foo.objects.extra(select={
>    'num_bars': 'SELECT COUNT(*) FROM app_bar WHERE app_bar.foo_id =
> app_foo.id',
>    'num_widgets': 'SELECT COUNT(*) FROM app_widget WHERE
> app_widget.foo_id = app_foo.id',
> })
>

Colour me confused - in your model definition, you define Foo as
having a foreign key to Widget, but then your query infers that Widget
in fact has a foreign key to Foo. Can you clarify?

Cheers

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-us...@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: odd apache issues

2010-11-01 Thread Matthew Stroud
I have found the issue, it appears that I didn't have the compression 
development libraries installed while compiling mod_wsgi. After installing 
those and recompiling, the issue has gone away.

Thanks for the help.

On Oct 28, 2010, at 3:07 PM, kicker wrote:

> I'm having an odd issue when I start up my project using apache/wsgi.
> The project works fine when using the development server, but when I
> load it up in apache it states that mysql is
> "'django.db.backends.mysql' isn't an available database backend.".
> 
> Here is my db config (edited to remove user/pass):
> 
> DATABASES = {
>'default': {
>'ENGINE': 'django.db.backends.mysql', # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
>'NAME': 'baz',  # Or path to database file
> if using sqlite3.
>'USER': 'foo',  # Not used with sqlite3.
>'PASSWORD': 'bar',  # Not used with sqlite3.
>'HOST': 'localhost',  # Set to empty
> string for localhost. Not used with sqlite3.
>'PORT': '',  # Set to empty string for
> default. Not used with sqlite3.
>}
> }
> 
> here is my wsgi file:
> 
> import os
> import sys
> 
> os.environ['DJANGO_SETTINGS_MODULE'] = 'baz.settings'
> os.environ['PYTHON_EGG_CACHE'] = '/var/www/baz/.egg'
> sys.path.append('/var/www')
> sys.path.append('/usr/lib64/python2.4/site-packages/')
> 
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
> 
> Anything I'm missing?
> 
> Here is the more verbose output:
> 
> Environment:
> 
> Request Method: GET
> Request URL: http://10.1.18.30/admin/
> Django Version: 1.2.3
> Python Version: 2.4.3
> Installed Applications:
> ['django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware')
> 
> 
> Traceback:
> File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
> in get_response
>  80. response = middleware_method(request)
> File "/usr/lib/python2.4/site-packages/django/contrib/sessions/
> middleware.py" in process_request
>  10. engine = import_module(settings.SESSION_ENGINE)
> File "/usr/lib/python2.4/site-packages/django/utils/importlib.py" in
> import_module
>  35. __import__(name)
> File "/usr/lib/python2.4/site-packages/django/contrib/sessions/
> backends/db.py" in ?
>  3. from django.contrib.sessions.models import Session
> File "/usr/lib/python2.4/site-packages/django/contrib/sessions/
> models.py" in ?
>  4. from django.db import models
> File "/usr/lib/python2.4/site-packages/django/db/__init__.py" in ?
>  77. connection = connections[DEFAULT_DB_ALIAS]
> File "/usr/lib/python2.4/site-packages/django/db/utils.py" in
> __getitem__
>  91. backend = load_backend(db['ENGINE'])
> File "/usr/lib/python2.4/site-packages/django/db/utils.py" in
> load_backend
>  49. raise ImproperlyConfigured(error_msg)
> 
> Exception Type: ImproperlyConfigured at /admin/
> Exception Value: 'django.db.backends.mysql' isn't an available
> database backend.
> Try using django.db.backends.XXX, where XXX is one of:
>'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2',
> 'sqlite3'
> Error was: cannot import name utils
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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 mod_wsgi web application container?

2010-11-01 Thread Frank Wiles
On Mon, Nov 1, 2010 at 10:41 AM, funcrush  wrote:
> Hi all :)
> Recently, I made REST API that getting a post and deploy it with
> Apache (django + mod_wsgi..)
> But maybe, mod_wsgi is not container like tomcat (If I was wrong,
> please tell me..)
> (I don't know what I need exactly but..)
> Could I use mod_wsgi as web application container?
>
> Sorry for poor English.
> anyway thank you :)

It's not called a 'web application container', as that is a Java term,
but yes you can think of it that way. In general, mod_wsgi is
definitely the tool you'll want to use.

-- 
Frank Wiles
Revolution Systems | http://www.revsys.com/
fr...@revsys.com   | (800) 647-6298

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Apache config. admin page displays without stylesheets

2010-11-01 Thread Frank Wiles
On Sun, Oct 31, 2010 at 6:14 PM, elliot  wrote:
> Django runs as expected using manage.py runserver, but when I run it
> from apache certain files are not found.
>
> This is because the apache user has a different base directory than
> the user running manage.py.  So, I added absolute paths to my
> setting.py and other files. Now through apache one can access all the
> modules and pages just fine.  But when I try to go to /admin I see
> there is no css formatting. everything is very plain and not like the
> version through runserver at all.
>
> I assume this is because the css file is not being found.  But if the
> admin code is found, and allows me the properly add items and
> everything, why isn't the css found?
>
> granted, the html code I've written doesn't have any css going on, so
> I cant say that only the admin pages aren't rendering right.
>
> my apache setup looks like:
>    
>        SetHandler python-program
>        PythonHandler django.core.handlers.modpython
>        PythonPath "['/home/libadmin/library/django-ils/','/home/
> libadmin/library/django-ils/bookshare'] + sys.path"
>        SetEnv DJANGO_SETTINGS_MODULE bookshare.settings
>        PythonOption django.root /home/libadmin/library/django-ils/bookshare/
>        PythonDebug On
>   
>
> Thinking that a relative path to the css file was being misused I
> checked the source of the admin login page in firefox.  The admin site
> is looking for 
>
> this file exsists in both
> /usr/share/python-support/python-django/django/contrib/admin/media/css/
> login.css
> /var/lib/python-support/python2.5/django/contrib/admin/media/css/
> login.css
>
> so, is django not finding this file because of an irrendered relative
> path?  and if so, what is wrong with my configuration that this isn't
> found?
>
> (This is being run from a cloned mercurial repo, so I did not start
> this project on this machine with the django scripts.  if this is the
> issue, is there a way to manually do what the startproject or startapp
> scripts are supposed to do?)

Hi Elliot,

Actually 'Django' doesn't need to find these at all, it's Apache that
is having the issue.  First off you probably want to be using mod_wsgi
and not mod_python as that mod_python project is no longer actively
maintained.

What you need to do is add a  directive for your media
locations such that Apache can find these files, or more correctly
that Apache believes it is authorized to serve those files.  Watch
your Apache error log and you'll see tons of 404s for your media
files.

-- 
Frank Wiles
Revolution Systems | http://www.revsys.com/
fr...@revsys.com   | (800) 647-6298

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Using formsets with multiple models

2010-11-01 Thread Matt Conrad
On Fri, Oct 29, 2010 at 11:58 AM, Bill Brigham  wrote:

> On a questionnaire, you have one or more questions which will require
> either an essay answer or multiple choice answers. When creating a new
> questionnaire, I would like to show a textarea for the Question.text
> common to both types, a radio select for the Question.question_type,
> and then present either the EssayQuestion.initial_answer textarea or
> the inputs for adding multiple choice options. The user can click "add
> question" to append another form beneath to enter a new question. It's
> only on the final "save questionnaire" that I handle the POST and
> save.

First, let me say that I'm still learning Django myself, and don't
understand formsets especially well. There might be an easy and/or
elegant way to handle this with formsets that I don't know.

That said, if you are only entering new questions one by one, it sure
sounds easier to me to POST and save each new question individually.
If there aren't many questions per questionaire, it probably wouldn't
hurt to post/refresh the whole page each question. If there are a lot
of questions, you could use javascript to make the building process
smoother for the user.

> I have spent a few days now trying different permutations of
> formsets, modelformsets and inline_formsets but to no avail. The
> closest I've got is to create a QuestionFormset, EssayQuestionFormset
> and a MultipleChoiceQuestionFormset, then keep track of which form
> belongs to which question when saving. I'm not sure how to reconstruct
> the forms should it raise validation errors though.
>
> Another option is to create a QuestionForm containing fields for 0..N
> possible fields, i.e. multiplechoice_choice_0,
> multiplechoice_correct_0, multiplechoice_choice_1,... But this feels
> wrong to me.

Me too.

> It seems overly complicated which makes me think I'm going about it
> the wrong way. Any help would be much appreciated please!

If you can do it, handling one question at a time will be easier. And
it will be easier to maintain when you have to add a new question type
of checkbox, dropdown list, or whatever it is they'll want next.  :)

Matt

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Is mod_wsgi web application container?

2010-11-01 Thread funcrush
Hi all :)
Recently, I made REST API that getting a post and deploy it with
Apache (django + mod_wsgi..)
But maybe, mod_wsgi is not container like tomcat (If I was wrong,
please tell me..)
(I don't know what I need exactly but..)
Could I use mod_wsgi as web application container?

Sorry for poor English.
anyway 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-us...@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: 2D map application: performance and design question

2010-11-01 Thread Bill Freeman
My experience with Django debug toolbar is that it makes things
slow all by itself.

I have done a couple of apps that use the equivalent query, using PostgreSQL,
without noticing a performance issue, with everything running on a Linux server.

1. Have you tried timing the query by hand?  That is, run the manage.py shell,
import your model, and type a sample version of the query, wrapped in a list()
operation to force the query to evaluate right away.  If it's slow,
then you problem
is at least mostly in your DB/query choice.

2. Is the machine in question tight on memory?  That could make things slower
that it would be on a production instance.

3.  You might look at the "range" field lookup instead of pairs of
gte, lte.  I doubt
that it makes a performance difference, and I don't know if SQLite supports
BETWEEN, but it's easy to try.

4. You show x and y as integers, but if that was just by way of example, and
they are really some complex (non-scalar) data type, the comparisons may not
be cheap on the database.

Bill

On Mon, Nov 1, 2010 at 8:13 AM, Javier Guerra Giraldez
 wrote:
> On Mon, Nov 1, 2010 at 5:55 AM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
>> 9 out of 10 times, the bottleneck is usually the database
>
> true, but 8.7 of those 9 are about how the database is used, and not
> about the engine choice.  simply changing SQLite won't improve
> significantly the one-user case.
>
> the trick is: 1) get as few db queries as possible for each page.  2)
> use appropriate indices for those queries
>
> but first of all, you have to identify if it is really the DB where
> you're spending time.  the easiest way to be sure is to install
> django_debug_toolbar app, it's great to tell you exactly what's going
> on with the time and the DB accesses.
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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-voting url pattern

2010-11-01 Thread Sithembewena Lloyd Dube
Thanks Daniel, makes sense. Also, I was making the mistake of thinking that
I had to create a separate view, forgetting that I am calling the one
supplied by django-voting. That correct?



On Mon, Nov 1, 2010 at 3:45 PM, Daniel Roseman wrote:

> On Nov 1, 1:23 pm, Sithembewena Lloyd Dube  wrote:
> > Hi all,
> >
> > I have django-voting installed and am trying to get through the 'recipe'.
>  I
> > have a url pattern which (I expect) should route voting actions to a
> view.
> >
> > Problem is, which view or views should handle this? The URL pattern is as
> > follows:
> >
> >
>  (r'^videos/(?P\d+)/(?P*up|down|clear)*vote/?$',
> > vote_on_object, video_dict),
> >
> > I can see that object_id is being trapped as a parameter, but what is the
> > italicised/ bold section doing and what URL do I then get out of it? In
> > other words, I cannot decide what the view/s to handle the URL should be.
> >
> > Thanks,
> >
> > --
> > Regards,
> > Sithembewena Lloyd Dubehttp://www.lloyddube.com
>
> That constrains the acceptable values of `direction` to one of 'up',
> 'down' or 'clear'. Any other value there will mean the URL isn't
> matched.
>
> So the URL is, for example:
> /videos/1/upvote/
> /videos/1/downvote/
> /videos/1/clearvote/
>
> and the view will have parameters of object_id 1 and direction up,
> down or clear.
> --
> 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-us...@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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.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-us...@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: Executing ssh scripts with django

2010-11-01 Thread Knut Ivar Nesheim
On Mon, Nov 1, 2010 at 3:17 PM, Marc Aymerich  wrote:
> I've never heard before about configuration management systems. Now I just
> read something about it on wikipedia and seems to be useful when you have a
> lot of similar servers. In my organization we have only one web server, one
> DB server and one primary mail server. Does the use of CM make sense on
> my scenario somehow?

The great benefit about these systems is that you can go from a
freshly installed machine, to a machine with all the necessary
packages, services and configuration all in place, without any manual
work other than starting the configuration management system.

There is a big initial investment to start using these systems, and
everything you do to your machines you need to do through the tool.
For your scale this might not be a good investment.

Another benefit of systems like Chef is that the configurations is
plain text, so you can use your normal development tools, like version
control, peer review, etc. It becomes very easy to reason about the
proposed change, when you have a diff at hand.

Regards
Knut

>
> Thanks!
> marc.
>
> On Mon, Nov 1, 2010 at 9:29 AM, Knut Ivar Nesheim  wrote:
>>
>> Hi,
>>
>> I would strongly suggest looking into using Celery or some other form
>> of message queue.
>>
>> In general you want to decouple the logic of the web app, such as
>> validating domain names, writing to the database, with operations that
>> has real-world important side effects. Once you split these, the
>> system as a whole is much easier to understand for newcomers, much
>> easier to reason about and above all, actually possible to test.
>>
>> The operations that has side effects on your other systems is thus a
>> separate part of your system. That way you can test them in isolation
>> and you may even run a failed operation several times, without
>> requiring work from the user. You could also batch the operations if
>> necessary.
>>
>> A separation like this requires some a new concept for communication
>> with the user. This can be as simple as "You just added a new virtual
>> host. We will send you a confirmation when the host is active."
>>
>> As a side note, I would strongly recommend writing your operations in
>> such a way that you may run the same operation more than once and
>> achieve the same result. Otherwise you will run into nastiness. And if
>> you want to update a virtual host, just run the "add_virtualhost"
>> operation again, but this time with updated data.
>>
>> You could also look into using a configuration management system, like
>> Chef. You could then have your system create Chef recipes.
>>
>> Regards
>> Knut
>>
>> On Sun, Oct 31, 2010 at 3:05 PM, Marc Aymerich 
>> wrote:
>> > Hi guys,
>> > I'm developing an ISP control panel for my organization. I just finished
>> > the
>> > web interface based on django admin and now it's time to introduce calls
>> > to
>> > the "system scripts" in order to make the changes effective on the ISP
>> > servers (add users, manage virtualhosts, domains, and all this stuff).
>> > To
>> > achieve that I was thinking in overriding the save and delete methods
>> > from
>> > my models ( virtualhost model, domain model..). For example. before
>> > saving a
>> > new "apache virtualhost" I want to run a proper "create vhost" script
>> > through ssh using Paramiko library and if it is successful save the new
>> > virtualhost into the database, otherwise send a message to enduser
>> > telling
>> > that an error has occurred.
>> >
>> > class Virtualhost(models.Model):
>> >     
>> >     def save(self, *args, **kwargs):
>> >          if not self.id:
>> >              ssh = Ssh('create_new_virtualhost', self)
>> >              if ssh.errors:
>> >                   message.add(self.user, 'something wrong was happend')
>> >              else:
>> >                    super(self, Virtualhost).save(*args, **kwargs)
>> >
>> > I'm wondering if this approach is the right way for the interaction
>> > between
>> > django and ISP servers.
>> > Moreover, I read that is highly recommended to use a message queue like
>> > celery in order to avoid a possible 'long wait' until ssh command ends
>> > [1].
>> > Would you execute the save function through celery? Is it safe? or maybe
>> > if
>> > save() is executed asynchronously it can cause some unexpected behavior?
>> > I need some "expert" opinion here :) Would you affront this situation in
>> > a
>> > similar way or would you take a completely different approach?
>> > Many thanks!!
>> > [1]
>> >
>> > http://www.quora.com/How-can-I-remotely-execute-a-script-via-SSH-from-a-Django-view
>> >
>> >
>> >
>> >
>> >
>> > --
>> > Marc
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > 

Re: Filtering Admin Inlines

2010-11-01 Thread derek
Its not clear if you want to filter the choices before the form is
displayed, or dynamically in the browser?

On Oct 26, 7:29 pm, Lllama  wrote:
> Hello all,
>
> I've got an admin site that includes some inlines. These in turn
> contain a ChoiceField. I'd like to filter the choices based on an
> attribute of the parent model. Does anyone know if this is possible
> and, if so, what hook I need to use?
>
> I feel like I should be able to use formfield_for_dbfield, but it's
> getting at that pesky parent that I'm unsure of.
>
> Any help gratefully received,
>
> Felix

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: ImportError: Could not import settings 'flyp.settings' (Is it on sys.path? Does it have syntax errors?): No module named flyp.settings

2010-11-01 Thread Tom Evans
Perhaps try sending the same question another 3 times in an hour, that
always encourages people to help you.

> ImportError: Could not import settings 'flyp.settings' (Is it on
> sys.path? Does it have syntax errors?): No module named flyp.settings

Is it on sys.path? Does it have syntax errors?


Less importantly - why are you using mod_python?

Cheers

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-us...@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: Editing user profiles via "inlines" breaks password management in admin site

2010-11-01 Thread derek
Update: seemingly the "two stage" is the way to do it.  I have not
managed to get any alternative methods to work (and there are more
pressing problems :)

On Oct 27, 9:07?am, derek  wrote:
> Actually, it seems more complex... ?you now have a 2 stage operation
> to carry out what should be a relatively(?) simple operation - add a
> user with their details.
>
> I have *exactly* the same problem as the original user - is there no
> one else who has managed to create a usuable User+Profile admin edit
> form?
>
> (Sidebar: Django is all kinds of wonderful, but user management seems
> strangely clunky compared to all the other goodness...)
>
> On Oct 13, 1:48?pm, Martin Burger  wrote:
>
> > Oh, thanks! Actually, it's much simpler this way.
>
> > On Oct 13, 12:29?pm, Jonathan Barratt 
> > wrote:
>
> > > On 13 ?.?. 2010, at 17:19, Martin Burger wrote:
>
> > > > Hello,
>
> > > > I implemented a user profile that is activated via AUTH_PROFILE_MODULE
> > > > in settings.py. In order to be able to view and edit user profiles in
> > > > the admin site, I used the method described at
> > > >http://stackoverflow.com/questions/3400641/how-do-i-inline-edit-a-dja
> > > > Basically, this method uses a custom ModelAdmin to enable inline
> > > > editing.
>
> > > > 
> > > > How can I enable viewing / editing of user profiles while preserving
> > > > the original password functionality?
>
> > > The way I'm doing this is just to add 
> > > "admin.site.register(models.UserProfile)" to my admin.py
>
> > > This makes the user profiles available through the admin section as a 
> > > separate entity, like any other model class. It's not in-line editing 
> > > under the same section as the basic Django user module, so you do have to 
> > > create the user first and then create their profile separately, but it 
> > > avoids the problems you're running into and seems like the simplest 
> > > solution to your problem to me...
>
> > > Others with more Django experience may have a better answer for you 
> > > though.
>
> > > Best wishes,
> > > Jonathan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Executing ssh scripts with django

2010-11-01 Thread Andrej
> I'm developing an ISP control panel for my organization.

a bit off topic on Django and ISP. Look at the NOC Project
http://www.nocproject.org/

> NOC is an Operation Support System (OSS) for the Telco,
> Service provider and Enterprise Network Operation Centers (NOC).
> Written in Python language and utilizing the power
> of Django framework and PostgreSQL RDBMS .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: minimum system requirements

2010-11-01 Thread Peter Herndon

On Oct 31, 2010, at 9:50 PM, Javier Guerra Giraldez wrote:

> On Sun, Oct 31, 2010 at 12:10 PM, Peter Herndon  wrote:
>> but I would not expect that single VPS to be able to handle more than a very 
>> small number of visitors at once.
> 
> only if you consider several dozens  "a very small number"
> 
That rather depends on what your app does, don't you think?  If your app has 
dynamic elements for each and every visitor, and runs large calculations on 
each page hit, it's possible to max out a small VPS with one client.  On the 
other hand, if you set up e.g. Varnish with full-page caching, and have a site 
that changes only once every few days, yes indeed you can support several 
dozens of concurrent users.  But either way, a single small server still won't 
be able to handle a full-on slashdotting.  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



ImportError: Could not import settings 'flyp.settings' (Is it on sys.path? Does it have syntax errors?): No module named flyp.settings

2010-11-01 Thread sami nathan
MY system path is
D:\Python25\Lib\site-packages\django\bin\admin.py;D:\Python25;D:\Program
Files\Subversion\bin:D:\Python25\Lib\site-packages\django;D:\Python25\Lib\site-packages\django\bin\flyp;D:\Python25\Tools;D:\Python25\Lib\site-packages\django\bin\flyp\settings;

my LOCATION looks like this

   SetHandler python-program
   PythonHandler django.core.handlers.modpython
   SetEnv DJANGO_SETTINGS_MODULE flyp.settings
   PythonOption django.root /flyp
   PythonDebug On
   PythonPath 
"['D:/Python25','D:/Python25/Lib/site-packages/django/bin/flyp','D:/Python25/Lib/site-packages/django/bin/flyp/settings',]
+ sys.path"
  
i AM GETTING FOLLOWING ERROR

MOD_PYTHON ERROR

ProcessId:  3908
Interpreter:'192.168.1.116'

ServerName: '192.168.1.116'
DocumentRoot:   'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs'

URI:'/flyp/'
Location:   '/flyp/'
Directory:  None
Filename:   'C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/flyp/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
   default=default_handler, arg=req, silent=hlist.silent)

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1229, in _process_target
   result = _execute_target(config, req, object, arg)

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1128, in _execute_target
   result = object(arg)

 File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 213, in handler
   return ModPythonHandler()(req)

 File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 174, in __call__
   self.load_middleware()

 File "D:\Python25\lib\site-packages\django\core\handlers\base.py",
line 37, in load_middleware
   for middleware_path in settings.MIDDLEWARE_CLASSES:

 File "D:\Python25\lib\site-packages\django\utils\functional.py",
line 276, in __getattr__
   self._setup()

 File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
41, in _setup
   self._wrapped = Settings(settings_module)

 File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
76, 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 'flyp.settings' (Is it on
sys.path? Does it have syntax errors?): No module named flyp.settings

AND ALSO GETTING THIS ERROR WHILE CREATING DATABASE
Exception exceptions.AttributeError: '_shutdown' in  ignored

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Executing ssh scripts with django

2010-11-01 Thread Marc Aymerich
Hi Knut, many thanks for your recommendations, I'll follow them!. All you've
comment has a lot of sense :)

I've never heard before about configuration management systems. Now I just
read something about it on wikipedia and seems to be useful when you have a
lot of similar servers. In my organization we have only one web server, one
DB server and one primary mail server. Does the use of CM make sense on
my scenario somehow?

Thanks!
marc.

On Mon, Nov 1, 2010 at 9:29 AM, Knut Ivar Nesheim  wrote:

> Hi,
>
> I would strongly suggest looking into using Celery or some other form
> of message queue.
>
> In general you want to decouple the logic of the web app, such as
> validating domain names, writing to the database, with operations that
> has real-world important side effects. Once you split these, the
> system as a whole is much easier to understand for newcomers, much
> easier to reason about and above all, actually possible to test.
>
> The operations that has side effects on your other systems is thus a
> separate part of your system. That way you can test them in isolation
> and you may even run a failed operation several times, without
> requiring work from the user. You could also batch the operations if
> necessary.
>
> A separation like this requires some a new concept for communication
> with the user. This can be as simple as "You just added a new virtual
> host. We will send you a confirmation when the host is active."
>
> As a side note, I would strongly recommend writing your operations in
> such a way that you may run the same operation more than once and
> achieve the same result. Otherwise you will run into nastiness. And if
> you want to update a virtual host, just run the "add_virtualhost"
> operation again, but this time with updated data.
>
> You could also look into using a configuration management system, like
> Chef. You could then have your system create Chef recipes.
>
> Regards
> Knut
>
> On Sun, Oct 31, 2010 at 3:05 PM, Marc Aymerich 
> wrote:
> > Hi guys,
> > I'm developing an ISP control panel for my organization. I just finished
> the
> > web interface based on django admin and now it's time to introduce calls
> to
> > the "system scripts" in order to make the changes effective on the ISP
> > servers (add users, manage virtualhosts, domains, and all this stuff). To
> > achieve that I was thinking in overriding the save and delete methods
> from
> > my models ( virtualhost model, domain model..). For example. before
> saving a
> > new "apache virtualhost" I want to run a proper "create vhost" script
> > through ssh using Paramiko library and if it is successful save the new
> > virtualhost into the database, otherwise send a message to enduser
> telling
> > that an error has occurred.
> >
> > class Virtualhost(models.Model):
> > 
> > def save(self, *args, **kwargs):
> >  if not self.id:
> >  ssh = Ssh('create_new_virtualhost', self)
> >  if ssh.errors:
> >   message.add(self.user, 'something wrong was happend')
> >  else:
> >super(self, Virtualhost).save(*args, **kwargs)
> >
> > I'm wondering if this approach is the right way for the interaction
> between
> > django and ISP servers.
> > Moreover, I read that is highly recommended to use a message queue like
> > celery in order to avoid a possible 'long wait' until ssh command ends
> [1].
> > Would you execute the save function through celery? Is it safe? or maybe
> if
> > save() is executed asynchronously it can cause some unexpected behavior?
> > I need some "expert" opinion here :) Would you affront this situation in
> a
> > similar way or would you take a completely different approach?
> > Many thanks!!
> > [1]
> >
> http://www.quora.com/How-can-I-remotely-execute-a-script-via-SSH-from-a-Django-view
> >
> >
> >
> >
> >
> > --
> > Marc
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@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.
> >
>



-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Free Blog built on Django and run in AppEngine

2010-11-01 Thread Sithembewena Lloyd Dube
Thanks Russ!

On Mon, Nov 1, 2010 at 3:53 PM, Russell Keith-Magee  wrote:

> On Mon, Nov 1, 2010 at 9:43 PM, Sithembewena Lloyd Dube
>  wrote:
> >
> > Could somebody please take care of this idiot?? Spammed me after my
> response to a thread post.
> >
>
> I've just banned the account.
>
> Interestingly, he was mailing list members directly, not spamming the
> list. This is an approach that gets around our usual moderation
> procedures -- hopefully it won't catch on as a technique.
>
> 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-us...@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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.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-us...@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: Free Blog built on Django and run in AppEngine

2010-11-01 Thread Russell Keith-Magee
On Mon, Nov 1, 2010 at 9:43 PM, Sithembewena Lloyd Dube
 wrote:
>
> Could somebody please take care of this idiot?? Spammed me after my response 
> to a thread post.
>

I've just banned the account.

Interestingly, he was mailing list members directly, not spamming the
list. This is an approach that gets around our usual moderation
procedures -- hopefully it won't catch on as a technique.

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



Fwd: ImportError: Could not import settings 'flyp.settings' (Is it on sys.path? Does it have syntax errors?): No module named flyp.settings

2010-11-01 Thread sami nathan
-- Forwarded message --
From: sami nathan 
Date: Mon, Nov 1, 2010 at 6:42 PM
Subject: ImportError: Could not import settings 'flyp.settings' (Is it
on sys.path? Does it have syntax errors?): No module named
flyp.settings
To: django-users@googlegroups.com


MY system path is
D:\Python25\Lib\site-packages\django\bin\admin.py;D:\Python25;D:\Program
Files\Subversion\bin:D:\Python25\Lib\site-packages\django;D:\Python25\Lib\site-packages\django\bin\flyp;D:\Python25\Tools;D:\Python25\Lib\site-packages\django\bin\flyp\settings;

my LOCATION looks like this

   SetHandler python-program
   PythonHandler django.core.handlers.modpython
   SetEnv DJANGO_SETTINGS_MODULE flyp.settings
   PythonOption django.root /flyp
   PythonDebug On
   PythonPath 
"['D:/Python25','D:/Python25/Lib/site-packages/django/bin/flyp','D:/Python25/Lib/site-packages/django/bin/flyp/settings',]
+ sys.path"
  
i AM GETTING FOLLOWING ERROR

MOD_PYTHON ERROR

ProcessId:      3908
Interpreter:    '192.168.1.116'

ServerName:     '192.168.1.116'
DocumentRoot:   'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs'

URI:            '/flyp/'
Location:       '/flyp/'
Directory:      None
Filename:       'C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/flyp/'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'django.core.handlers.modpython'

Traceback (most recent call last):

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
   default=default_handler, arg=req, silent=hlist.silent)

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1229, in _process_target
   result = _execute_target(config, req, object, arg)

 File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1128, in _execute_target
   result = object(arg)

 File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 213, in handler
   return ModPythonHandler()(req)

 File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 174, in __call__
   self.load_middleware()

 File "D:\Python25\lib\site-packages\django\core\handlers\base.py",
line 37, in load_middleware
   for middleware_path in settings.MIDDLEWARE_CLASSES:

 File "D:\Python25\lib\site-packages\django\utils\functional.py",
line 276, in __getattr__
   self._setup()

 File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
41, in _setup
   self._wrapped = Settings(settings_module)

 File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
76, 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 'flyp.settings' (Is it on
sys.path? Does it have syntax errors?): No module named flyp.settings

AND ALSO GETTING THIS ERROR WHILE CREATING DATABASE
Exception exceptions.AttributeError: '_shutdown' in  ignored

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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-voting url pattern

2010-11-01 Thread Daniel Roseman
On Nov 1, 1:23 pm, Sithembewena Lloyd Dube  wrote:
> Hi all,
>
> I have django-voting installed and am trying to get through the 'recipe'.  I
> have a url pattern which (I expect) should route voting actions to a view.
>
> Problem is, which view or views should handle this? The URL pattern is as
> follows:
>
>      (r'^videos/(?P\d+)/(?P*up|down|clear)*vote/?$',
> vote_on_object, video_dict),
>
> I can see that object_id is being trapped as a parameter, but what is the
> italicised/ bold section doing and what URL do I then get out of it? In
> other words, I cannot decide what the view/s to handle the URL should be.
>
> Thanks,
>
> --
> Regards,
> Sithembewena Lloyd Dubehttp://www.lloyddube.com

That constrains the acceptable values of `direction` to one of 'up',
'down' or 'clear'. Any other value there will mean the URL isn't
matched.

So the URL is, for example:
/videos/1/upvote/
/videos/1/downvote/
/videos/1/clearvote/

and the view will have parameters of object_id 1 and direction up,
down or clear.
--
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-us...@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: Free Blog built on Django and run in AppEngine

2010-11-01 Thread Sithembewena Lloyd Dube
Could somebody please take care of this idiot?? Spammed me after my response
to a thread post.

On Mon, Nov 1, 2010 at 3:19 PM, dipti seni  wrote:

>
>>  * DO YOU LIKE LOVE MARRIAGE 
>> ?
>> *
>>
>>
>> Free Register    , Free 
>> Chat
>>
>>
>>
>>
>>
>>
>>  
>> Greetings for Diwali
>>
>> *Offer 20% Discount*
>> [image: FREE Animations for your
>> email - by IncrediMail! Click Here!]   Corporate
>> Office :  Ksrista.com, ks online services pvt. ltd. baludyan road uttam
>> nagar delhi
>>
>>Toll Free : 1800-470-8521  +91-9050118000
>>   www.ksrista.com
>>
>>
>>
>>


-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.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-us...@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: Howto crypt forms in Django?

2010-11-01 Thread ckar...@googlemail.com
Hi Cal,

thanks for your informations. Now it's clear.

Christian

On 1 Nov., 13:27, "Cal Leeming [Simplicity Media Ltd]"
 wrote:
> Hi Christian,
>
> Can I just also mention, that relying on encrypted forms (based on a
> static key from the server) is not very good practice.
>
> At the very most, you can rely on it for client side obfuscation, but
> don't ever rely on it for security.
>
> An SSL certificate is almost certainly the way to go if you want to
> protect data from being sniffed.
>
> If you want to protect against CSRF, then see:
>
> http://docs.djangoproject.com/en/dev/ref/contrib/csrf/
>
> Hope this helps.
>
> Cal
>
> On 01/11/2010 11:19, ckar...@googlemail.com wrote:
>
> > Hi everybody,
>
> > is there a way not to send form data in plain-text format? I've found
> > jCryption for PHP ("In short words jCryption is a javascript HTML-Form
> > encryption plugin, which encrypts the POST/GET-Data that will be sent
> > when you submit a form."). Is there a way to crypt data without using
> > SSL?
>
> > Thanks, Christian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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-voting url pattern

2010-11-01 Thread Sithembewena Lloyd Dube
Hi all,

I have django-voting installed and am trying to get through the 'recipe'.  I
have a url pattern which (I expect) should route voting actions to a view.

Problem is, which view or views should handle this? The URL pattern is as
follows:

 (r'^videos/(?P\d+)/(?P*up|down|clear)*vote/?$',
vote_on_object, video_dict),

I can see that object_id is being trapped as a parameter, but what is the
italicised/ bold section doing and what URL do I then get out of it? In
other words, I cannot decide what the view/s to handle the URL should be.

Thanks,

-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.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-us...@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.



ImportError: Could not import settings 'flyp.settings' (Is it on sys.path? Does it have syntax errors?): No module named flyp.settings

2010-11-01 Thread sami nathan
MY system path is
D:\Python25\Lib\site-packages\django\bin\admin.py;D:\Python25;D:\Program
Files\Subversion\bin:D:\Python25\Lib\site-packages\django;D:\Python25\Lib\site-packages\django\bin\flyp;D:\Python25\Tools;D:\Python25\Lib\site-packages\django\bin\flyp\settings;

my LOCATION looks like this

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE flyp.settings
PythonOption django.root /flyp
PythonDebug On
PythonPath 
"['D:/Python25','D:/Python25/Lib/site-packages/django/bin/flyp','D:/Python25/Lib/site-packages/django/bin/flyp/settings',]
+ sys.path"
   
i AM GETTING FOLLOWING ERROR

MOD_PYTHON ERROR

ProcessId:  3908
Interpreter:'192.168.1.116'

ServerName: '192.168.1.116'
DocumentRoot:   'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs'

URI:'/flyp/'
Location:   '/flyp/'
Directory:  None
Filename:   'C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/flyp/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

  File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1229, in _process_target
result = _execute_target(config, req, object, arg)

  File "D:\Python25\Lib\site-packages\mod_python\importer.py", line
1128, in _execute_target
result = object(arg)

  File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 213, in handler
return ModPythonHandler()(req)

  File "D:\Python25\lib\site-packages\django\core\handlers\modpython.py",
line 174, in __call__
self.load_middleware()

  File "D:\Python25\lib\site-packages\django\core\handlers\base.py",
line 37, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "D:\Python25\lib\site-packages\django\utils\functional.py",
line 276, in __getattr__
self._setup()

  File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
41, in _setup
self._wrapped = Settings(settings_module)

  File "D:\Python25\lib\site-packages\django\conf\__init__.py", line
76, 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 'flyp.settings' (Is it on
sys.path? Does it have syntax errors?): No module named flyp.settings

AND ALSO GETTING THIS ERROR WHILE CREATING DATABASE
Exception exceptions.AttributeError: '_shutdown' in  ignored

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Free Blog built on Django and run in AppEngine

2010-11-01 Thread Sithembewena Lloyd Dube
Hi Hudar,

I haven't checked out the code for this, but the interface looks nice and
clean. Will try to give it a squeeze later. Thanks!

On Mon, Nov 1, 2010 at 7:45 AM, Hudar  wrote:

> Hi,
>
>
> I just released a source code of my own blog as open source (called
> 'MeBlog'). Built the blog in django 1.2.3 and run in appengine.
> This blog has common features for blog, such as manage posts, manage
> pages, and manage media file. This is the first release, hope anyone
> enjoy.
> Feel free to write me any comment, sugggestion, bug report, or feature
> request.
>
> Source code available at http://bitbucket.org/hudarsono/meblog
>
> Preview and Real site : http://blog.hudarsono.me  (my own blog)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.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-us...@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: Howto crypt forms in Django?

2010-11-01 Thread Cal Leeming [Simplicity Media Ltd]

Hi Christian,

Can I just also mention, that relying on encrypted forms (based on a 
static key from the server) is not very good practice.


At the very most, you can rely on it for client side obfuscation, but 
don't ever rely on it for security.


An SSL certificate is almost certainly the way to go if you want to 
protect data from being sniffed.


If you want to protect against CSRF, then see:

http://docs.djangoproject.com/en/dev/ref/contrib/csrf/

Hope this helps.

Cal

On 01/11/2010 11:19, ckar...@googlemail.com wrote:

Hi everybody,

is there a way not to send form data in plain-text format? I've found
jCryption for PHP ("In short words jCryption is a javascript HTML-Form
encryption plugin, which encrypts the POST/GET-Data that will be sent
when you submit a form."). Is there a way to crypt data without using
SSL?

Thanks, Christian



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: 2D map application: performance and design question

2010-11-01 Thread Javier Guerra Giraldez
On Mon, Nov 1, 2010 at 5:55 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> 9 out of 10 times, the bottleneck is usually the database

true, but 8.7 of those 9 are about how the database is used, and not
about the engine choice.  simply changing SQLite won't improve
significantly the one-user case.

the trick is: 1) get as few db queries as possible for each page.  2)
use appropriate indices for those queries

but first of all, you have to identify if it is really the DB where
you're spending time.  the easiest way to be sure is to install
django_debug_toolbar app, it's great to tell you exactly what's going
on with the time and the DB accesses.

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Add admin action to Django User

2010-11-01 Thread Enrico
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User

class MyUserAdmin(UserAdmin):
actions = ['my_action']

def my_action(self, request, queryset):
# stuff here...

admin.site.unregister(User)
admin.site.register(User, MyUserAdmin)

Take a look here for more info:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/
http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/

Best regards,
Enrico

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Add admin action to Django User

2010-11-01 Thread Karim Gorjux
Maybe you'll find this also useful:

http://www.theotherblog.com/Articles/2009/06/02/extending-the-django-admin-interface/

-- 
K.
Blog Personale: http://www.karimblog.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-us...@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: table namespace hygiene: should I try to rename auth_* tables, or should I use a separate database?

2010-11-01 Thread Scott Gould
> If not, I could create a new database, and devote it to the django
> stuff. Is that a good solution? Are there significant disadvantages to
> using a separate mysql database just for the django stuff? Is there
> maintenance overhead for the dba? (I don't know.) Are there any
> disadvantages, say, to doing trans-database joins, or having trans-
> database key constraints, vs. within a single database?

I am not a database expert -- only know enough to get by -- but as far
as I am aware MySQL does not support foreign keys across databases.
That is, you can put the auth system anywhere you like, but anything
that references the auth models will need to be in the same database,
directly or indirectly. Very likely a road you don't want to walk down.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Hi Lukasz,
see my answer to Daniel. Replacing images by text didn't speed up
things much.
Is there any other test/profiling that i should do?
Would taking the systime before and after the query give me some
hints? I'll try this later...

On Nov 1, 12:39 pm, Łukasz Rekucki  wrote:
> On 1 November 2010 10:59, Lars Ruoff  wrote:
>
>
>
> > Hello,
>
> > first of all, these are my first steps with Django, and i only have
> > limited experience with Python, so please be patient.
>
> > I'm using it for what is intended to be a browser game in the future.
> > The main part of the game is a zoom view on a two-dimensional map of
> > fields.
>
> > I'm currently using Django 1.2.3 with Python 2.6 on Windows XP.
> > I'm using Python-provided SQLite and Django's local debug HTTP server
> > during development ('python manage.py runserver').
>
> > It works pretty well, but i notice that it takes several seconds to
> > update the map screen, which i consider unacceptable given the fact
> > that it runs locally.
>
> > I'm wondering where the performance bottleneck lies here.
> > Is it...
> > - SQLLite? (I.e. would switching to say PostgreSQL speed things up
> > considerably?)
>
> It could actually slow down things. Independently of the DB, you want
> to set up some indexes on your models (but I don't think that's your
> problem atm).
>
> > - Djangos debug web server? (I.e. would switching to apache speed
> > things up considerably?)
>
> Bingo! The development server is single-threaded and slow, so it
> totally sucks at serving *static files*. Looking at your template,
> your map is composed of many images and they all have to load
> sequentially via the devserver. Serving those images using Apache or
> Nginx should speed up things significantly.
>
> > - or the way my application is designed??
>
> In the long term, when the DB really starts to be your bottleneck, you
> want to do some research about all things "spatial" (like spatial
> indexes).
>
> --
> Łukasz Rekucki

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Add admin action to Django User

2010-11-01 Thread Karim Gorjux
On Mon, Nov 1, 2010 at 05:03, Django-learner  wrote:
> Hi, I want to add an customized action to user management in django
> admin site. I can see that only delete selected user is available, how
> can I add more to that?

Did you try to google that? This is my **first** result:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/

-- 
K.
Blog Personale: http://www.karimblog.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-us...@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: Howto crypt forms in Django?

2010-11-01 Thread ckar...@googlemail.com
Okay , thank you all.

Christian

On 1 Nov., 12:45, Jirka Vejrazka  wrote:
> > is there a way not to send form data in plain-text format? I've found
> > jCryption for PHP ("In short words jCryption is a javascript HTML-Form
> > encryption plugin, which encrypts the POST/GET-Data that will be sent
> > when you submit a form."). Is there a way to crypt data without using
> > SSL?
>
>   Christian,
>
>   any solution similar to jCryption would not add much security to
> your forms. Since it does not use challenge-response, anyone who could
> obtain the plain-text form data can now obtain encrypted data and the
> encryption keys (and the fact that you'd be using something like
> jCryption). So, not much security added, only a bit of obfuscation.
>
>   So, you should use SSL if you worry about security. Sorry.
>
>    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-us...@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: Howto crypt forms in Django?

2010-11-01 Thread Jirka Vejrazka
> is there a way not to send form data in plain-text format? I've found
> jCryption for PHP ("In short words jCryption is a javascript HTML-Form
> encryption plugin, which encrypts the POST/GET-Data that will be sent
> when you submit a form."). Is there a way to crypt data without using
> SSL?

  Christian,

  any solution similar to jCryption would not add much security to
your forms. Since it does not use challenge-response, anyone who could
obtain the plain-text form data can now obtain encrypted data and the
encryption keys (and the fact that you'd be using something like
jCryption). So, not much security added, only a bit of obfuscation.

  So, you should use SSL if you worry about security. Sorry.

   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-us...@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: 2D map application: performance and design question

2010-11-01 Thread Łukasz Rekucki
On 1 November 2010 10:59, Lars Ruoff  wrote:
> Hello,
>
> first of all, these are my first steps with Django, and i only have
> limited experience with Python, so please be patient.
>
> I'm using it for what is intended to be a browser game in the future.
> The main part of the game is a zoom view on a two-dimensional map of
> fields.
>
> I'm currently using Django 1.2.3 with Python 2.6 on Windows XP.
> I'm using Python-provided SQLite and Django's local debug HTTP server
> during development ('python manage.py runserver').
>
> It works pretty well, but i notice that it takes several seconds to
> update the map screen, which i consider unacceptable given the fact
> that it runs locally.
>
> I'm wondering where the performance bottleneck lies here.
> Is it...
> - SQLLite? (I.e. would switching to say PostgreSQL speed things up
> considerably?)

It could actually slow down things. Independently of the DB, you want
to set up some indexes on your models (but I don't think that's your
problem atm).

> - Djangos debug web server? (I.e. would switching to apache speed
> things up considerably?)

Bingo! The development server is single-threaded and slow, so it
totally sucks at serving *static files*. Looking at your template,
your map is composed of many images and they all have to load
sequentially via the devserver. Serving those images using Apache or
Nginx should speed up things significantly.

> - or the way my application is designed??

In the long term, when the DB really starts to be your bottleneck, you
want to do some research about all things "spatial" (like spatial
indexes).

-- 
Łukasz Rekucki

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Hi Daniel,

you are right that images are being loaded.
But i gave it a try and replaced the images by text.
Still the page takes about 3 seconds to load.

Lars


On Nov 1, 12:30 pm, Daniel Roseman  wrote:
> It's a bit hard to tell without knowing how the slowness appears. What
> exactly is slow?
>
> My instinct would be that it's simply a matter of image loading. Don't
> forget that the development server can only serve one thing at a time,
> so if you're loading a lot of images they are going to come up slowly.
> A dedicated server will be a lot better for that - might be worth
> experimenting with setting up Apache or Nginx or Lightppd just to
> serve the images for now, to see if that helps.
> --
> 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-us...@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: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Ok, but that said, the database isn't that big here. (Well, i guess)
There are currently 4800 entries in the "Location" table.
Is this too much for SQLite already?

May it be the query in
locations = Location.objects.filter( \
x__gte=center_location.x-half_x, \
x__lte=center_location.x+half_x, \
y__gte=center_location.y-half_y, \
y__lte=center_location.y+half_y)
that might be non-optimal?

How to improve it?

Lars


On Nov 1, 11:55 am, "Cal Leeming [Simplicity Media Ltd]"
 wrote:
> Hi Lars,
>
> Unless you are doing some *really* intense Python code in your business
> logic, then 9 out of 10 times, the bottleneck is usually the database,
> especially if you are using Python.
>
> Cal

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Howto crypt forms in Django?

2010-11-01 Thread ckar...@googlemail.com
No, no SSL, no HTTPS. Just client side and server side decryption/
encryption.

On 1 Nov., 12:22, What you get is Not what you see
 wrote:
> Using https connection?
>
> On Mon, Nov 1, 2010 at 1:19 PM, ckar...@googlemail.com <
>
> ckar...@googlemail.com> wrote:
> > Hi everybody,
>
> > is there a way not to send form data in plain-text format? I've found
> > jCryption for PHP ("In short words jCryption is a javascript HTML-Form
> > encryption plugin, which encrypts the POST/GET-Data that will be sent
> > when you submit a form."). Is there a way to crypt data without using
> > SSL?
>
> > Thanks, Christian
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@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-us...@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: 2D map application: performance and design question

2010-11-01 Thread Daniel Roseman
On Nov 1, 9:59 am, Lars Ruoff  wrote:
> Hello,
>
> first of all, these are my first steps with Django, and i only have
> limited experience with Python, so please be patient.
>
> I'm using it for what is intended to be a browser game in the future.
> The main part of the game is a zoom view on a two-dimensional map of
> fields.
>
> I'm currently using Django 1.2.3 with Python 2.6 on Windows XP.
> I'm using Python-provided SQLite and Django's local debug HTTP server
> during development ('python manage.py runserver').
>
> It works pretty well, but i notice that it takes several seconds to
> update the map screen, which i consider unacceptable given the fact
> that it runs locally.
>
> I'm wondering where the performance bottleneck lies here.
> Is it...
> - SQLLite? (I.e. would switching to say PostgreSQL speed things up
> considerably?)
> - Djangos debug web server? (I.e. would switching to apache speed
> things up considerably?)
> - or the way my application is designed??
>
> Since the latter is a very probable answer, here is the way it works
> in a nutshell:
>
> The model is something like:
> 
> class Terrain(models.Model):
>     image_file = models.CharField(max_length=80)
>
> class Location(models.Model):
>     x = models.IntegerField()
>     y = models.IntegerField()
>     terrain = models.ForeignKey(Terrain)
>
> The heart of the view goes like this:
> 
>     center_location = Location.objects.get(id=location_id)
>
>     ## how many fields on the map view in each direction
>     half_x = 6
>     half_y = 6
>
>     locations = Location.objects.filter( \
>         x__gte=center_location.x-half_x, \
>         x__lte=center_location.x+half_x, \
>         y__gte=center_location.y-half_y, \
>         y__lte=center_location.y+half_y)
>
>     locs = []
>     for l in locations:
>         loc_info = {'id': l.id, \
>             'x': l.x - center_location.x + half_x, \
>             'y': l.y - center_location.y + half_y, \
>             'img': l.terrain.image_file}
>         locs.append(loc_info)
>
>     c = Context({
>         'locs': locs,
>     })
>     return HttpResponse(t.render(c))
>
> And the main part of the template renders these items:
> 
> {% for l in locs %}
>  src="/images/{{l.img}}" />
> {% endfor %}
>
> Do you see any issues with this approach? Any paths to performance
> improvements?
> Since i'm at the beginning of this project i would like to avoid going
> the wrong way.
>
> best regards,
> Lars

It's a bit hard to tell without knowing how the slowness appears. What
exactly is slow?

My instinct would be that it's simply a matter of image loading. Don't
forget that the development server can only serve one thing at a time,
so if you're loading a lot of images they are going to come up slowly.
A dedicated server will be a lot better for that - might be worth
experimenting with setting up Apache or Nginx or Lightppd just to
serve the images for now, to see if that helps.
--
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-us...@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: Howto crypt forms in Django?

2010-11-01 Thread What you get is Not what you see
Using https connection?

On Mon, Nov 1, 2010 at 1:19 PM, ckar...@googlemail.com <
ckar...@googlemail.com> wrote:

> Hi everybody,
>
> is there a way not to send form data in plain-text format? I've found
> jCryption for PHP ("In short words jCryption is a javascript HTML-Form
> encryption plugin, which encrypts the POST/GET-Data that will be sent
> when you submit a form."). Is there a way to crypt data without using
> SSL?
>
> Thanks, Christian
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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.



Howto crypt forms in Django?

2010-11-01 Thread ckar...@googlemail.com
Hi everybody,

is there a way not to send form data in plain-text format? I've found
jCryption for PHP ("In short words jCryption is a javascript HTML-Form
encryption plugin, which encrypts the POST/GET-Data that will be sent
when you submit a form."). Is there a way to crypt data without using
SSL?

Thanks, Christian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: 2D map application: performance and design question

2010-11-01 Thread Cal Leeming [Simplicity Media Ltd]
Hi Lars,

Unless you are doing some *really* intense Python code in your business
logic, then 9 out of 10 times, the bottleneck is usually the database,
especially if you are using Python.

Cal


On Mon, Nov 1, 2010 at 9:59 AM, Lars Ruoff  wrote:

> Hello,
>
> first of all, these are my first steps with Django, and i only have
> limited experience with Python, so please be patient.
>
> I'm using it for what is intended to be a browser game in the future.
> The main part of the game is a zoom view on a two-dimensional map of
> fields.
>
> I'm currently using Django 1.2.3 with Python 2.6 on Windows XP.
> I'm using Python-provided SQLite and Django's local debug HTTP server
> during development ('python manage.py runserver').
>
> It works pretty well, but i notice that it takes several seconds to
> update the map screen, which i consider unacceptable given the fact
> that it runs locally.
>
> I'm wondering where the performance bottleneck lies here.
> Is it...
> - SQLLite? (I.e. would switching to say PostgreSQL speed things up
> considerably?)
> - Djangos debug web server? (I.e. would switching to apache speed
> things up considerably?)
> - or the way my application is designed??
>
> Since the latter is a very probable answer, here is the way it works
> in a nutshell:
>
> The model is something like:
> 
> class Terrain(models.Model):
>image_file = models.CharField(max_length=80)
>
> class Location(models.Model):
>x = models.IntegerField()
>y = models.IntegerField()
>terrain = models.ForeignKey(Terrain)
>
>
> The heart of the view goes like this:
> 
>center_location = Location.objects.get(id=location_id)
>
>## how many fields on the map view in each direction
>half_x = 6
>half_y = 6
>
>locations = Location.objects.filter( \
>x__gte=center_location.x-half_x, \
>x__lte=center_location.x+half_x, \
>y__gte=center_location.y-half_y, \
>y__lte=center_location.y+half_y)
>
>locs = []
>for l in locations:
>loc_info = {'id': l.id, \
>'x': l.x - center_location.x + half_x, \
>'y': l.y - center_location.y + half_y, \
>'img': l.terrain.image_file}
>locs.append(loc_info)
>
>c = Context({
>'locs': locs,
>})
>return HttpResponse(t.render(c))
>
>
> And the main part of the template renders these items:
> 
> {% for l in locs %}
>  src="/images/{{l.img}}" />
> {% endfor %}
>
>
> Do you see any issues with this approach? Any paths to performance
> improvements?
> Since i'm at the beginning of this project i would like to avoid going
> the wrong way.
>
> best regards,
> Lars
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 

Cal Leeming

Operational Security & Support Team

*Out of Hours: *+44 (07534) 971120 | *Support Tickets: *
supp...@simplicitymedialtd.co.uk
*Fax: *+44 (02476) 578987 | *Email: *cal.leem...@simplicitymedialtd.co.uk
*IM: *AIM / ICQ / MSN / Skype (available upon request)
Simplicity Media Ltd. All rights reserved.
Registered company number 7143564

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Hello,

first of all, these are my first steps with Django, and i only have
limited experience with Python, so please be patient.

I'm using it for what is intended to be a browser game in the future.
The main part of the game is a zoom view on a two-dimensional map of
fields.

I'm currently using Django 1.2.3 with Python 2.6 on Windows XP.
I'm using Python-provided SQLite and Django's local debug HTTP server
during development ('python manage.py runserver').

It works pretty well, but i notice that it takes several seconds to
update the map screen, which i consider unacceptable given the fact
that it runs locally.

I'm wondering where the performance bottleneck lies here.
Is it...
- SQLLite? (I.e. would switching to say PostgreSQL speed things up
considerably?)
- Djangos debug web server? (I.e. would switching to apache speed
things up considerably?)
- or the way my application is designed??

Since the latter is a very probable answer, here is the way it works
in a nutshell:

The model is something like:

class Terrain(models.Model):
image_file = models.CharField(max_length=80)

class Location(models.Model):
x = models.IntegerField()
y = models.IntegerField()
terrain = models.ForeignKey(Terrain)


The heart of the view goes like this:

center_location = Location.objects.get(id=location_id)

## how many fields on the map view in each direction
half_x = 6
half_y = 6

locations = Location.objects.filter( \
x__gte=center_location.x-half_x, \
x__lte=center_location.x+half_x, \
y__gte=center_location.y-half_y, \
y__lte=center_location.y+half_y)

locs = []
for l in locations:
loc_info = {'id': l.id, \
'x': l.x - center_location.x + half_x, \
'y': l.y - center_location.y + half_y, \
'img': l.terrain.image_file}
locs.append(loc_info)

c = Context({
'locs': locs,
})
return HttpResponse(t.render(c))


And the main part of the template renders these items:

{% for l in locs %}

{% endfor %}


Do you see any issues with this approach? Any paths to performance
improvements?
Since i'm at the beginning of this project i would like to avoid going
the wrong way.

best regards,
Lars

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Add admin action to Django User

2010-11-01 Thread Django-learner
Hi, I want to add an customized action to user management in django
admin site. I can see that only delete selected user is available, how
can I add more to that?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: cannot setup database

2010-11-01 Thread Robbington
Silly question,

but are you setting the path to your database file or to the Sqlite3
executable?

Just seems an odd name to use as your database file, if using sqlite3
I would normally create a database named closely to my project name.
my_project.db or something.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: cannot setup database

2010-11-01 Thread Daniel Roseman
On Nov 1, 7:24 am, sami nathan  wrote:
> My setting file looks like this
...
> DATABASES = {
>     'default': {
>         'ENGINE': 'django.db.backends.sqlite3', # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
>         'NAME':
> 'D:\Python25\Lib\site-packages\django\bin\flyp\sqlite3.db',
>           # Or path to database file if using sqlite3.

The admonition under TEMPLATE_DIRS, "Always use forward slashes, even
on Windows", applies equally for database paths.

However it is an extremely bad idea to keep your database in your
django/bin directory. I hope you're not putting the rest of your app
there, it's completely the wrong place for it.
--
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-us...@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 admin for call center support?

2010-11-01 Thread Knut Ivar Nesheim
I've used the django admin for the user interface to a warehouse
management system. The system managed some million pairs of shoes.

In my experience the admin is a bit different than what most people
expect it to be. On the other hand, it took my users 10 minutes to get
accustomed to the system. It is very easy to understand, as long as
your models are sane. If the user feels he/she is interacting with
models that make sense and might even represent real world objects,
like in your case maybe "case", "customer", "note", etc, there is
nothing to stop any person to use the admin efficiently.

You should also pay attention to how the app is used, and come up with
your own custom views, etc, if the need arises for quick access to a
special search, etc.

Regards
Knut

On Sat, Oct 30, 2010 at 3:02 AM, Laszlo Antal  wrote:
> Hi,
>
> Yes. I wrote a customer care app with django for a call center with 40+ 
> agents. It is now mostly have custom views and actions but the default django 
> admin was used for a couple of months without any issues. I used proxy models 
> to only show fields in the add client view they need to see(again I did it 
> that way so I don't have to write any views for it).
> I also over wrote the admin class queryset method to only show their own 
> clients etc...
> So yes it can be done just plan it out properly what they should have access 
> to and use groups for user permissions.
>
> lzantal
>
> On Oct 29, 2010, at 1:54 PM, mack the finger  wrote:
>
>> I'm responsible for writing a customer service application for a
>> django project, and it needs to be done by Monday (it's friday now).
>> I'm currently getting it built with the Django Admin, but the bosses
>> think the interface is too complex for the "knuckle-draggers" that
>> commonly answer phones. I'm wondering is anyone out there has ever
>> used the Django Admin for such purposes? Did you have to modify the
>> interface in any way? Did your customer service agents have trouble
>> navigating between the pages? Actually, has anyone out there ever had
>> to deploy a Django Admin instance to a group of computer illiterate
>> people? Were they able to cope?
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@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-us...@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-us...@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: Executing ssh scripts with django

2010-11-01 Thread Knut Ivar Nesheim
Hi,

I would strongly suggest looking into using Celery or some other form
of message queue.

In general you want to decouple the logic of the web app, such as
validating domain names, writing to the database, with operations that
has real-world important side effects. Once you split these, the
system as a whole is much easier to understand for newcomers, much
easier to reason about and above all, actually possible to test.

The operations that has side effects on your other systems is thus a
separate part of your system. That way you can test them in isolation
and you may even run a failed operation several times, without
requiring work from the user. You could also batch the operations if
necessary.

A separation like this requires some a new concept for communication
with the user. This can be as simple as "You just added a new virtual
host. We will send you a confirmation when the host is active."

As a side note, I would strongly recommend writing your operations in
such a way that you may run the same operation more than once and
achieve the same result. Otherwise you will run into nastiness. And if
you want to update a virtual host, just run the "add_virtualhost"
operation again, but this time with updated data.

You could also look into using a configuration management system, like
Chef. You could then have your system create Chef recipes.

Regards
Knut

On Sun, Oct 31, 2010 at 3:05 PM, Marc Aymerich  wrote:
> Hi guys,
> I'm developing an ISP control panel for my organization. I just finished the
> web interface based on django admin and now it's time to introduce calls to
> the "system scripts" in order to make the changes effective on the ISP
> servers (add users, manage virtualhosts, domains, and all this stuff). To
> achieve that I was thinking in overriding the save and delete methods from
> my models ( virtualhost model, domain model..). For example. before saving a
> new "apache virtualhost" I want to run a proper "create vhost" script
> through ssh using Paramiko library and if it is successful save the new
> virtualhost into the database, otherwise send a message to enduser telling
> that an error has occurred.
>
> class Virtualhost(models.Model):
>     
>     def save(self, *args, **kwargs):
>          if not self.id:
>              ssh = Ssh('create_new_virtualhost', self)
>              if ssh.errors:
>                   message.add(self.user, 'something wrong was happend')
>              else:
>                    super(self, Virtualhost).save(*args, **kwargs)
>
> I'm wondering if this approach is the right way for the interaction between
> django and ISP servers.
> Moreover, I read that is highly recommended to use a message queue like
> celery in order to avoid a possible 'long wait' until ssh command ends [1].
> Would you execute the save function through celery? Is it safe? or maybe if
> save() is executed asynchronously it can cause some unexpected behavior?
> I need some "expert" opinion here :) Would you affront this situation in a
> similar way or would you take a completely different approach?
> Many thanks!!
> [1]
> http://www.quora.com/How-can-I-remotely-execute-a-script-via-SSH-from-a-Django-view
>
>
>
>
>
> --
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: cannot setup database

2010-11-01 Thread sami nathan
My setting file looks like this
# Django settings for flyp project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@domain.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME':
'D:\Python25\Lib\site-packages\django\bin\flyp\sqlite3.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.
}
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com;, "http://example.com/media/;
MEDIA_URL = ''

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/static/"
STATICFILES_ROOT = ''

# URL that handles the static files served from STATICFILES_ROOT.
# Example: "http://static.lawrence.com/;, "http://example.com/static/;
STATICFILES_URL = '/static/'

# URL prefix for admin media -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/;, "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# A list of locations of additional static files
STATICFILES_DIRS = ()

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'ky7bf$^vv$$-#vjx4ha%j!d#$g=7w2...@i-^9g#ai9fa8*^'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'flyp.urls'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or
"C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin'
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request':{
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to 

cannot setup database

2010-11-01 Thread sami nathan
When i run the command python manage.py syncdb i got the follwing error





self.connection = Database.connect(**kwargs)
sqlite3.OperationalError: unable to open database file
Exception exceptions.AttributeError: '_shutdown' in  ignoredDATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql',



MY DB SETUP LOOKS LIKE THIS
   'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql',

'sqlite3' or 'oracle'.
'NAME':
'D:\Python25\Lib\site-packages\django\bin\flyp\sqlite3',
   # 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.
}
}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.