How to map url **kwargs

2010-06-21 Thread Sells, Fred
First I'm new 2 django and have made rapid progress building my app
based on the tutorial.  As soon as I get it a little better, I'll clean
it up and remove the "mysite/polls" references.

I have a series of url's like this

/mysite/myapp/datagrid/clients?letter=A
/mysite/myapp/datagrid/reports
/mysite/myapp/datagrid/reports?client=LA12345
/mysite/myapp/datagrid/stores/userid=mary

I would like to map these to the same view.py method

def datagrid(request, gridtype, **options):
#where gridtype is one of clients, reports, stores
#And options contains any parameters in the URL


I would like to NOT define the legal options in the URL, because that
gives me two places to define them (3 if you count the client) and
frankly I'm not that skilled at regex.  I've gotten this far, which maps
the gridtype, but cannot get the parameters, even if I explicitly name
them.  Can someone explain what I'm doing wrong?

Mysite/polls/urls.py contains
urlpatterns = patterns('mysite.polls.views',
(r'^datagrid/([a-z]*)/', 'datagrid'),
...
)

And mysite/urls.py contains

urlpatterns = patterns('',
(r'^myapp/', include('mysite.polls.urls')  ),
)

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

2010-06-22 Thread Sells, Fred
I had no problem configuring it under CentOs, have not tried Windows (yet) but 
here's my settings file

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mds30', 
'USER': '',  # Not used 
'PASSWORD': '',  # Not used 
'HOST': '',  # Set to empty string for localhost. 
Not used with sqlite3.
'PORT': '',  # Set to empty string for default. Not 
used with sqlite3.
}
}

I did create the database manually; no big deal.

-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] On 
Behalf Of euan.godd...@googlemail.com
Sent: Tuesday, June 22, 2010 5:43 AM
To: Django users
Subject: Re: Django-Mysql

Do you absolutely need to use MySQL? I've found for development that
sqlite is the most hassle-free. I use OS X for development at home and
it is the easiest option. The only drawback is that if you have
multiple clients accessing the DB you can get locking issues. If it's
just you, then you're sorted.

I once installed Django with MySQL on Windows and know I had to mess
around a fair bit to get it to work, but that was quite a while ago.

Good luck, Euan

On Jun 22, 8:02 am, Eduan  wrote:
> When installing Django-Mysql i get this error. I thought it was
> because I didn't have setuptools. But now I downloaded it and
> installed it. I am running windows 7 home basic. Here is all the apps
> versions:
>
> Django-1.2.1
> MySQL-python-1.2.3
> Python 2.6
> mysql-5.5.3-m3-win32
>
> This is the error I get:
>
> setup_windows.py", line 7, in get_config
> serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
> options['registry_key'])
> WindowsError: [Error 2] The system cannot find the file specified
>
> Any reply would be appreciated.
>
> Regards
> Eduan Bekker

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



test; pls accpt apologies

2010-07-03 Thread Sells, Fred
I receive the normal django email, but have never received a reply to
any of my questions.  I apologize for clutting the mailing list we
"test" but need to know If my company server is blocking my outgoing or
what.

If you wouldn't mind replying to this and cc'ing bu4f...@yahoo.com I
promise to never do this again.

Thanks

Fred Sells

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



Field Subclassing, or setter help needed.

2010-07-03 Thread Sells, Fred
I need to override the setter behavior of all the fields in all my
models.  They all subclass from the same abstract model.

Specifically if the fields already contains a special character (used to
indicate "Not Applicable") I don' want to allow it to be changed.  The
same field will be applicable in some types of records but not in
others.  The updates come from an external backend http query that I use
to get data from a legacy system. That legacy system does not know if a
field is applicable or not.

I've got about 25 tables and a total of 500 fields.  I would like to
build this feature into the abstract model and not have to not have
custome code for each field update..

I would like to override the "setter" method in my abstract model, but
cannot seem to get that to work, tried numerous variants.  I am a Django
newbie, but I've spent a day with the docs, books and google with no
success.

Can someone point me to a snippet or a coherent example/explanation on
how to do this.  I'm using Django 1.2 with Python 2.4.

Thanks,

Fred Sells

-- 
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: Field Subclassing, or setter help needed.

2010-07-03 Thread Sells, Fred
But the input is valid in the legacy system from which it comes; it is
just Not Applicable for the database record into which it would be
inserted, based on other parameters in the db.  These are two totally
separate systems, and we want to use the legacy data in some cases to
keep reports in sync.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Dennis Kaarsemaker
Sent: Saturday, July 03, 2010 11:04 AM
To: django-users@googlegroups.com
Subject: Re: Field Subclassing, or setter help needed.

On za, 2010-07-03 at 10:07 -0400, Sells, Fred wrote:

> I need to override the setter behavior of all the fields in all my
> models.  They all subclass from the same abstract model.
>
> Specifically if the fields already contains a special character (used
> to indicate "Not Applicable") I don' want to allow it to be changed. 

You're doing it wrong(tm)

Input validation should be done at the point where you handle input,
that is in the forms you use for updating instances.
-- 
Dennis K.

They've gone to plaid!

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



How can I Insert multiple records in one statement

2010-07-08 Thread Sells, Fred
I know how to do this in raw MySQLdb and have been trying to find a way
to do it with the Django models but with no success.

Can it be done and if so, can someone point me to a link in the docs
please?

Everything looks so elegant with the models, I hate to drop into SQL if
I don't have to.

-- 
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: How can I Insert multiple records in one statement

2010-07-08 Thread Sells, Fred
In MySQLdb you do something similar to 

Records = [ (1,2,3), (4,5,6), (7,8,9) , (11,22,33) ]

cursor.execute('insert to mytable (a,b,c) VALUES (%s, %s, %s)', Records)
#untested.

This would insrt 4 rows

-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Kenneth Gonsalves
Sent: Thursday, July 08, 2010 8:46 PM
To: django-users@googlegroups.com
Subject: Re: How can I Insert multiple records in one statement

On Friday 09 July 2010 06:03:09 Sells, Fred wrote:
> I know how to do this in raw MySQLdb and have been trying to find a
way
> to do it with the Django models but with no success.
> 

how do you do it in MySQLdb? What exactly do you mean by 'insert
multiple 
records in one statement'?
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



defining custom attributes for a model

2010-07-09 Thread Sells, Fred
I've got a model as illustrated below.  Is there any way I can define my
own attributes that are not columns like the "fredsstuff" below?


class A(MDSSection):
A0100A= models.CharField(max_length=10, help_text='''Text  :
Facility National Provider Identifier (NPI)''') 
A0100B= models.CharField(max_length=12, help_text='''Text  :
Facility CMS Certification Number (CCN)''') 
A0100C= models.CharField(max_length=15, help_text='''Text  :
State provider number''') 
A0200 = models.CharField(max_length= 1, help_text='''Code  :
Type of provider''') 
A0310A= models.CharField(max_length= 2, help_text='''Code  :
Type of assessment: OBRA''')
...
class Meta:
db_table = 'A'
fredsstuff = "xy"

def validate(self):
errors = self.checkThis(fredsstuff)
return errors

-- 
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 to access help_text attribute of model field

2010-07-11 Thread Sells, Fred
I would like to access the help_text attribute of my model fields when
responding with XML like this

 

class A(MDSSection):

A0100A= models.CharField(max_length=10, help_text='''National
Provider Identifier (NPI)''') 

A0100B= models.CharField(max_length=12, help_text='''CMS
Certification Number (CCN)''') 

A0100C= models.CharField(max_length=15, help_text='''State
provider number''') 

 

And I want to render xml similar to this



   

   ...



 

 

I'm nut using Django forms but responding to Flex with XML.  There must
be some way to access this information, but I've been through the docus
and google with no luck.

 

Does anyone know how to access the help_text of the fields, once I have
the model instance object?

 

Thanks,

Fred.

-- 
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: How to access help_text attribute of model field

2010-07-11 Thread Sells, Fred
> I would like to access the help_text attribute of my model fields when
> responding with XML like this


>
> I'm nut using Django forms but responding to Flex with XML.  There must
> be some way to access this information, but I've been through the docus
> and google with no luck.
>
> Does anyone know how to access the help_text of the fields, once I have
> the model instance object?
>
> Thanks,
>
> Fred.

MyModel._meta.get_field_by_name('fieldname')[0].help_text

Although I must say that the examples you give look like they would be
better as verbose_name, rather than help_text.  

Thanks; that's a life saver :)

I don't intend to use these names as column names but as content of a column, 
used for debugging as much as anything else. I'm new to Django, so I had not 
thought of verbose name.  I really had not anticipated using the help_text at 
all when I defined my models, but a situation came up where I needed to do a

Name --- value  description type of table.

is there an advantage of verbosename over helptext in my scenario?


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



Get all tables in one query that use OneToOne relationship

2010-07-16 Thread Sells, Fred
I've got a logical record 0f 500 columns that is broken up into about 20
tables based on an implicit logical grouping of the data.  Most of the
time this works well and the code is clean; but there are a few use
cases where I need to get all the equivalent fields for a single record
from all the tables.  The "select_related()" seems to only follow to the
"parent" table, while I want to use the parent table to get all the
related "child" (or sibling to be more precise) columns.  I know I could
use a for loop and a __dict__.update() to make multiple queries of the
DB and get the data, or I could write some SQL to select all; but
neither seem very Pythonic.  

Is there a clean way to do this in Django?



My models.py contains this code (snipped for brevity)

class Assessment(models.Model):
facility= models.ForeignKey(Facility, default='MZ')
resid= models.CharField(max_length=7, default='MZ1')
status   = models.IntegerField(default=0)

class MDSSection(models.Model):
assessment = models.OneToOneField(Assessment, primary_key=True)

class Meta:
abstract= True

class A(MDSSection):
A0100A= models.CharField(max_length=10, help_text='''Text  :
Facility National Provider Identifier (NPI)''') 
A0100B= models.CharField(max_length=12, help_text='''Text  :
Facility CMS Certification Number (CCN)''') 
A0100C= models.CharField(max_length=15, help_text='''Text  :
State provider number''')

class B(MDSSection):
B0100 = models.CharField(max_length= 1, help_text='''Code  :
Comatose''') 
B0200 = models.CharField(max_length= 1, help_text='''Code  :
Hearing''') 
B0300 = models.CharField(max_length= 1, help_text='''Code  :
Hearing aid''')

...

-- 
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: Get all tables in one query that use OneToOne relationship

2010-07-18 Thread Sells, Fred
Defining a SQL view is possible but ugly.  I don't believe MySQL
supports a natural join, so I would have to name each (of 500)
individual fields to deal with the id columns being identical in each
table.  Drawbacks are: 1- just plain ugly; 2- will not stay in sync with
my model but must be updated manually; 3- so far I have not had to use
any sql and would like to keep it that way.

I've only been using Django for a month and don't feel comfortable
writing my own manager.

What do you think about creating a model that has a foreign key to each
of the other models and using a select related on it when I need them
all?



-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Steve Holden
Sent: Saturday, July 17, 2010 9:53 AM
To: django-users@googlegroups.com
Subject: Re: Get all tables in one query that use OneToOne relationship

On 7/16/2010 7:28 PM, Sells, Fred wrote:
> I've got a logical record 0f 500 columns that is broken up into about
20
> tables based on an implicit logical grouping of the data.  Most of the
> time this works well and the code is clean; but there are a few use
> cases where I need to get all the equivalent fields for a single
record
> from all the tables.  The "select_related()" seems to only follow to
the
> "parent" table, while I want to use the parent table to get all the
> related "child" (or sibling to be more precise) columns.  I know I
could
> use a for loop and a __dict__.update() to make multiple queries of the
> DB and get the data, or I could write some SQL to select all; but
> neither seem very Pythonic.  
> 
> Is there a clean way to do this in Django?
> 
Maybe you could define a view in SQL (using CREATE VIEW AS ), joining all the necessary tables, that Django could then
treat as a (preferably read-only) model to give you access to the joined
tables?

If you are competent enough to write a special-purpose Manager to load
the columns lazily when the code requested them.

regards
 Steve
> 
> 
> My models.py contains this code (snipped for brevity)
> 
> class Assessment(models.Model):
> facility= models.ForeignKey(Facility, default='MZ')
> resid= models.CharField(max_length=7, default='MZ1')
> status   = models.IntegerField(default=0)
> 
> class MDSSection(models.Model):
> assessment = models.OneToOneField(Assessment,
primary_key=True)
> 
> class Meta:
> abstract= True
> 
> class A(MDSSection):
> A0100A= models.CharField(max_length=10, help_text='''Text
:
> Facility National Provider Identifier (NPI)''') 
> A0100B= models.CharField(max_length=12, help_text='''Text
:
> Facility CMS Certification Number (CCN)''') 
> A0100C= models.CharField(max_length=15, help_text='''Text
:
> State provider number''')
> 
> class B(MDSSection):
> B0100 = models.CharField(max_length= 1, help_text='''Code
:
> Comatose''') 
> B0200 = models.CharField(max_length= 1, help_text='''Code
:
> Hearing''') 
> B0300 = models.CharField(max_length= 1, help_text='''Code
:
> Hearing aid''')
> 
> ...
> 


-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
DjangoCon US September 7-9, 2010http://djangocon.us/
See Python Video!   http://python.mirocommunity.org/
Holden Web LLC http://www.holdenweb.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.


-- 
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: Help and Training

2010-07-21 Thread Sells, Fred
FWIW I'm an old time Pythonista who was also forced into a Java world,
but the pendulum has now swung back to Python.  I would agree with the
advice of others, but also offer the following:

It is very hard to debug program logic in a web environment.  I have my
Django view convert anything I need from the request into a form that
does not use the request object.  I can then debug using the Django
shell that's part of the Eclipse/PyDev IDE.  

FWIW I'm using Django <-->XML<-->Flex and love it.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of zero00
Sent: Wednesday, July 21, 2010 5:39 PM
To: Django users
Subject: Help and Training

I'm a web developer and I would like to adopt Django as my primary web
framework. But where I live there is no Python programmers at all. "I
live in a Java Island :( " . So I'm in need of a mentor/trainer to get
around some question that books either are too outdated right now and
dont cover and some more advance questions that they dont cover. A fee
may be avaliable if your an actual django trainer. Thanks

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



how to concatenate 2 columns in query

2010-07-21 Thread Sells, Fred
My queries return XML similar 2 this


 . . .


I would like to return name="Jones, Mary" instead.

The template that I use to convert the list of dictionaries to xml is
used for many different "datagrid" types of queries so I don't really
want to change it. 

I suppose I could use list comprehension and change each dictionary
(row), there's not that much data in each query; but Django seems so
elegant and that seems so clunky.  Up to now, I have not had to resort
to using raw sql and would like to keep it that way as well.

I am using .values(*args) in my query, if that matters?

Is there a Djangonic way of doing this?

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



overriding model.save()

2010-08-04 Thread Sells, Fred
I would like to prevent saving a new value if the database contains a
specific value.  This is on a per field, per record basis.

If I override the save() method; is there a way to find the existing (in
the DB) values and the new (to be stored) values?

-- 
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: overriding model.save()

2010-08-05 Thread Sells, Fred
That part makes sense, but where would I find the "new" values that have been 
set but not saved when my custom save() method is called? Like

X.a=3
X.b=4
X.save()

I want to see if b is a special value before saving.

-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] On 
Behalf Of Sam Lai
Sent: Thursday, August 05, 2010 7:58 AM
To: django-users@googlegroups.com
Subject: Re: overriding model.save()

On 5 August 2010 03:05, Sells, Fred  wrote:
> I would like to prevent saving a new value if the database contains a
> specific value.  This is on a per field, per record basis.
>
> If I override the save() method; is there a way to find the existing (in
> the DB) values and the new (to be stored) values?

Just perform database queries as per normal inside the save() method.

You have access to the object to be stored as well, see
http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-model-methods

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



using adobe forms (fdf) to create PDF

2010-08-14 Thread Sells, Fred
Does anyone have experience doing this and can share a link or a snippet.

I've got a multi page PDF with editable fields, but I want to fill the whole 
thing in from my DB and then print it.

Thanks.

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



using acrobat fdf in templates

2010-08-16 Thread Sells, Fred
I'm trying to use the Django template system to render PDF's from .fdf's.  The 
PDF's are provided by client and I can generate a dummy .fdf from them and edit 
that.  I can use pdftk to merge the two, but it seems like the template system 
does something similar. 

My first problem is that the .fdf has "%" characters in it and I cannot find 
how to escape them in Django.  I guess I could define a variable named 
"percent" and use that to insert the % into the template.

Here's a snippet of my test .fdf file.  Is this idea feasible, or am I trying 
to push a chain?

%FDF-1.2
1 0 obj
<>
<>
<>

<>
]
endobj

trailer
<>
%%EOF

-- 
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: manage.py syncdb not working

2010-08-24 Thread Sells, Fred
During development phase, I actually drop and recreate my database, then
run syncdb etc to make sure I've got a clean start.  Probably not
practical once I get into production.

 

From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Nick Arnett
Sent: Tuesday, August 24, 2010 10:57 AM
To: django-users@googlegroups.com
Subject: Re: manage.py syncdb not working

 

 

On Tue, Aug 24, 2010 at 7:43 AM, Sithembewena Lloyd Dube
 wrote:

Thanks Reinout. I have been seeing a lot of discussions regarding South
lately - time to dive in and find out what it is and what it means for
me.

I was under the impression that Django would add a field to my table.
So, is syncdb only good during initial database setup?


That is essentially correct, though I have modified tables by renaming
the old one, letting syncdb recreate it, then copy the old data into the
new table.  However, due to foreign keys, that's not as simple as it
might sound.  Early in development, I have also let syncdb create a
whole new database, then copied the old data into it.

Come to think of it, I have also sometimes created a modified table
under a temporary name, so that I can see what Django would have done if
it were a new setup, so that I can modify the old table manually to
match how Django would have done it automatically (and then drop the
temporary table).

Nick 

 

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



Get request path without having a request object

2010-08-27 Thread Sells, Fred
I've looked at http://www.djangobook.com/en/beta/chapter12/ and the
section on Using sessions outside of views which shows:

>>> from django.contrib.sessions.models import Session
>>> s =
Session.objects.get_object(pk='2b1189a188b44ad18c35e113ac6ceead')

But where does that pk come from?

I'm down deep in my module hierarchy and find I need a custom user
object that I stored in my session.  I'm not using Django Authentication
because I'm running behind a legacy system that already does all that
and I had to be compatible.

I'm not sure of the thread safety of Django and wonder if I could store
this object as a local variable of some module like

>From mysite.myapp import myPersistantStorage

myPersistantStorage.myUserObject = request.session['user']

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



Models, nulls and default values confusion

2010-09-02 Thread Sells, Fred
I've got several tables like the one below, where I initialize it with
"template" values that I copy when I create a new record.
INSERT INTO A VALUES
(19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ., 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '&', '&'),
(20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0. 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '&', '&'),
(21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0., 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '&', '&'),
(22, 0, 0, 0, 0, 0, 0., '&', '&', 0, 0, 0, 0, 0, '&',
'&', '&', '&', '&', '&', '&', 0, 0, 0, 0, 0, '&', 0, 0, 0, 0, '&', '&'),
(23, 0, 0, 0, 0, 0..0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, '&', 0, 0, 0, 0, '&', '&'),

I would like to replace some of those "0"'s with a different value, but
it's pretty hard to count over to the right field on the larger tables.

I thought it would be better to replace all the 0's with NULL and let
the default value in the django model put in the correct value, but
either that's not how Django works or I don't know how to do it.

Can anyone point me to the right docs or better yet, provide a snippet?

-- 
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: model across several databases

2010-09-09 Thread Sells, Fred
I've had success using sql to define views to other databases and then linking 
an "unmanaged" model to the view.  This is with MySQL where different 
"databases" are really on the same db server.

-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] On 
Behalf Of qMax
Sent: Thursday, September 09, 2010 12:38 PM
To: Django users
Subject: Re: model across several databases

On Sep 9, 3:50 pm, Russell Keith-Magee 
wrote:
> On Thu, Sep 9, 2010 at 8:48 AM, qMax  wrote:
> > Hi.
>
> > Being quite new in django,
> > I have a task to integrate data from multiple databases.
> > And I wonder if django-1.2 multibase capabilities can help me in that.
>
> > The idea is like that:
> > class PersonModel(Model):
> >    id         = AutoKey(primary_key=True)
> >    system = ForeignKey(SystemUsers, blank=True)
> >    staff      = ForeignKey(Staff, blank=True)
> >    foo        = ForeignKey(FooPeople, blank=True)
> > Problem is that SystemUsers, Staff , FooPeople are in different
> > databases, thus i cannot use just django.db.models.ForeignKey
>
> This issue is specifically addressed in the multi-db docs:
>
> http://docs.djangoproject.com/en/1.2/topics/db/multi-db/#cross-databa...
>
> It's a known limitaiton; you *might* be able to work around it, but
> it's not an official supported behavior, so it's pretty much up to you
> to tinker.

I got the idea.
But in my use case, foreign tables are not django-managed, they are
very foreign, and database desintegrity is supposed by application
design.
As a validation, It's enough just to nullify a relation if related
object suddenly disappeared - either at the moment of model retrieval,
or when relation is referenced.

Now I just wonder, if i have to implement such stuff from scratch, or
there's some useful functionality in django internals.

-- 
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: Tools to ease template/ui development

2010-09-15 Thread Sells, Fred
Perhaps I'm fighting the trend, but I like Flex -- XML ---DJango best.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of bruno desthuilliers
Sent: Tuesday, September 14, 2010 4:20 PM
To: Django users
Subject: Re: Tools to ease template/ui development

On 14 sep, 20:23, payala  wrote:
> I agree about Aptana. I am trying it right now and it looks very good,
> I already used eclipse and I think it rocks!

Emacs is the OneTrueEditor !-)

> However, re-reading my post I realise that I didn't express myself as
> well as I would have liked. Maybe a better title for my question would
> have been:
>
> OK, now we have rapid web development frameworks... where is the rapid
> web DESIGN stuff??

blueprint && uniform come to mind.

-- 
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: adding process_exception() to middleware; newbie needs help

2010-10-06 Thread Sells, Fred
Thanks to Daniel and Bruno,  will try your suggestions soonest.


-- 
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 and Flux

2010-10-24 Thread Sells, Fred
Agree.  We do the same.  It's much easier if you have a dual monitor
setup and flex on one and django on the other.  I use XML rather than
pyAMF because it was easier to debug.  Just create an xml file and set
your HttpService.url to that in Flex; then later make Django generate
the same thing.  I have ~3 xml templates that support my entire app.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Tim Sawyer
Sent: Monday, October 18, 2010 8:23 AM
To: django-users@googlegroups.com
Subject: Re: Django and Flux

> You cant combine Django and Flex Builder - but you can write apps
using
> Django and Flex.

With Flex 3 (and maybe 4, I don't know) you could install it as an
Eclipse
Plugin, instead of standalone.  You could then install pydev into
Eclipse
as well, and edit both sides of the app in the same Eclipse instance.

Having said that, we use Flex standard install for Flex development, and
a
seperate Eclipse isntance for the back ends (Java/Python/Whatever).
It's
more stable that way.

Tim.

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



newbie having trouble with conversion to south

2010-10-28 Thread Sells, Fred
I’m using django 1.2.1, Python 2.4 and MySQL 5.0 and south 0.7.2

 

I’ve got an existing app, aptly named “app” which I’m am trying to convert to 
south so I can make some DB changes.  It seemed to install OK and I get to 
here.  At which point I’m lost.  Could it be that Python 2.4 logging is not 
compatible with south?  I’m currently locked in to Python 2.4 to match the 
release packaged with CentOs.  That’s a management edict and there’s no point 
in trying to get them to change just because it would make sense.

 

C:\temp\DjangoSouthRecovery\mds30>python manage.py schemamigration app --auto

 ? The field 'Facility.FAC_ID' does not have a default specified, yet is NOT 
NULL.

 ? Since you are adding this field, you MUST specify a default

 ? value to use for existing rows. Would you like to:

 ?  1. Quit now, and add a default to the field in models.py

 ?  2. Specify a one-off value to use for existing columns now

 ? Please select a choice: 2

 ? Please enter Python code for your one-off default value.

 ? The datetime module is available, so you can do e.g. datetime.date.today()

 >>> 'xxx'

 + Added field FAC_ID on app.Facility

Created 0002_auto__add_field_facility_FAC_ID.py. You can now apply this 
migration with: ./manage.py migrate app

 

C:\temp\DjangoSouthRecovery\mds30>python manage.py migrate app

Running migrations for app:

 - Migrating forwards to 0002_auto__add_field_facility_FAC_ID.

 > app:0002_auto__add_field_facility_FAC_ID

Traceback (most recent call last):

  File "manage.py", line 11, in ?

execute_manager(settings)

  File 
"c:\alltools\python\Lib\site-packages\django\core\management\__init__.py", line 
438, in execute_manager

utility.execute()

  File 
"c:\alltools\python\Lib\site-packages\django\core\management\__init__.py", line 
379, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

  File "c:\alltools\python\Lib\site-packages\django\core\management\base.py", 
line 191, in run_from_argv

self.execute(*args, **options.__dict__)

  File "c:\alltools\python\Lib\site-packages\django\core\management\base.py", 
line 218, in execute

output = self.handle(*args, **options)

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\management\commands\migrate.py",
 line 105, in handle

ignore_ghosts = ignore_ghosts,

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\migration\__init__.py",
 line 191, in migrate_app

success = migrator.migrate_many(target, workplan, database)

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\migration\migrators.py",
 line 221, in migrate_many

result = migrator.__class__.migrate_many(migrator, target, migrations, 
database)

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\migration\migrators.py",
 line 292, in migrate_many

result = self.migrate(migration, database)

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\migration\migrators.py",
 line 125, in migrate

result = self.run(migration)

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\migration\migrators.py",
 line 98, in run

dry_run.run_migration(migration)

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\migration\migrators.py",
 line 177, in run_migration

self._run_migration(migration)

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\migration\migrators.py",
 line 167, in _run_migration

raise exceptions.FailedDryRun(migration, sys.exc_info())

south.exceptions.FailedDryRun:  ! Error found during dry run of 
'0002_auto__add_field_facility_FAC_ID'! Aborting.

Traceback (most recent call last):

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\migration\migrators.py",
 line 164, in _run_migration

migration_function()

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\migration\migrators.py",
 line 57, in 

return (lambda: direction(orm))

  File 
"C:\temp\DjangoSouthRecovery\mds30\..\mds30\app\migrations\0002_auto__add_field_facility_FAC_ID.py",
 line 12, in forwards

db.add_column('facility', 'FAC_ID', 
self.gf('django.db.models.fields.CharField')(default='xxx', max_length=16), 
keep_default=False)

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\db\generic.py",
 line 269, in add_column

self.execute(sql)

  File 
"c:\alltools\python\lib\site-packages\south-0.7.2-py2.4.egg\south\db\generic.py",
 line 129, in execute

get_logger().debug('south execute "%s" with params "%s"' % (sql, params), 
extra={

  File "c:\alltools\python\lib\logging\__init__.py", line 918, in debug

apply(self._log, (DEBUG, msg, args), kwargs)

TypeError: _log() got an unexpected keyword argument 'extra'

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

RE: newbie having trouble with conversion to south

2010-10-28 Thread Sells, Fred
I have played with VirtualEnv, but not really applied it.  My biggest
concern would be automating a
Restart if the server reboots.  Also since I'm "old school" and using
Apache with mod_python for
Django, I'm not if that's a problem.  To be honest, I have not
researched VirtualEnv much because my
Management is reluctant to "add on"  due to security concerns in a HIPAA
environment.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Shawn Milochik
Sent: Thursday, October 28, 2010 2:35 PM
To: django-users@googlegroups.com
Subject: Re: newbie having trouble with conversion to south

>From the traceback it seems that your hypothesis about the Python
version may be correct. I don't know what versions of Python South
tests with.

However, I'm in the same situation you are (Cent OS), and I get along
wonderfully with virtualenv. I'm using Python 2.7 and everything's
grand. If you need help with this let me know.

Shawn

-- 
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: newbie having trouble with conversion to south

2010-10-28 Thread Sells, Fred
I noticed that easy_install left south as an egg.  Can I just unzip that or is 
there some ezsetup I have to use to expose the files so I can edit that line.  
I have not needed to "look under the hood" of easy_install's before, so this is 
probably a RTFM question, but...

Sorry to be so "needy" but this system is in production and I'm nervous about 
that which I have not done before.


You should see this ticket on South's trac:
http://south.aeracode.org/ticket/567; Your options are: downgrade to
0.7.1, use a version from their repository or you can just safely
delete the extra args.

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

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



manage.py sqlall and db upgrade

2010-11-02 Thread Sells, Fred
I've got my first major django production app deployed and have to
upgrade my DB to meet some new requirements.  I've tried South, but got
into a death spiral and my changes are not so significant that I can't
do it by brute force.

In researching brute force, it seems like syncdb loads my initial tables
from the .../myqpp/sql/xyz.sql files just fine.

So what do I achieve with manage.py sqlall myapp   -- I don't see the
value and the docs don't say why, only how.

Right now I'm planning to
1. use drop/create database to assure a blank slate
2. use syncdb to create my new tables
3. use >mysql mydbname http://groups.google.com/group/django-users?hl=en.



RE: manage.py sqlall and db upgrade

2010-11-02 Thread Sells, Fred
I believe it failed because I changed the tablename in the meta data and
that may have conflicted with some tables my boss inserted usring raw
sql and basic programming language.  

-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Michael
Sent: Tuesday, November 02, 2010 3:31 PM
To: django-users@googlegroups.com
Subject: Re: manage.py sqlall and db upgrade

It would be in your benefit to learn why South failed, because it's been
very stable for me, and may be an indication of something else being
wrong with your app and/or models.

-- 
Michael 

On Tue, 2010-11-02 at 15:27 -0400, Sells, Fred wrote:
> I've got my first major django production app deployed and have to
> upgrade my DB to meet some new requirements.  I've tried South, but
got
> into a death spiral and my changes are not so significant that I can't
> do it by brute force.
> 
> In researching brute force, it seems like syncdb loads my initial
tables
> from the .../myqpp/sql/xyz.sql files just fine.
> 
> So what do I achieve with manage.py sqlall myapp   -- I don't see the
> value and the docs don't say why, only how.
> 
> Right now I'm planning to
> 1. use drop/create database to assure a blank slate
> 2. use syncdb to create my new tables
> 3. use >mysql mydbname  options to not include structure, just insert statements
> 4. Imay  need to reload the data in myapp/sql directory because may
wipe
> it out.
> 
> Basically the first 10 records in each table contain a template
pattern
> of which fields are disabled under certain circumstances, and that
data
> has changed slightly for 2 tables.
> 
> South may make more sense in the future, but I'm up to my #$%%# in
> alligators and the swamp must wait.
> 
> Is there anything I'm missing or am I doing something "the hard way"?
> 

-- 
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: Sample Auto Log Out Code

2010-11-03 Thread Sells, Fred
I'm running on Windows 7, Python 2.4 and Django 1.2.1 

I'm trying to change one table "facility" by dropping it and then
letting syncdb recreate it.  I thought syncdb was supposed to ignore
already created tables, but that does not appear to be the case.  

What am I doing wrong?

>python manage.py syncdb
Creating table facility
Creating table Assessment
Traceback (most recent call last):
  File "manage.py", line 11, in ?
execute_manager(settings)
  File
"c:\alltools\python\Lib\site-packages\django\core\management\__init__.py
", line 438, in execute_manager
utility.execute()
  File
"c:\alltools\python\Lib\site-packages\django\core\management\__init__.py
", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"c:\alltools\python\Lib\site-packages\django\core\management\base.py",
line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File
"c:\alltools\python\Lib\site-packages\django\core\management\base.py",
line 218, in execute
output = self.handle(*args, **options)
  File
"c:\alltools\python\Lib\site-packages\django\core\management\base.py",
line 347, in handle
return self.handle_noargs(**options)
  File
"c:\alltools\python\Lib\site-packages\django\core\management\commands\sy
ncdb.py", line 95, in handle_noargs
cursor.execute(statement)
  File
"c:\alltools\python\Lib\site-packages\django\db\backends\util.py", line
15, in execute
return self.cursor.execute(sql, params)
  File
"c:\alltools\python\Lib\site-packages\django\db\backends\mysql\base.py",
line 86, in execute
return self.cursor.execute(query, args)
  File
"c:\alltools\python\lib\site-packages\mysql_python-1.2.2-py2.4-win32.egg
\MySQLdb\cursors.py", line 166, in execute
  File
"c:\alltools\python\lib\site-packages\mysql_python-1.2.2-py2.4-win32.egg
\MySQLdb\connections.py", line 35, in defaulterrorhandler
_mysql_exceptions.OperationalError: (1050, "Table 'assessment' already
exists")

-- 
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 mod_python under apache

2010-11-16 Thread Sells, Fred
I find that flushing stdout sometimes crashes the dev server -- weird.  Anyway, 
if you make a minor mod to any file and save changes it flushes stdout.

But the guys who suggested python logging are right on for doing it the "right 
way"

-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] On 
Behalf Of Graham Dumpleton
Sent: Saturday, November 13, 2010 1:28 AM
To: Django users
Subject: Re: Django mod_python under apache

For mod_python the result of using print will only show in Apache
error log when you do an explicit flush of stdout. If using mod_wsgi,
it autoflushes on newline so you don't have this problem.

Graham

On Nov 13, 7:29 am, vivek_12315  wrote:
> I have configured Django with mod_python under apache web server.
>
> I would like to know, where can i see the print statements output for
> debugging which i put in python files in django views.
>
> I dont think print statement appears in Apache logs ...

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



settings.DEBUG=False in django 1.2.1 and no mail connection

2010-11-25 Thread Sells, Fred
I'm trying to get django to email exceptions to me, now that my app is
in production.  I'm testing under Windows7 but will deploy under Linux
CENTOS

The following code works as a test (server names changed to protect the
innocent:
from django.core.mail import EmailMessage
import os
def run():
filenames = os.listdir('.')
filenames = [x for x in filenames if x.endswith('.py')]

subject = "django email test"
message = "this is a test"
email = EmailMessage(subject, message, 'mds30 server',
[...@mydomain.org'], )
for filename in filenames:
email.attach_file(filename)
email.send()

===
However I cannot get django to email exceptions to me. But it is
detecting them.  Code snippets follow

---settings.py
DEBUG = False
TEMPLATE_DEBUG = True  #also tried False

ADMINS = (
 ('Fred Sells', m...@mydomain.org'),
)
EMAIL_HOST = "mail.mydomain.org"
EMAIL_HOST_USER = ''  #also tried with my username and password
EMAIL_HOST_PASSWORD = ''
DEFAULT_FROM_EMAIL = 'frse...@mydomain.org'
SERVER_EMAIL = 'frse...@mydomain.org'
MANAGERS = ADMINS

--I've put some print statements in core/handlers.base.py
and it seems ok
print 'a', subject 
try:
request_repr = repr(request)
except:
request_repr = "Request repr() unavailable"
message = "%s\n\n%s" % (self._get_traceback(exc_info),
request_repr)
print 'bb', message
print 'ccc', resolver.urlconf_module
mail_admins(subject, message, fail_silently=False)
# If Http500 handler is not installed, re-raise last exception
if resolver.urlconf_module is None:
raise exc_info[1], None, exc_info[2]
# Return an HttpResponse that displays a friendly error message.
callback, param_dict = resolver.resolve500()
print 'dd',  callback, param_dict

which shows...

what you would expect, ending with
ccc 
core.mail None
dd  {}

but when I look at core/mail/__init__.py I see
this
def mail_admins(subject, message, fail_silently=False, connection=None):
"""Sends a message to the admins, as defined by the ADMINS
setting."""
if not settings.ADMINS: 
return
print 'core.mail', connection
EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
 settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS],
 
connection=connection).send(fail_silently=fail_silently)

--which prints
core.mail None

looking at the code, I see that base does not pass a connection, but
mail expects one and defaults to None.  Obviously others are using this
ok, so I must be missing something.  Can someone explain what I'm
missing.



-- 
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: settings.DEBUG=False in django 1.2.1 and no mail connection

2010-11-27 Thread Sells, Fred
Please ignore previous, it was working but getting lost in my spam
filter.

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

2010-11-28 Thread Sells, Fred
Check amazon.com
I like the definitive guide to Django, but it's pretty much what you
find online.  Pro Django was not very useful to me.  There are others
now listed and I just ordered 2 of them, based on reader's comments.

I'm using django with flex, so I don't get into the template stuff much
FWIW.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Lorenzo Franceschini
Sent: Sunday, November 28, 2010 5:49 AM
To: django-users@googlegroups.com
Subject: Django book

I'm new on this group, so first of all... Hi to everybody!

I'm a web developer, and I need to approach Django for a software 
project, so I would like to ask you an advice about the best book to 
read (in your opinion) in order to learn using this framework, given
that:

* I already have some experience on web applications' development with 
PHP MVC frameworks like Drupal;
* I have some experience of Python (non-web) programming;
* I'd prefer printed books.

Thanks in advance for any answer.

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



DEBUG=False and emailing pretty html

2010-11-29 Thread Sells, Fred
Is there an easy way to get django to email error tracebacks in the
pretty html format that it uses when Debug=True?

I've got it emailing plain text, but that requires I "reconstruct" the
url from the query string while the html version had it nicely presented
-- not the end of the world, but would be nice.

-- 
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 in production on Windows

2010-12-05 Thread Sells, Fred
I don't know about IIS, but use django and windows with Apache.  See
"LAMP" for windows or just install pieces which is easy too.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of ashdesigner
Sent: Wednesday, December 01, 2010 6:44 AM
To: Django users
Subject: Django in production on Windows

Hello,

I am absolutely new to Python/Django. Being responsible for a large
corporate startup project and having looked through a number of MVC/
MVT frameworks I decided to outsource the webproject in Django.

The only undiscovered issue to us is whether we can launch a heavy
loaded website in Django under Windows (IIS) + MSSQL. Would appreciate
any comment please.

Anthony

-- 
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 in production on Windows

2010-12-06 Thread Sells, Fred
FWIW we still use mod_python even though it's deprecated.  It's an easy install 
and we have a low traffic site.

Although I do not do this, I would recommend mod_wsgi and virtualenv based on 
what others have told me.

-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] On 
Behalf Of ashdesigner
Sent: Monday, December 06, 2010 2:43 AM
To: Django users
Subject: Re: Django in production on Windows

Thanks Fred, we'll try it.

Anthony

On Dec 5, 7:16 pm, "Sells, Fred"  wrote:
> I don't know about IIS, but use django and windows with Apache.  See
> "LAMP" for windows or just install pieces which is easy too.
>
> -Original Message-
> From: django-users@googlegroups.com
>
> [mailto:django-us...@googlegroups.com] On Behalf Of ashdesigner
> Sent: Wednesday, December 01, 2010 6:44 AM
> To: Django users
> Subject: Django in production on Windows
>
> Hello,
>
> I am absolutely new to Python/Django. Being responsible for a large
> corporate startup project and having looked through a number of MVC/
> MVT frameworks I decided to outsource the webproject in Django.
>
> The only undiscovered issue to us is whether we can launch a heavy
> loaded website in Django under Windows (IIS) + MSSQL. Would appreciate
> any comment please.
>
> Anthony
>
> --
> 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.


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



newbie seeks relevant examples

2007-06-14 Thread Sells, Fred

I've got a java webstart app that I would like to rebuild in django.  It is
basicly a simple structured text editor where the user can select employees
and update goals/scheduled tasks/accomplishments with some industry specific
details that are not too important for this discussion.

So I need some menu/selection capability and a series of identical text
editor windows.  Not all that hard, but ...

I would appreciate it if anyone could point me toward some sample web sites
to get an idea of what can be done.  My searches so far have shown me alot
of "newsletter" style web pages, but I need interactive user editors.  

Any pointers would be appreciated.

---
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---

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



newbie django vs. djangoamf

2007-07-10 Thread Sells, Fred

I'm a Pythonista, but new to django.  I am building my first Flex app.
Using Flex 3.0Beta.  This is a rewrite of an Ajax prototype built with
dojotoolkit.  I have completed the flex side, using static url's that point
to xml files with expected responses.

When I google 'flex python' I get alot of hits for djangoamf, but none of
them say what it is or how it differs from django.

I don't know if I should use django 0.96 or djangoamf.  I'm developing on XP
but will deploy on Linux.  Using Python 2.4 for now.

Could I get some enlightenment please?

---
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---

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



RE: newbie django vs. djangoamf

2007-07-10 Thread Sells, Fred

thanks, that gives me the info I need.

> -Original Message-
> From: django-users@googlegroups.com
> [mailto:[EMAIL PROTECTED] Behalf Of Al Abut
> Sent: Tuesday, July 10, 2007 11:16 AM
> To: Django users
> Subject: Re: newbie django vs. djangoamf [heur]
> Importance: Low
> 
> 
> 
> Correct me if I'm wrong but from what I understand, it's an open
> source approximation of flash remoting. If you're not familiar with
> what that is, there's basically two ways to get data into a flash app
> - either xml or or a binary file format that's served up by adobe's
> server-side software (remoting). xml has the advantage of being an
> easy-to-work-with text format and free as in beer, but the
> disadvantage is that it's verbose and so file size can get pretty big
> for a web app, plus flash then has to represent all that data in
> memory and then there's the issue of parsing it to get the data out
> (which has gotten easier with actionscript 3, but still). the upside
> of flash remoting is that it's a binary, so it's tiny relative to xml,
> and that it gets loaded as native data objects directly into the flash
> client, so the actionscript can just refer directly to an array
> element or whatever.
> 
> it depends on what you need. i've made a whole career out of staying
> away from macrodobe's proprietary server-side stuff and worked with
> xml as close as possible, and for most purposes that's still more than
> good enough, but we've explored using openamf/djangoamf at my current
> gig because the responsiveness of the app and being able to load data
> very quickly is a big priority.
> 
> 
> --
> Al Abut
> --
> web designer, crimefighter
> http://alabut.com
> --
> 
> 
> 
> On Jul 10, 6:36 am, Sam <[EMAIL PROTECTED]> wrote:
> > >From this 
> URLhttp://djangoamf.sourceforge.jp/index.php?DjangoAMF_en:
> >
> > Django AMF is a Middleware for Django web framework written 
> in Python.
> > It enables Flash/Flex applications to invoke Django's view functions
> > using AMF(Action Message Format).
> >
> > A MiddleWare is a piece of code that is hooked in an HTTP request.
> >
> > The answer is you need both.
> >
> > Install Django,
> > Download and add the middleware to your django project
> > configure django's settings.py with MIDDLEWARE_CLASSES containing
> > djangoamf.
> >
> > On Jul 10, 3:21 pm, "Sells, Fred" <[EMAIL PROTECTED]> wrote:
> >
> > > I'm a Pythonista, but new to django.  I am building my 
> first Flex app.
> > > Using Flex 3.0Beta.  This is a rewrite of an Ajax 
> prototype built with
> > > dojotoolkit.  I have completed the flex side, using 
> static url's that point
> > > to xml files with expected responses.
> >
> > > When I google 'flex python' I get alot of hits for 
> djangoamf, but none of
> > > them say what it is or how it differs from django.
> >
> > > I don't know if I should use django 0.96 or djangoamf.  
> I'm developing on XP
> > > but will deploy on Linux.  Using Python 2.4 for now.
> >
> > > Could I get some enlightenment please?
> >
> > > 
> --
> -
> > > The information contained in this message may be 
> privileged and / or
> > > confidential and protected from disclosure. If the reader 
> of this message is
> > > not the intended recipient, you are hereby notified that 
> any dissemination,
> > > distribution or copying of this communication is strictly 
> prohibited. If you
> > > have received this communication in error, please notify 
> the sender
> > > immediately by replying to this message and deleting the 
> material from any
> > > computer.
> > > 
> --
> -
> 
> 
> > 



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



MySQLdb rpm for CENTOS 5

2007-07-10 Thread Sells, Fred

I'm trying to port my django demo to Apache/mod_python on a CENTOS 5 linux
32bit machine.

I'm getting an error message that I need MySQLdb 1.2.1p2 or newer and have
only 1.2.1

I've tried googling for an rpm with no success, anyone no where I can find
one.

My sysadmin dude is out this week, so I'm kind of stuck.

thanks

fred.

---
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---

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



Eclipse and PyDev setup

2007-07-11 Thread Sells, Fred

I'm using Eclipse 3.2 and latest PyDev.

I'm a django newbie, just finished the tutorial.  I would like to do my
development under Eclipse.  PyDev want to have a "src" folder under the
project, which does not really fit the django default directory structure.


mysite (an Elcipse project)
polls
templates
settings.py
...

I'm not sure of the cleanest way to get the functionality of the "src"
folder:
1. Is there a way to define the project folder as being the "src" folder?
2. Should I create a "dummy" project and then have all the django stuff
under it's src folder
3. ???

For development purposes, I would like to have Apache point to the django
project root (mydjangodemo above).  So changes are immediately available,
eliminating a "deploy" cycle.

Any suggestions?

---
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---

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



Flex integration, best practices?

2007-07-12 Thread Sells, Fred

I'm a django newbie and only a little further along with flex but an old
time Pythonista, plus tomcat servlets.  I'm very impressed with django;
great work.

I'm evaluating flex for my presentation layer because of the way it
separates view and logic on the client side and it's robust widget set.  

So far, the applications I have planned are pretty much 1 main window with
some popup dialogs for (minimal) data entry.  So once my flex web page is
displayed, any UI changes are happening within flex and the server is just
providing XML data structure in a flex-friendly format.

So I'm not using many (any?) of the cool features of Apache or django once
my page is up.  Would be reasonable to bypass Apache (and django) and use
something like SCGI to just serve XML data?  Or did I just reveal how little
I truely know about what's going on under the hood.

Factors to bear in mind: this is a small organization intranet, loading is
not a factor but ease of setup/maintenance is due to a minimal IT support
staff.


---
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---

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



Apache Config; newbie confused

2007-07-12 Thread Sells, Fred
I'm a django newbie.  I worked through the 4 part tutorial, and then got the
mysite demo working under Apache.  I went through a lot of trial and error
to get it working under Apache, and am concerned that even though it works,
I'm missing the big picture.  I have to admit that I'm a little confused on
matching up paths in the different places.  Here are the snippets and I
attached the entire files just in case... (this is on windows XP, although
I'm using Unix path notation)

project root is  /all/djdev/mysiteall subsequent paths are relative to
this root

apache's httpd.conf file--
DocumentRoot "C:/all/www/html"

  ##not sure if I even need this; part of
mod_python install notes.
AddHandler mod_python .py
PythonHandler test_mod_python
PythonDebug On



Order allow,deny
Allow from all



PythonPath "['/all/djdev'] + sys.path"
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On



templates/polls/detail.html-




 ## I had to add the /mysite prefix, which makes this form "aware" of its
parent, which is not portable. What am I missing?

_
--settings.py-- 

ROOT_URLCONF = 'mysite.urls'
 
TEMPLATE_DIRS = ("/all/djdev/mysite/templates", )
 
INSTALLED_APPS =
('django.contrib.auth','django.contrib.contenttypes','django.contrib.session
s',
'django.contrib.sites','mysite.polls','django.contrib.admin',)
___
 
 
urls.py-
---
urlpatterns = patterns('mysite.polls.views',  (r'^mysite/polls/',
include('mysite.polls.urls')),)



 

-polls/urls.py--
---

urlpatterns = patterns('mysite.polls.views',
(r'^$', 'index'),
(r'^(?P\d+)/$', 'detail'),
(r'^(?P\d+)/results/$', 'results'),
(r'^(?P\d+)/vote/$', 'vote'),
)

---
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---

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



settings.py
Description: Binary data


urls.py
Description: Binary data


urls.py
Description: Binary data
{{ poll.question }}

{% if error_message %}{{ error_message }}{% endif %}
xxx


{% for choice in poll.choice_set.all %}

{{ choice.choice }}
{% endfor %}






RE: is there any host servers that supports Django based sites?

2007-07-16 Thread Sells, Fred

I suggest you contact webfaction or others and ask them to give you 1 month
of free hosting of a developed site, with the plan that your client would
then pay to have his stuff hosted there if he liked it.  After a few
successes, you might get them to give you a generic beta site.

> -Original Message-
> From: django-users@googlegroups.com
> [mailto:[EMAIL PROTECTED] Behalf Of Michael
> Sent: Sunday, July 15, 2007 10:38 AM
> To: Django users
> Subject: Re: is there any host servers that supports Django 
> based sites?
> Importance: Low
> 
> 
> 
> 
> 
> On 15 יולי, 17:18, Michael <[EMAIL PROTECTED]> wrote:
> > .:
> >
> > > > Webfaction django hosting rocks.
> >
> > can I get a link to Webfaction?
> 
> ok, I think I found it by myself
> http://www.webfaction.com/shared_hosting
> 
> so, as I understand, the best strategy is to host the clients product
> on my own server
> then to show the final product to the client, he likes it, and then I
> can convince him to use other hosting service (ie - webfraction)
> right?
> 
> It's a good idea, but the problem is that I'm kinda out of money
> paying every month to some hosting service would be a pain :)
> so, someone interested  to share with me his hosting service?
> I can pay him AFTER I sell the product
> 
> think about that- it may be easy money for you, I'm doing all the
> development on my comp, once the product is done, I upload it to your
> host, just for 1-2 days,  - if the client is happy, he pays me and I
> pay you, just for 1-2 days of hosting :)
> 
> 
> 
> > 

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



RE: Time Tracking Tool

2006-06-27 Thread Sells, Fred

I thought I saw something like this on sourceforge

-Original Message-
From: django-users@googlegroups.com
[mailto:[EMAIL PROTECTED] Behalf Of Ian Holsman
Sent: Tuesday, June 27, 2006 6:26 AM
To: django-users@googlegroups.com
Subject: Re: Time Tracking Tool
Importance: Low




On 27/06/2006, at 6:48 AM, Jos Yule wrote:

>
> I'm in the prototype phase for designing a time tracking/invoicing  
> tool
> for my small business. First i'd like to know if anyone has already
> done this kind of thing?
>
> If not, i'd like to make something available to other looking for this
> kind of functionality.
>
> I should note that this _IS NOT_ for planning or project management.
> Its just a time entry, reporting and invoicing tool.
>
> Ok, here is what i've got so far, table wise:
>
> CLIENT - name, address, notes, etc.
> PROJECT - name, description - high level
> JOB - name, related to a project. (rate)
> WORK - hours, date done, by (association to the django USER table).
>
I'm assuming WORK also is associated with JOB

> So, i might have a 'new product page' JOB for the 'web site' PROJECT
> for 'wizbang' CLIENT.
>
> I'd then do WORK, which is associated to a JOB. The JOB currently has
> the Rate ($/hr).

that OK for small stuff, but if you have 2 people on a JOB it will  
fall down.
>
> I also have an INVOICE table to which each WORK row is associated.

you should probably associate it with the CLIENT, as the client will  
probably want a single invoice
for the time period detailing the work being done overall (but your  
client may be different)

>
> I'm not really happy with the INVOICE and WORK associations, or how a
> JOB has the rate. I've also just hacked on the django USER association
> to WORK.
allow a invoice to over-ride the rate.

>
> It works for now, but in looking to make it (possibly) usable for a
> wider audience, what things would you change or want to see added?
> Don't use the built-in USER? Where should the Rate be stored? What
> other var's would you want to have tracked (keeping in mind this is
> trying to be a small simple app)?


features ?
for me multi-currency and PDF invoice generation.
but you may just want to use SQL-ledger of OFBIZ (or quickbooks) they  
are pretty easy to use, and cheaper than writing it yourself.

regards
Ian

>
> I know that reports need to go in too, but that can be done once the
> schema is defined...
>
> Thanks for any suggestions, hints and comments.
>
> jos
>
>
> >



---
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---

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



compare two querysets

2012-02-11 Thread Sells, Fred
I've got a use case where I need to find the fields that are different
between two querysets in the same model and then use those fields to
modify another queryset in that model.  The first two represent "masks"
of allowed fields for a specific version while the third is the actual
data.  Assessment_id's below 1000 are templates while >1000 are data.

 

Based on a date entered in one field (not shown) the version of the form
could change and thus the applicable sections could change.  This will
not happen often and therefore does not need to be efficient.There
will be cases where the all the fields in the templates are identical,
but it may not be practical to merge those templates due to the need to
find/fix design bugs and requirements changes in template definitions.


 

The best idea I can come up with is to:

Get a queryset for each template based on it's pk
(derived elsewhere)

Convert the __dict__ from each queryset to a set of
(name,value) pairs.

Find the differences between the two sets

Convert the remaining set back to a dict() called
"changes"

Data = get the queryset for the actual data using it's
pk

Use Data.__dict__( changes)

And of course save

 

Snippets of models module below:

 

class MDSSection(models.Model):

assessment = models.OneToOneField(Assessment, primary_key=True) 

. . .

 

class A(MDSSections):

A0100A= models.CharField(max_length=10, help_text='''Text  :
Facility National Provider Identifier (NPI)''') 

A0100B= models.CharField(max_length=12, help_text='''Text  :
Facility CMS Certification Number (CCN)''') 

A0100C= models.CharField(max_length=15, help_text='''Text  :
State provider number''') 

A0200 = models.CharField(max_length= 1, default='1',
help_text='''Code  :  Type of provider''') 

A0310A= models.CharField(max_length= 2, help_text='''Code  :
Type of assessment: OBRA''') 

. . .

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



RE: Streamed file upload without form from actionscript

2012-02-23 Thread Sells, Fred
Here's some snippets from my code that work.  I had to remove a lot that
is specific to my organization, so no guarantees...

-from
xmitzipfile.py--
def processZipfileBuffer(user, buffer):
email = create_mail_object()
if True:
results = []
zs = ZipString(buffer)
for name in zs.namelist():
xml = zs.read(name)
status = process_xml_file(name, xml)
results.append( status )
count = len(zs.namelist())
text = '%s uploaded %s files on %s\n' % (str(user), count,
datetime.datetime.now())
text += '\n'.join(results)
else:
text="Email failed: %s" % sys.exc_value
email.body = text
email.send()
return text

def execute(user='unknown', filedata=None):  
if filedata==None:
raise Exception('No Filedata to Upload')
buffer = ''
for chunk in filedata.chunks():
buffer += chunk 
#print 'xmitzipfile.execute buffer size ', len(buffer)
print processZipfileBuffer(user, buffer)

---from
uploaders.__init__.py--

import xmitzipfile


def upload(option, **kwargs):
return xmitzipfile.execute(**kwargs)
from views.py

def upload(request, *args, **kwargs):
user = request.session.get('user', None)
filedata = request.FILES['Filedata']
action = str(args[0])
results = uploaders.upload(action, user=user, filedata=filedata)
return HttpResponse('OK')



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



RE: Going crazy with WSGI

2012-03-01 Thread Sells, Fred
I paid my dues, here are a few working files from my system that may
help you.

Note that I use flex for my frontend and thus don't use all the django
features as intended.

Some of these files may be out of date with latest practice and current
docs.  So use them as you will.


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



test1.wsgi
Description: test1.wsgi


test2
Description: test2


wsgi.conf
Description: wsgi.conf


RE: Looking for Django IDE

2012-04-01 Thread Sells, Fred
Is there a Django 1.4.1 in the works that would solve this problem?  I
also use Eclipse+PyDev and am planning to upgrade to Django 1.4 shortly.
However my management is not going to allow using a nightly build in a
production system regardless of the justification.  I guess my options
are to stick with 1.3 or create a dummy project manually and copy and
tweak it whenever I need a new project.  Any suggestions.

>From the forum post, it was not clear if this is a Django, PyDev or
Eclipse issue.  Any thoughts?

Fred.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Alexandros Karypidis
Sent: Sunday, April 01, 2012 3:57 PM
To: django-users@googlegroups.com
Subject: Re: Looking for Django IDE

Hi,

I'm using PyDev in Eclipse and it seems quite nice: http://pydev.org/

Have a look at the Django-specific stuff: 
http://pydev.org/manual_adv_django.html

Please note that you must use a nightly build for Django 1.4 due to
this:
http://sourceforge.net/projects/pydev/forums/forum/293649/topic/5158643

Cheers,
Alex


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



RE: Looking for Django IDE

2012-04-02 Thread Sells, Fred
Thanks; actually I can use the nightly build for an IDE plugin so your response 
"saves the day".  I just cannot use it in software deployed in production.

Thanks again,

Fred.

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of N.Aleksandrenko
Sent: Monday, April 02, 2012 7:18 AM
To: django-users@googlegroups.com
Subject: Re: Looking for Django IDE

sublime 2 + plugin for djando syntax

2012/4/2 Alexandros Karypidis :
> This is a problem in PyDev, not Django.
>
> The fix is already committed in the PyDev repository and will be 
> released in PyDev 2.5.0:
> http://sourceforge.net/tracker/?func=detail&aid=3512322&group_id=85796
> &atid=577329
>
> If you can't wait until PyDev 2.5.0, the only solution is to use a 
> nightly build.
>
> You should explain to your "management" that they should get out of 
> your way and let you do your job.
>
>
> On 2/4/2012 7:17 πμ, Sells, Fred wrote:
>>
>> Is there a Django 1.4.1 in the works that would solve this problem?  
>> I also use Eclipse+PyDev and am planning to upgrade to Django 1.4 shortly.
>> However my management is not going to allow using a nightly build in 
>> a production system regardless of the justification.  I guess my 
>> options are to stick with 1.3 or create a dummy project manually and 
>> copy and tweak it whenever I need a new project.  Any suggestions.
>>
>> > From the forum post, it was not clear if this is a Django, PyDev or
>> Eclipse issue.  Any thoughts?
>>
>> Fred.
>>
>> -Original Message-
>> From: django-users@googlegroups.com
>> [mailto:django-users@googlegroups.com] On Behalf Of Alexandros 
>> Karypidis
>> Sent: Sunday, April 01, 2012 3:57 PM
>> To: django-users@googlegroups.com
>> Subject: Re: Looking for Django IDE
>>
>> Hi,
>>
>> I'm using PyDev in Eclipse and it seems quite nice: http://pydev.org/
>>
>> Have a look at the Django-specific stuff:
>> http://pydev.org/manual_adv_django.html
>>
>> Please note that you must use a nightly build for Django 1.4 due to
>> this:
>> http://sourceforge.net/projects/pydev/forums/forum/293649/topic/51586
>> 43
>>
>> Cheers,
>> Alex
>>
>>
>
> --
> You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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

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



RE: [JOB] Django Programmers

2012-04-24 Thread Sells, Fred
I think he meant "persecute"

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Mark Phillips
Sent: Thursday, April 12, 2012 11:44 PM
To: django-users@googlegroups.com
Subject: Re: [JOB] Django Programmers

 

That's not very nice to prosecute potential employees.at least wait
until you hire them and they do something wrong.;)

 

Mark

On Thu, Apr 12, 2012 at 5:52 PM, Martino  wrote:

Good day,

I am Martin Vincent, CTO for ISolutionspro, an internet business
consulting firm that specializes in custom online marketing and web
software development.

Right now we are searchng for five or more years experienced Python
Django programmers to work with us developing a facebook app.

We plan to interview some of them, in order to realize that they know
what we need and then prosecute with a contract.

I would appreciate if you send me a response as fast as you can,
thanks.

--
Best,

Martin Vincent
Chief Technology Officer

iSolutionspro.com
Internet Business Consulting

Email: mvinc...@isolutionspro.com, dsala...@isolutionspro.com,
mmalaga...@isolutionspro.com

Las Vegas Office:

Main:702.518.4113

Direct: 310.751.0833

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

 

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

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



RE: [JOB] Urgent - PHP/Python Developer needed

2012-04-24 Thread Sells, Fred
Baby sitters in Manhattan get that much and lawn care workers in FL with no 
teeth and a leaf blower get $15.  You get what you pay for.

 

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Cal Leeming [Simplicity Media Ltd]
Sent: Thursday, April 12, 2012 3:28 PM
To: django-users@googlegroups.com
Subject: Re: [JOB] Urgent - PHP/Python Developer needed

 

Further update on this - budget has changed so, we can now offer a higher rate 
and a part time alternative.

 

* 1500$/month for 70 hours (20$/hour)

* 2000$/month for 100 hours (20$/hour)

 

Thanks

 

Cal

On Tue, Apr 10, 2012 at 9:31 PM, Cal Leeming [Simplicity Media Ltd] 
 wrote:

Hi all,

 

Another urgent position has come up in our company, applicant needs to have 
some experience with using Django but must also be comfortable with PHP (our 
clients are a 50/50 split between PHP and Django).

 

--

 

Simplicity Media Ltd are an established UK company providing bespoke IT 
solutions for a variety of clients across the globe.

We are currently looking for a flexible and diverse developer to maintain and 
extend our existing PHP deployments.

Our solutions are high volume (peaking at around 5000 requests/minute), with 
extremely large databases (400 million+ rows) and large content servers (15TB+ 
of media files).

The successful candidate should have at least 2 years commercial experience, be 
fluent OOP, and have a general understanding of what it means to be a good 
programmer.

We're looking for a real person with real emotion, not a corporate robot - and 
being a team player is absolutely critical. Our company attitude is firm but 
fair, we encourage a healthy mixture of fun/work, and we even have a 'NSFW' IRC 
channel!

Essential skills:
* PHP 5.x (OOP)
* MySQL
* Linux (Debian)
* Bash (shell/ssh etc)

Desired (non-essential) skills:
* MongoDB
* Redhat
* Percona
* Memcache
* Redis
* Python

Desired (non-essential) experience:
* CodeIgniter (PHP)
* TubeX (PHP)
* Django (Python)
* JIRA (Atlassian)
* Basecamp
* Zendesk
* Livechat

MINIMUM CRITERIA:
* MUST be able to work on either EST or GMT+0 timezone
* MUST be able to work 30+ hours a week.
* MUST be comfortable working on 18+ sites.
* MUST be fluent in written & spoken English

The position is full time, offering around $2000/month (roughly £1200/month) 
for the right candidate - price/hours are negotiable.

This position MUST be filled by 15th April 2012.

When applying, please also include a cover note explaining why you feel you 
would be suitable for this role.

 

 

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

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



RE: Developing first Django Site -- any advice on co-developing effectively with a professional?

2012-04-24 Thread Sells, Fred
Finding a "good consultant" is non-trivial.  The A and B+ consultants
are generally expensive and in high demand.  It is very hard to identify
a good consultant if you are not one already.  Most people will no
longer provide a recommendation of substance because of the potential
backlash of a bad review.  There are more good resume writers than there
are good programmers. 

That being said, a "good consultant" is proud of his/her work and eager
to describe it.  Good code should be easily understood, even if you do
not yet have the skill to write code at that level.  

In python, I consider a function that requires more than 10 lines of
code to be poorly written.  I have a lot of functions in my production
code that exceed 10 lines and I think they are poorly written.  

Having digressed, I would ask someone you are ready to hire to talk you
through some of his/her code via skype; gotomeeting etc.

I would also read a bit about agile development, set up a source code
repository and a lot more.  There's a lot of logistics that goes into
this that's as much work as the code initially.



-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Bob Carlson
Sent: Friday, April 20, 2012 6:23 PM
To: django-users@googlegroups.com
Subject: RE: Developing first Django Site -- any advice on co-developing
effectively with a professional?

I am in much the same situation, Michael. How did you go about finding a
good consultant?

Cheers, Bob
Eugene, OR - Tucson, AZ

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Michael A
Sent: Friday, April 20, 2012 03:41
To: Django users
Subject: Developing first Django Site -- any advice on co-developing
effectively with a professional?

Dear Django community,

I'm excited to develop my first site in Django and am trying understand
the best way to approach things. I don't have a strong coding
background, but I'm comfortable with the tutorial, ~3 hours of
screencasts, and "Beginning Django E-Commerce" by James McGaw.

Designed the database and coded the model layer myself... hiring a
designer for the front-end work, and hiring a django developer to co-
develop via github.
Worked out the development roadmap and features needed for launch
(below).

My goal is to develop 30-50% myself with feedback/review from the
professional, with them coding the rest and me learning from their code.
Has anyone tried something similar before? Any concerns or advice on
partnering effectively?

Our feature list is below, with hourly estimates from the developer.
I've starred those I'm aspiring to code myself.
Also interested in whether we can leverage existing code/libraries to
solve some of these challenges. Thanks!!

* - Account Sign-Up with Lost Password - 15 hours
* - Admin Tool: User Manager - 30 hours
Admin Tool: Managing PDF Content - 30 hours Community Forums - 45 hours
FAQ/Help Center Module - 35 hours Single Item Purchase - 15 hours
Digital Asset Delivery
- 30 hours
* - Customer Internal: Simple Account Management (password, email) - 5
hours Customer Internal: User Dashboard - 10 hours
* - Customer Internal: Contact Form - 3 hours
* - System Generated Emails - 15 hours
Data Export Tools (Customer Data) - 12 hours Secure Storage/Delivery of
PDFs - 5 hours Page/Form Builds - 20 hours U/X Development - 25 hours
Slice Art / Build Templates - 25 hours

Appreciate any advice you may have on how to approach this project
effectively!

Cheers from Tokyo,

-Michael

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

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


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



template logic vs AJAX newbie seeks advice

2012-05-04 Thread Sells, Fred
Up to now, I've been using Flex for my client side and having Django
return xml for the last 2 years.  With Adobe's policy changes regarding
Flex support, I need to shift future efforts to HTML5.  I'm seeking some
general advice from the group on basic technology/techniques.  My
specific question is...

 

When looking at the Django templating features vs using a tool like
CS5.5  or expression blend,  what advice would you offer deciding how
much to put into the template logic and how much to do via
AJAX/Javascript/Jquery?   My applications are generally 10 to 30 pages
and I have a 10% commonality between applications.  

 

Finally we are a small shop and I'm the only developer doing this  and
I'm concerned about how well I can master the templating syntax.

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



alternative to .values(*fieldnames)

2012-05-18 Thread Sells, Fred
I'm using Django 1.3 but plan toupgrade to 1.4 later this month.  I
generally return XML which is consumed by a Flex HttpService in the
client so I only use the django template to  convert a dictionary to
XML.  My application is strictly intranet with limited data and users so
efficiency considerations are minimal.  While I'm adequate with Django,
I'm far from an expert and I wanted to see if there is a better way to
achieve my objective.

 

In my current application I'm finding a common pattern where I need to
do a select_related() and return a list of dictionaries with only a
subset of the fields, preferably with simpler names that are typical in
the default behavior.  Thus in my model, a field name could be
"appointment__patient__order__action"  while I would prefer the simpler
name of "action" be passed to the client.  The standard use of the
.values(*args) does not meet my needs because it does not allow me to
convert field names.

 

I find myself doing a select_related().values()  and then later  using a
for loop to extract/rename the fields of interest.  I use the same
template to return xml for all queries that return "table-like" data.

 

I am considering defining multiple dictionaries that I would use to
rename/extract only the desired fields such as:

Mymap = dict(action="appointment__patient__order__action"  ,
fname="appointment__patient__fname", ...

 

Thus I would return a list of dictionaries  containing only the  fields
that had the corresponding dictionary value and the dictionary key would
be the one in Mymap using a snippet like...

 

(please ignore capitalization inconsistencies, Outlook just insists on
doing this)

 

Values  = models.Appointment.objects.select_related().filter(x=1,
...).values()

 

And later

Results = [ ]

For value in values:

Improved = { }

For (newname, oldname) in Mymap.items():

Improved[newname] = value[oldname]

Results.append(Improved)

 

I see two ways to implement this:

a)  Since the name map is really specific to the model being used, I
would embed it in that model as a class (or perhaps meta) object and
also create my own abstract model class that all my "real" models would
inherit from so I could embed the mapping inside the model.

b)  In order to isolate business logic from client api, I could do
all the mapping in the views.py class and have the business logic not be
aware of which fields were actually required.

 

 

 

 

 

 

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



RE: Webservice return pdf

2012-05-31 Thread Sells, Fred
Here's how I merge .fdf with pdf

def getPDFContent(assessment):
completedfdf = getCompletedForm(assessment)
pdffilename = getFilename(assessment, 'forms')  +".pdf"
pdftk = ["/usr/bin/pdftk" ,'pdftk'][os.name=='nt']
cmd = '%s %s fill_form - output - flatten' % (pdftk,
pdffilename)
proc = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE,
shell=True, bufsize=1)
cmdout,cmderr = proc.communicate(completedfdf)
if cmderr != '':
raise cmderr
return cmdout

and here's how I do my response (from views.py)
def getpdf(request, *args, **kwargs):
qs = extract_querystring_from_request(request)
parameters = Parameters(**qs)
assessment = models.Assessment.objects.get(pk=parameters.id)
pdfbuffer = pdfgenerator.getPDF(assessment)
response = HttpResponse(mimetype='application/pdf')
response['Content-Disposition'] = 'inline; filename=filename.pdf'
response.write(pdfbuffer)
return response

I'm no expert, but this works consistently.

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



django 1.4, wsgi, flex deploy best practices

2012-05-31 Thread Sells, Fred
I use Flex for the client side and XML between client and server.  I am
a "one man team" and so elegance sometimes gets sacrifices for "it
works".   My typical deploy has been

/var/www/html/my flex swf and html code

And

/home/projectname/current/djangositename

 

This works well, except that I have to use absolute URL's in Flex
(including the server name) because Flex will use either absolute or
relative to the location of the .swf file.  This means I have to rebuild
for different servers.

 

Are there any recommendations of "best practices"

1.   I could have the django view return the html page that includes
the swf file.  This has the advantage of allowing django to pass in some
flashvars to the application,  the disadvantage is closer coupling (at
least for deploy) of client and server; or

2.   I could use the url redirect to allow a relative reference to
get redirected to my django home.

 

I'm not an Apache expert and so I defer to the community which is more
experienced with these issues for a clean, generic solution I can use
going forward as I port to Django 1.4 and CentOs 6.

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



RE: django 1.4, wsgi, flex deploy best practices

2012-06-04 Thread Sells, Fred
That's a nice clean solution requiring only a minimal edit on a redeploy(server 
move). 

 

I had previously tried to semi-automate this using the javascript code below; 
but that did not provide a host or hostname; however I'm not really a 
javascript guru and may have missed something.

 

var flashvars = {};

flashvars.hostname = window.location.hostname;

flashvars.host = window.location.host; 

flashvars.port = window.location.port;

flashvars.mode = "fred put this in to test";

var params = {};

params.quality = "high";

params.bgcolor = "${bgcolor}";

params.allowscriptaccess = "sameDomain";

params.allowfullscreen = "true";

var attributes = {};

attributes.id = "${application}";

attributes.name = "${application}";

attributes.align = "middle";

swfobject.embedSWF(

"${swf}.swf", "flashContent", 

"${width}", "${height}", 

swfVersionStr, xiSwfUrlStr, 

flashvars, params, attributes);

 

 

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Joni Bekenstein
Sent: Friday, June 01, 2012 9:40 AM
To: django-users@googlegroups.com
Subject: Re: django 1.4, wsgi, flex deploy best practices

 

You can configure a basePath through flashvars as you said, but you don't have 
to make django serve the index.html to set that dynamically. You can put it by 
hand, allowing you to deploy on different servers in a decoupled manner.

 

Maybe I'm missing something here but I don't see anything wrong with that 
approach. I almost always use flashvars to specify at least one location, 
probably for a configuration file, which contains the paths to the backend 
services, external assets, etc. 

 

Another thing you could do is configure a CNAME record so that 
backend.frontendserver.com points to backendserver.com. 

 


El jueves, 31 de mayo de 2012 15:54:35 UTC-3, fred escribió:

I use Flex for the client side and XML between client and server.  I am a "one 
man team" and so elegance sometimes gets sacrifices for "it works".   My 
typical deploy has been

/var/www/html/my flex swf and html code

And

/home/projectname/current/djangositename

 

This works well, except that I have to use absolute URL's in Flex (including 
the server name) because Flex will use either absolute or relative to the 
location of the .swf file.  This means I have to rebuild for different servers.

 

Are there any recommendations of "best practices"

1.   I could have the django view return the html page that includes the 
swf file.  This has the advantage of allowing django to pass in some flashvars 
to the application,  the disadvantage is closer coupling (at least for deploy) 
of client and server; or

2.   I could use the url redirect to allow a relative reference to get 
redirected to my django home.

 

I'm not an Apache expert and so I defer to the community which is more 
experienced with these issues for a clean, generic solution I can use going 
forward as I port to Django 1.4 and CentOs 6.

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

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



RE: PyPm / Django 1.4?

2012-06-04 Thread Sells, Fred
I just use MySQL.  Better the devil you know ...

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Aaron C. de Bruyn
Sent: Monday, June 04, 2012 3:41 PM
To: django-users@googlegroups.com
Subject: Re: PyPm / Django 1.4?

On Sun, Jun 3, 2012 at 9:48 AM, Aaron C. de Bruyn 
wrote:
> On Sat, Jun 2, 2012 at 9:43 AM, Bill Freeman 
wrote:
>> Have you considered running under a virtualenv and pip installing 
>> exactly what you need?

Windows is such a nightmare.  PyPm doesn't have sqlite packages--they
all show a failure to compile on ActiveState's site.  Apparently they've
always failed for every version of Windows ever.  Pip wasn't much help
as I need to install Visual Studio to compile the sqlite libraries.
Pass.

I'll give it a shot with MySQL and hope I have better luck.

What do Windows Django developers use for small local databases?
MySQL seems overkill if you're just doing local development on a Windows
box--or as in my case, installing a single-user app that is shown as a
web front-end.

-A

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


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



RE: Django mod_wsgi + No data received in browser

2012-06-08 Thread Sells, Fred
You may need to "view source" in your browser; also attached is a
snippet I used to test mod_wsgi but does not really use django.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Jose
Sent: Thursday, June 07, 2012 4:35 PM
To: Django users
Subject: Django mod_wsgi + No data received in browser

I have the following code in wsgi.py and when I try viewing my site in a
browser I get a no data received message (Unable to load the webpage
because the server sent no data.)

I feel like I'm missing the part where this wsgi.py file loads the
actual contents of my site...

import os
import sys
import django.core.handlers.wsgi

# Reorder sys.path so new directories at the front.
sys.path = []
sys.path[:0] = ['/usr/bin/python26',
'/home/deploy/envs/site/lib/python2.6/site-packages/
setuptools-0.6c11-py2.6.egg',

'/home/deploy/envs/site/lib/python2.6/site-packages/pip-1.1-
py2.6.egg',

'/home/deploy/envs/site/lib/python2.6/site-packages',

'/home/deploy/envs/site/lib/python2.6/site-packages/PIL',
'/usr/lib64/python26.zip',
'/usr/lib64/python2.6',
'/usr/lib64/python2.6/plat-linux2',
'/usr/lib64/python2.6/lib-tk',
'/usr/lib64/python2.6/lib-dynload',
'/usr/lib64/python2.6/site-packages',

'/usr/lib64/python2.6/site-packages/Numeric',

'/usr/lib64/python2.6/site-packages/gtk-2.0',
'/usr/lib/python2.6/site-packages',
'/home/deploy/web/cms.site.com']

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

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

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

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



myapp.py
Description: myapp.py


RE: DRY violation using get_or_create with defaults

2012-06-12 Thread Sells, Fred
My application is VERY low volume, so I just do this to KISS

 

(resident, created) =
models.Resident.objects.get_or_create(pk=resid, defaults=r)

resident.__dict__.update(r)

resident.save()

 

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Jonathan French
Sent: Tuesday, June 12, 2012 7:52 AM
To: django-users@googlegroups.com
Subject: Re: DRY violation using get_or_create with defaults

 

On 12 June 2012 04:44, Jerome Baum  wrote:

Drop the "defaults" kwarg to get_or_create as apparently you're not
using it. Also drop the conditional on those set/save statements.

 

Ah, I should have made clear that some of the fields in defaults are NOT
NULL, so it's necessary to pass them in defaults. That's the problem,
really. I did start off by just doing get_or_create, set fields, save,
with no conditional, but then some of the fields I needed to set started
becoming NOT NULL.

 

I guess I'm probably going to have to create a custom manager or utility
function. It's annoying since I use some other custom managers already,
but oh well.

 

Thanks for all your suggestions.

 

- ojno

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

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



RE: Filter by today

2012-06-12 Thread Sells, Fred
You probably want __gte in your filter, if your timestamp field is a
datetime field, otherwise plain old = should work.
When in doubt, you can always print (result.timestamp, date.today() ) or
even use the type() function to make sure you're comparing apples to
apples.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of kenneth gonsalves
Sent: Tuesday, June 12, 2012 7:11 AM
To: django-users@googlegroups.com
Subject: Re: Filter by today

On Tue, 2012-06-12 at 07:46 +0100, Simon Pickles wrote:
> result = Attempt.objects.filter(timestamp = date.today())

should it not be datetime.datetime.today()?
-- 
regards
Kenneth Gonsalves

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


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



installing django extensions

2012-08-16 Thread Sells, Fred
I'm running python2.6 and django 1.3

I've installed django_extensions using easy_install  and verified it as shown.
Directory of C:\alltools\python26\Lib\site-packages

08/16/2012  07:59 AM  .
08/16/2012  07:59 AM  ..
03/12/2012  11:19 AM  django
05/28/2011  10:47 AM 1,255 Django-1.3-py2.6.egg-info
08/16/2012  07:59 AM  django_extensions-0.9-py2.6.egg

And via python as shown below
C:\alltools\python26>python
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django_extensions
>>> dir(django_extensions)
['VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 
'__path__', '__version__', 'str_version']

I think my problem is in my settings.py file which I configured as shown based 
on the video 
http://ericholscher.com/blog/2008/sep/12/screencast-django-command-extensions/  
I have googled for the correct notation, but with no success and the following 
just "feels" wrong.  I suspect I'm mixing "old" and new configuration styles 
based on older documentation but have found nothing better.

INSTALLED_APPS = (
#'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django_extensions',
  ... my stuff

When I try to use the extensions, they are not there and manage help just shows 
the normal default commands

:\all\projects\AccTherapySchedulerServer\AccTherapySite>\alltools\python26\python
 manage.py graph_models -a -g -o test.png
nknown command: 'graph_models'

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



RE: installing django extensions

2012-08-16 Thread Sells, Fred
It seems to import OK, see below:
>more manage.bat
\alltools\python26\python manage.py %1 %2 %3 %4 %5

C:\all\projects\AccTherapySchedulerServer\AccTherapySite>manage shell

C:\all\projects\AccTherapySchedulerServer\AccTherapySite>\alltools\python26\python
 manage.py shell
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
>>> import django_extensions
>>> dir(django_extensions)
['VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 
'__path__', '__version__', 'str_version']
>>> django_extensions.VERSION
(0, 9)
>>>
however if I run manage help I see the following which does not 
seem like it has extensions--
Available subcommand
  cleanup
  compilemessages
  createcachetable
  dbshell
  diffsettings
  dumpdata
  flush
  inspectdb
  loaddata
  makemessages
  reset
  runfcgi
  runserver
  shell
  sql
  sqlall
  sqlclear
  sqlcustom
  sqlflush
  sqlindexes
  sqlinitialdata
  sqlreset
  sqlsequencereset
  startapp
  syncdb
  test
  testserver
  validate

Now this is a W7 system I use for development FWIW.

===

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Amyth Arora
Sent: Thursday, August 16, 2012 11:10 AM
To: django-users@googlegroups.com
Subject: Re: installing django extensions

As Alexis said,

Try importing it in a shell and see what response you get, the INSTALLED_APPS 
dictionary is correct , seems more like a corrupt installation of 
django_extentions.

On Thu, Aug 16, 2012 at 6:53 PM, Sells, Fred  
wrote:
> I'm running python2.6 and django 1.3
>
>
>
> I've installed django_extensions using easy_install  and verified it 
> as shown.
>
> Directory of C:\alltools\python26\Lib\site-packages
>
>
>
> 08/16/2012  07:59 AM  .
>
> 08/16/2012  07:59 AM  ..
>
> 03/12/2012  11:19 AM  django
>
> 05/28/2011  10:47 AM 1,255 Django-1.3-py2.6.egg-info
>
> 08/16/2012  07:59 AM  django_extensions-0.9-py2.6.egg
>
>
>
> And via python as shown below
>
> C:\alltools\python26>python
>
> Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit 
> (Intel)] on win32
>
> Type "help", "copyright", "credits" or "license" for more information.
>
>>>> import django_extensions
>
>>>> dir(django_extensions)
>
> ['VERSION', '__builtins__', '__doc__', '__file__', '__name__', 
> '__package__', '__path__', '__version__', 'str_version']
>
>
>
> I think my problem is in my settings.py file which I configured as 
> shown based on the video 
> http://ericholscher.com/blog/2008/sep/12/screencast-django-command-ext
> ensions/ I have googled for the correct notation, but with no success 
> and the following just "feels" wrong.  I suspect I'm mixing "old" and 
> new configuration styles based on older documentation but have found 
> nothing better.
>
>
>
> INSTALLED_APPS = (
>
> #'django.contrib.auth',
>
> 'django.contrib.contenttypes',
>
> 'django.contrib.sessions',
>
> 'django.contrib.sites',
>
> 'django.contrib.messages',
>
> 'django_extensions',
>
>   ... my stuff
>
>
>
> When I try to use the extensions, they are not there and manage help 
> just shows the normal default commands
>
>
>
> :\all\projects\AccTherapySchedulerServer\AccTherapySite>\alltools\pyth
> on26\python manage.py graph_models -a -g -o test.png
>
> nknown command: 'graph_models'
>
> --
> You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



--
Best Regards,

Amyth Arora
+91856363
+918800212140

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


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



RE: installing django extensions

2012-08-16 Thread Sells, Fred
Thanks, that last post was the clue I needed. I have 2 independent, active 
django projects and was erroneously editing the settings.py in the wrong 
project.  Just plain old stupid error, but I may have not seen it for days 
without all your help.  Thanks and apologies for taking up your time.

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



Need advice on ForeignKey query problem.

2011-10-10 Thread Sells, Fred
I've got these two tables defined where a Facility can have multiple
schedules but a schedule can have only one facility.

class Facility(models.Model):
id = models.CharField(max_length=2, primary_key=True)
name = models.CharField(max_length=30)



class Schedule(models.Model):
facility = models.ForeignKey(Facility)
...

I would like a query that returns one record for each Facility and that
record would contain at least the id (if not more) of ALL linked
schedules.  So far I've only been able to return a queryset that
contains a record for each schedule at each facility.  My last attempt
looked like this...

records = models.Facility.objects.select_related().filter(id='62')

is there a pythonic way to do this?  I only need reasonable efficiency,
there's not that much data and the query is probably only run 200 times
in an 8 hour shift.

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



RE: Need advice on ForeignKey query problem.

2011-10-11 Thread Sells, Fred
Thanks Kevin, you got me on the right track.   I was able to implement the 
following solution:

records = models.Facility.objects.filter(...)
for x in records:
schedule = x.schedule_set.all()

But I could not find a way to do it all at once like

records = models.Facility.objects.filter(...).schedule_set.all()

If there is not a "clean" method to do this, I'm inclined to use the above 
solution since I have only ~100 records in the first query.  I don't want to 
"drop into SQL" unnecessarily.  On this query, I probably only need the 
.count() method on schedule_set() if that even makes a difference.


-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Kevin
Sent: Tuesday, October 11, 2011 8:43 AM
To: Django users
Subject: Re: Need advice on ForeignKey query problem.

What your looking for is here in the documentation:
https://docs.djangoproject.com/en/1.3/topics/db/queries/#related-objects

records = models.Facility.objects.get(pk=62).schedule_set.all()

On Oct 10, 8:19 pm, "Sells, Fred" 
wrote:
> I've got these two tables defined where a Facility can have multiple
> schedules but a schedule can have only one facility.
>
> class Facility(models.Model):
>     id = models.CharField(max_length=2, primary_key=True)
>     name = models.CharField(max_length=30)
>     
>
> class Schedule(models.Model):
>     facility = models.ForeignKey(Facility)
>     ...
>
> I would like a query that returns one record for each Facility and that
> record would contain at least the id (if not more) of ALL linked
> schedules.  So far I've only been able to return a queryset that
> contains a record for each schedule at each facility.  My last attempt
> looked like this...
>
>     records = models.Facility.objects.select_related().filter(id='62')
>
> is there a pythonic way to do this?  I only need reasonable efficiency,
> there's not that much data and the query is probably only run 200 times
> in an 8 hour shift.

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


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



RE: Sample Custom Decorator

2011-10-11 Thread Sells, Fred
I'm no expert but this is what I built to log all user actions -- warts
and all

def decorate(func):
##print 'Decorating %s...' % func.__name__
def wrapped( *args, **kwargs):
request = args[0]
if len(args)>1: command=str(args[1])
else: command = ''
ipaddr = request.META['REMOTE_ADDR']
user = request.session.get('user', None)
if user: userid = user.userid
else: userid = '?'
qs =  extract_querystring_from_request(request)
parameters = Parameters(**qs)
resid = parameters.pop('resid', '')
assessmentid = parameters.pop('id', 0)
facility = parameters.pop('facility','')
modified = func.__name__ in ("setvalues", "setraw", "create",
'editcaas')
###print func.__name__, 'z', modified, qs
modified = modified or (func.__name__=='command' and
command!='print')
fieldnames = parameters.values().keys()
for signature in SIGNATURE_FIELDS: 
if signature in fieldnames: command='signit'
if (not facility) and resid:
facility = resid[:2]
option = str(parameters)[:110]
action = '%s:%s' % (func.__name__, command)
###print  "\n\n\n\ncalled wrapped function with ", (action,
option, str(parameters))
record = models.HipaaLog.objects.create(Version=K.VERSION,
userid=userid, 
Action=action,
Options=option, 
#StartTime =
datetime.datetime.now(),
 
AssessmentId=assessmentid, ResidentId=resid,
Modified = modified,
IpAddress = ipaddr,
Facility=facility)
#print record.Modified, record.Action, 'record'
results = func( *args, **kwargs)
#record.StopTime = datetime.datetime.now()
#record.save()
return results
print 'done'
return wrapped


@decorate 
def command(request, *args, **kwargs):
...

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Kurtis
Sent: Tuesday, October 11, 2011 12:03 PM
To: Django users
Subject: Sample Custom Decorator

Hey Guys,

Would anyone be willing to show me an example of a very simple and
dumb decorator for views? I've been trying to read the existing
decorators and play with a couple of snippets but I'm having a lot of
trouble with two aspects -- grabbing the User Instance and Redirecting
somewhere besides Login (without making it look like a hack).

Here's some ugly pseudo-code for what I'm trying to accomplish...

# Custom Decorator
def my_decorator(function = None)

# Grab Data
request = how_do_i_get_this?
user = request.user

# Perform Logic, Redirect or Continue Normally
if user.foo():
redirect to '/foo' URL
else
display requested view?


# Decorated TemplateView
url(r'^$', my_decorator(TemplateView.as_view(template_name =
'bar.html'))),

Thanks!

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


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



Alternative to the .using() method

2011-10-11 Thread Sells, Fred
I'm using a MySQL database and one table resides in a separate database
than all the others.  It's a generic logging table.

I understand the use of the .using() method, but I wonder if there is a
way to specify the alternative model in the model definition so I don't
have to depend on remembering to add the .using() method in any usage.

I could create a view in mysql and make the model "unmanaged" but was
wondering if there is a more pythonic way?


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



RE: Alternative to the .using() method

2011-10-12 Thread Sells, Fred
Thanks, is exactly what I need.

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Jacob Kaplan-Moss
Sent: Tuesday, October 11, 2011 5:36 PM
To: django-users@googlegroups.com
Subject: Re: Alternative to the .using() method

On Tue, Oct 11, 2011 at 3:47 PM, Sells, Fred
 wrote:
> I'm using a MySQL database and one table resides in a separate database
> than all the others.  It's a generic logging table.
>
> I understand the use of the .using() method, but I wonder if there is a
> way to specify the alternative model in the model definition so I don't
> have to depend on remembering to add the .using() method in any usage.
>
> I could create a view in mysql and make the model "unmanaged" but was
> wondering if there is a more pythonic way?

Indeed there is: what you're looking for is called a "database
router", and you can find documentation here:
https://docs.djangoproject.com/en/dev/topics/db/multi-db/#automatic-database-routing

In your particular case, you'll implement something very similar to
the first example presented there: if the app is your logging app, use
the logging connection; otherwise, use the default connection.

Jacob

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


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



RE: Ajax replacement in django

2011-10-13 Thread Sells, Fred
> On Wed, Oct 12, 2011 at 9:17 AM, lankesh87  wrote:
> >  I am developing a web application where i need ajax like features.
> > But I don't want to use ajax, so my question is- "is there any way to
> > perform ajax like functions in django?"
>
Use Flex, it's easier.

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



RE: configuring

2011-10-13 Thread Sells, Fred
>From command line, launch python then try

Import MySQLdb

 

If that fails, you've not installed MySQLdb module.  Check docs or
google; it's a separate install since django is db agnostic.

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Kurtis Mullins
Sent: Wednesday, October 12, 2011 6:11 PM
To: django-users@googlegroups.com
Subject: Re: configuring

 

If you're sure you've called the MySQLDb correctly in your settings
file, as described by the documents, then you may simply be missing the
Python-MySQL package.

On Wed, Oct 12, 2011 at 5:59 PM, Mike Dewhirst 
wrote:

Yeah

The last line of the traceback indicates a problem with your MySQL setup
possibly with the backend. Check the docs for interfacing Django to
MySQL.

I use PostgreSQL so I can't help much here.

Good luck

Mike


On 12/10/2011, at 11:12 PM, yezi  wrote:

> hey everyonei just cant proceed my work with django application
> because some running errors on configuring mysql and the django frame
> work.if u please get me a solution i will be honored to
> receive.
>
> i kinda of get an error message
>
>
> C:\Django-1.3\newproject\djangoblog>python manage.py syncdb
> Traceback (most recent call last):
>  File "manage.py", line 14, in 
>execute_manager(settings)
>  File "C:\Python25\Lib\site-packages\django\core\management
> \__init__.py", line
> 438, in execute_manager
>utility.execute()
>  File "C:\Python25\Lib\site-packages\django\core\management
> \__init__.py", line
> 379, in execute
>self.fetch_command(subcommand).run_from_argv(self.argv)
>  File "C:\Python25\Lib\site-packages\django\core\management
> \__init__.py", line
> 261, in fetch_command
>klass = load_command_class(app_name, subcommand)
>  File "C:\Python25\Lib\site-packages\django\core\management
> \__init__.py", line
> 67, in load_command_class
>module = import_module('%s.management.commands.%s' % (app_name,
> name))
>  File "C:\Python25\Lib\site-packages\django\utils\importlib.py", line
> 35, in im
> port_module
>__import__(name)
>  File "C:\Python25\Lib\site-packages\django\core\management\commands
> \syncdb.py"
> , line 7, in 
>from django.core.management.sql import custom_sql_for_model,
> emit_post_sync_
> signal
>  File "C:\Python25\Lib\site-packages\django\core\management\sql.py",
> line 6, in
> 
>from django.db import models
>  File "C:\Python25\Lib\site-packages\django\db\__init__.py", line 78,
> in  e>
>connection = connections[DEFAULT_DB_ALIAS]
>  File "C:\Python25\Lib\site-packages\django\db\utils.py", line 93, in
> __getitem
> __
>backend = load_backend(db['ENGINE'])
>  File "C:\Python25\Lib\site-packages\django\db\utils.py", line 33, in
> load_back
> end
>return import_module('.base', backend_name)
>  File "C:\Python25\Lib\site-packages\django\utils\importlib.py", line
> 35, in im
> port_module
>__import__(name)
>  File "C:\Python25\Lib\site-packages\django\db\backends\mysql
> \base.py", line 14
> , in 
>raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: No mo
> dule named MySQLdb
>
> C:\Django-1.3\newproject\djangoblog>
>
> --
> You received this message because you are subscribed to the Google
Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
 .
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

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

 

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

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



project architecture question

2011-11-14 Thread Sells, Fred
I build healthcare applications and the gov't regs require we log most
user access to patient info.

Since I've only built one (rather large) Django app, my logging is in
the same DB as my data and I use decorators in views.py to log all
access.  There is only one table in it's own schema that is used for
this.

Now I'm building additional, functionally unrelated projects but would
like to use the same logging model.

We use MySQL and have very low throughput and use several databases
(i.e. mysql schema's) on a single linux server.

Since this is used by several unrelated applications, I would appreciate
some advice from more experienced developers on a good technique.
Please bear in mind that I'm the only Python/Django.SQL developer in my
organization so there is not the need to coordinate with multiple
independent teams..

Would you recommend:
a) Just duplicate the model definition in each app (i.e. move to
separate file and import it for DRY) and use the ".using() clause or a
db router?
b) Create a separate app, dedicated to this -- but what's the best way
to do a "cross app" reference
c) create a separate site dedicated to this -- then should I use a url
to pass it the logging data making it decoupled or is there a better way

Any insight would be appreciated.  As I said, I work solo at the office
so this is my only way to collaborate with other professionals.


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



site organization best practices

2011-11-14 Thread Sells, Fred
Please accept my apologies for "hijacking" a previous thread.  Offense
was unintentional.  My original question is:

 

I build healthcare applications and the gov't regs require we log most 

 user access to patient info.

 

Since I've only built one (rather large) Django app, my logging is in 

 the same DB as my data and I use decorators in views.py to log all 

 access.  There is only one table in it's own schema that is used for 

 this.

 

Now I'm building additional, functionally unrelated projects but would 

 like to use the same logging model.

 

We use MySQL and have very low throughput and use several databases 

 (i.e. mysql schema's) on a single linux server.

 

Since this is used by several unrelated applications, I would 

 appreciate some advice from more experienced developers on a good
technique.

Please bear in mind that I'm the only Python/Django.SQL developer in 

 my organization so there is not the need to coordinate with multiple 

 independent teams..

 

Would you recommend:

a) Just duplicate the model definition in each app (i.e. move to 

 separate file and import it for DRY) and use the ".using() clause or a 

 db router?

b) Create a separate app, dedicated to this -- but what's the best way 

 to do a "cross app" reference

c) create a separate site dedicated to this -- then should I use a url 

 to pass it the logging data making it decoupled or is there a better 

 way

 

Any insight would be appreciated.  As I said, I work solo at the 

 office so this is my only way to collaborate with other professionals.

 

F

 

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



wsgi, URL patterns and standard deploy practices

2011-11-16 Thread Sells, Fred
I'm setting up a standard deploy on a CentOS 6 system that I hope will
be the template for all applications for my small company.  We tend to
put only 1 or 2 applications on a VMware image more for administrative
purposes and to avoid a problem/debugging on one system from impacting
other unrelated systems.  We have a very light load and are using Flex
with Django rather than HTML.  We are using wsgi and apache that are the
default versions installed with CentOS  yum installer.  This is also a
Python 2.6 environment.

 

My deploy structure looks like this.  The idea is that I (the developer)
upload the new files into /tmp/-mm-dd and the sysadmin moves them to
the deploy directory and recreates the symlink for "production"

drwxr-xr-x. 3 root   root   4096 Nov  8 07:12 2011-11-05 #older but we
keep it incase we need to revert.

drwxr-xr-x  4 root   root   4096 Nov 16 07:57 2011-11-16

lrwxrwxrwx  1 root   root 10 Nov 16 09:21 production -> 2011-11-16

 

[root@accapp6 therapydeploy]# cd production

[root@accapp6 production]# ll

total 8

drwxr-xr-x 5 root root 4096 Nov 15 09:47 AccTherapySite # this is my
django site directory (i.e. contains settings.py)

drwxr-xr-x 5 root root 4096 Aug 19 06:43 therapy # this is the
Flex production build which contains an index.html to launch the app

 

I've configured apache to map "wsgi" to my wsgi-scripts director so all
I need to do to deploy a new app is to drop a new wsgi file in the wsgi
scripts directory.  then in my wsgi-scripts directory I have a python
wsgi script that includes.  

sys.path.insert(0, '/home/therapydeploy/production')

import AccTherapySite.settings as  settings

 

This seems to be working well, although I have not yet beat it to death.
The URL's that Flex uses to get to django are long and ugly like

http://myserver.mydomain.org/wsgi/therapy/django/AccTherapySite/app/getl
ist/schedulemodes 

and my question is: "Is there a better way to define these URL's or trim
them once my wsgi app is handling the call so I don't reveal so many
nodes?"

 

My primary urls.py (same level as settings.py) contains

urlpatterns = patterns('',

(r'^django/AccTherapySite/app/', include('AccTherapySite.app.urls')
),

 

)

 

While app/urls.py contains

urlpatterns = patterns('AccTherapySite.app.views',

 

(r'^getlist/([a-z]*)',   views.getlist),

(r'^getcsv/([a-z]*)',  views.getcsv),

(r'^getraw/([a-z]*)',  views.getraw),

(r'^edit/([a-z]*)',  views.edit),

 ...

 

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



RE: MS Access integration with DJango through conversion to (Postgres or MySQL) xor direct interaction

2011-11-30 Thread Sells, Fred
There's a free access to mysql converter; try google; I forgot the name
and have it on a different computer than this one.  Contact list again
if you cannot find it and I'll look harder.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Alec Taylor
Sent: Wednesday, November 30, 2011 12:58 AM
To: django-users@googlegroups.com
Subject: MS Access integration with DJango through conversion to
(Postgres or MySQL) xor direct interaction

Good afternoon,

Is there an ORM library for python/django which integrates with MS
Access? - I know SQLalchemy dropped support after 0.4, but maybe
there's another to use?

Alternatively how would I convert one to PostgreSQL or MySQL then
interpret it into ORM syntax for use in i.e. SQLalchemy?

Thanks for all suggestions,

Alec Taylor

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


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



select_related, need reverse foreighn key help

2011-12-01 Thread Sells, Fred
I've got a model structure like this

 

class Order(models.Model):

id = models.CharField(max_length=10, primary_key=True)  # like
OT-6212345

facility = models.ForeignKey(Facility)

therapy = models.CharField(max_length=2, blank=True)

. . .

 

class Schedule(models.Model):

facility = models.ForeignKey(Facility)  #yes I  know this is
redundant, but handy for debugging in sql.

order = models.ForeignKey(Order)

. . .

 

I need to find a list of all orders at a facility that have not been
scheduled; BUT I also need a specific set of values.  I can do it using
the following, but since the result is a list rather than a queryset, I
can no longer use the .values() method.  I could "brute force" it but
I've gotta believe Django can do this and it's just my lack of
experience.  My code is

 

 

class Test(unittest.TestCase):

 

def testOrderFilters(self):

values = tuple('id resident_id therapy resident__lname
resident__fname resident__room resident__payor'.split())

facility = models.Facility.objects.get(pk='xx')

queryset = models.Order.objects.filter(facility=facility)

queryset = queryset.filter(therapy='OT').select_related()
#sometimes want all, othertimes just one type

unscheduled = [x for x in queryset if not x.schedule_set.all()]

for u in unscheduled: print u.schedule_set.all(), u.__dict__

 

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



rendering CSV in response; need a little help

2011-12-09 Thread Sells, Fred
I'm getting an http request from another server in our system and I need
to respond using a csv format.  I've seen the example in the docs where
the template looks like this:

{% for row in data %}"{{ row.0|addslashes }}", "{{ row.1|addslashes }}",
"{{ row.2|addslashes }}", "{{ row.3|addslashes }}", "{{ row.4|addslashes
}}"
{% endfor %}


However I would like my template to work with a variable number of
fields.  Short of doing a  ",".join(arow)  in my view, I'm not sure how
to do this without getting a trailing  "," in my output.  My view
snippet looks like this:

results = [ (s.a, s.b, s.c, s.d, s.e) for s in today]
return render_to_response('tuples2csv.txt',{'records': results},
mimetype='text/plain', context_instance=RequestContext(request))


My template looks like this at this time:
===
{% for row in records %}{% for value in row %}{{value}},{% endfor %}
{% endfor %}
===

The data looks like this - I've deleted much of the internal field
content since it is proprietary information

7:55,,,
8:55,,,
11:25,,,
8:25,,xxx,
=
I guess I can always convert this to a text block in my view and respond
with that, but it seems like I should be able to use the template system
for a more generic solution.  I've done a fair amount of googling on
this but keep getting to the same examples that are close but not quite
what I need.

If someone can clarify how to eliminate the trailing ","I would really
appreciate it.

Thanks, 
Fred.

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



RE: rendering CSV in response; need a little help

2011-12-11 Thread Sells, Fred
Thanks for all the solutions.  I've saved them all for future reference but 
decided to go with using the HttpResponse as a file-like object.

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Tom Evans
Sent: Friday, December 09, 2011 11:18 AM
To: django-users@googlegroups.com
Subject: Re: rendering CSV in response; need a little help

On Fri, Dec 9, 2011 at 4:12 PM, Sells, Fred
 wrote:
> I'm getting an http request from another server in our system and I need
> to respond using a csv format.  I've seen the example in the docs where
> the template looks like this:
>
> {% for row in data %}"{{ row.0|addslashes }}", "{{ row.1|addslashes }}",
> "{{ row.2|addslashes }}", "{{ row.3|addslashes }}", "{{ row.4|addslashes
> }}"
> {% endfor %}
>
>
> However I would like my template to work with a variable number of
> fields.  Short of doing a  ",".join(arow)  in my view, I'm not sure how
> to do this without getting a trailing  "," in my output.  My view
> snippet looks like this:
> 
> results = [ (s.a, s.b, s.c, s.d, s.e) for s in today]
> return render_to_response('tuples2csv.txt',{'records': results},
> mimetype='text/plain', context_instance=RequestContext(request))
> 
>
> My template looks like this at this time:
> ===
> {% for row in records %}{% for value in row %}{{value}},{% endfor %}
> {% endfor %}
> ===
>
> The data looks like this - I've deleted much of the internal field
> content since it is proprietary information
> 
> 7:55,,,
> 8:55,,,
> 11:25,,,
> 8:25,,xxx,
> =
> I guess I can always convert this to a text block in my view and respond
> with that, but it seems like I should be able to use the template system
> for a more generic solution.  I've done a fair amount of googling on
> this but keep getting to the same examples that are close but not quite
> what I need.
>
> If someone can clarify how to eliminate the trailing ","I would really
> appreciate it.
>
> Thanks,
> Fred.
>

Do you have a really good reason for generating CSV in a template? It
will be astonishingly slow.

The python csv module simply requires a file like object to write to.
A HttpResponse is a file like object.

To answer your question, in a for loop there are various counters
available, one of which is forloop.last, which is true the last time
through the loop.

https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#for

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


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



Django 1.2.1 strange problem

2011-12-15 Thread Sells, Fred
I've got an older app that's been running in production for about 2
years on RedHat 4, MySQL 5.0.77 with MyISAM tables, Django 1.2.1 and
Python 2.4.

 

This app is used heavily by internal users, which is a relatively light
load compared to public sites.  I actually use Flex for the client side
and save each field when the user changes it.

 

About once a month one field in particular will have its value cleared,
or perhaps the save operation did not complete before the next user
input hits the server.  I've searched my code for an unexpected
reference to this field name with no results.  As I understand it,
Django is single threaded so I don't know how this can happen.

 

Has anyone seen similar behavior?  I plan to upgrade next month anyway,
but could this be an artifact of the older Django or of MyISAM tables?
I'm not using transactions since I'm not an experienced DBA, but should
I?

 

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



MyISAM vs InnoDB; was Django 1.2.1 strange problem

2011-12-16 Thread Sells, Fred
Thanks for such a clear and helpful response.  I'll begin the upgrade
migration immediately.  I noticed that a newer project does use InnoDB,
yet I don't see anything in settings.py which specifies the engine in
either project.  It's been a while but  the original project was built
with Dj 1.2 and I think it used XP while the newer one was built with
1.3 under Windows 7.

 

I wrote a little conversion script which seems to work and I notice that
MySQL 5.5 defaults to InnoDB.  Here's the trivial script if anyone can
use it.

 

import MySQLdb

Connection = MySQLdb.connect (db="mydb")

Cursor = Connection.cursor()

Cursor.execute('show tables') #test connection

tables = Cursor.fetchall()

for table in tables:

t = table[0]

if t in 'vlog allfields editlog user'.split(): continue  #these are
views

print t,

sql = 'ALTER TABLE %s ENGINE=INNODB' % t

print Cursor.execute(sql)

 

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Ian Clelland
Sent: Thursday, December 15, 2011 1:02 PM
To: django-users@googlegroups.com
Subject: Re: Django 1.2.1 strange problem

 

 

On Thu, Dec 15, 2011 at 5:56 AM, Sells, Fred
 wrote:

I've got an older app that's been running in production for about 2
years on RedHat 4, MySQL 5.0.77 with MyISAM tables, Django 1.2.1 and
Python 2.4.

 

This app is used heavily by internal users, which is a relatively light
load compared to public sites.  I actually use Flex for the client side
and save each field when the user changes it.

 

About once a month one field in particular will have its value cleared,
or perhaps the save operation did not complete before the next user
input hits the server.  I've searched my code for an unexpected
reference to this field name with no results.  As I understand it,
Django is single threaded so I don't know how this can happen.

 

The Django code itself is not multithreaded -- it spawns no threads of
its own -- but that doesn't mean that your setup is single-threaded.
That depends entirely on how your web server is configured. Every
production environment I have seen uses processes or threads to serve
multiple requests simultaneously, which means that multiple instances of
the Django code are running at any given time.

 

Django tries to be thread-safe, which is slightly different -- the code
is written such that multiple threads can co-exist without stomping all
over each other's data, at least at the Python level.

 

At the database level, things are different again. This is probably
where your problems are coming from. If your database doesn't support
isolation through transactions (if you're using MyISAM tables on MySQL,
basically), then you are susceptible to problems like this. Database
operations can and will be interleaved, depending on when and how your
web server decides to schedule its threads.

 

 

Has anyone seen similar behavior?  I plan to upgrade next month
anyway, but could this be an artifact of the older Django or of MyISAM
tables?

 

I doubt that upgrading Django will solve anything, but I would recommend
upgrading your tables to InnoDB. The only reasons I know for sticking
with MyISAM are a requirement for speed over all else (including data
integrity), and to use the MySQL "full-text-search" feature.

 

  I'm not using transactions since I'm not an experienced DBA,
but should I?

 

Happily, Django will take care of all of this for you; you don't have to
be a DBA, or even think about transactions most of the time. As long as
your database supports it, Django will automatically isolate each
request in its own transaction. If the view returns a response, the
transaction will be committed to the database, and if the view raises
error, the transaction will be rolled back automatically. In almost
every case, this behaviour will be exactly what you want.




 

-- 
Regards,
Ian Clelland


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

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



django 1.4 timeline

2011-12-25 Thread Sells, Fred
While I realize that release schedules are flexible until near then
actual release date, I would appreciate a "best guess" on 1.4 beta.

 

I have to complete a major upgrade of a mission critical app by 1 april.
Since I use flex for my client side and have django just return XML,
It's not like I need all the new features to work.

I'm changing

RedHat Enterprise 4 to CentOs 6

Python 2.4 to 2.6

Mod_python to mod_wsgi

Mysql 5.0 to 5.5

 

Since 1.4 has a different project structure and includes "wsgi.py"  it
would make sense to migrate to that as soon as feasible.   

 

Any guesses on schedule?

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



model for legacy table without primary key

2011-12-30 Thread Sells, Fred
I thought I had read somewhere that it was possible to have a model for
a legacy table without a primary key as long as the useage was read only
and that the method was "filter" and not "get".  I've been searching for
quite a while now and all I can find indicates a primary key is
mandatory for any model.  I'm using Django 1.3 with MySQL 5.0 but plan
to upgrade to MySQL 5.5 if that makes any difference.

 

The table has 4 fields that are unique together: userid, application,
role, facility.  I populate the latter 3 by decoding the ldap group.
Unfortunately ldap group names are not defined consistently, so I have
to write a special parser for each application (that I support in
Django).  This table will be refreshed using MySQLdb from a cron job
that queries ldap (i.e. no Django at this phase).  This  process updates
a generic access table that is used by all my django apps.

 

I control this table, so I could let Django create an autonumber id as
primary key, or I could combine all 4 columns to create a  primary key.
Since I really don't need or have a good use for a primary key in this
table, either technique seems inappropriate.  However if I'm being anal
about this whole pk issue and need to just  bite the bullet, so be it.

 

Any sage advice?

 

Fred.

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



RE: model for legacy table without primary key

2011-12-30 Thread Sells, Fred
Thanks, that's the hack I was trying to remember.  

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of akaariai
Sent: Friday, December 30, 2011 1:06 PM
To: Django users
Subject: Re: model for legacy table without primary key



On Dec 30, 7:53 pm, Bill Beal  wrote:
> But it can't be a primary key if the values are not unique, right?
> The four fields are unique together, but not necessarily individually.

It is not a real primary key. The idea is to tell Django it is a
primary key even if it is not. And hope everything works OK (should
work for most SELECT queries).

So, it is just an ugly hack. Do not try this with writing queries,
data corruption is guaranteed :)

- Anssi

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


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



RE: Web Servers for Django Projects [WAS: Does anyone know any blogs...]

2012-01-14 Thread Sells, Fred
You referenced Graham's "The Perfect Config".  I've been googling
without success to find that.  Do you have a link?

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Stuart Laughlin
Sent: Friday, January 13, 2012 12:52 PM
To: django-users@googlegroups.com
Subject: Re: Web Servers for Django Projects [WAS: Does anyone know any
blogs...]

 

Snip

After all, in spite of Graham coming through with The Perfect Config, I
personally decided to not put myself through that experience again and
moved away from apache on subsequent projects. I've been pleased with
that decision, and I know many others share my experience.




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



Apache JQuery deployment advice

2013-03-20 Thread Sells, Fred
I'm converting a Java jnlp app with a tomcat backend to an HTML5/jQuery/AJAX UI 
with a Django/Apache backend.

This is an intranet application with <50 users and a very light workload.  Idle 
90% of the time and ~5 users active at a time.  There are only 2 or 3 pages in 
the entire project.  I don't think I need templates at all but can handle it 
with one static HTML page and AJAX, using jQuery's .load() function to assemble 
the "components" combined with a tabnavigator to change views.

While this application is not very "busy" it is very complex and the 
requirements change frequently.

My concern is coming up with a deploy strategy that makes it easy to manage 
upgrades and the occasional revert when an upgrade is buggy.  And yes I know it 
should be tested better, but there are internal issues that prevent that.

All my prior apps have used Adobe's Flex/Flash for client,  XML for data 
transfer and Apache/Django 1.3/MySQL for the server.  In those applications I 
would use a "daisy chain" of symlinks to point to the current deploy like this

Maindeploydir
/v001
   /v002
   ...
   /v099
   /current -> v099

Under htdocs and under my wsgi directory I would have symlinks that point to 
/home/maindeploydir/current/gui  and /home/maindeploydir/current/mydjangosite 
respectively

Thus a new deployment just involves changes the "current" symlink.

This seemed reasonable when the client was build using the Flex IDE and the 
server was built using Eclipse/PyDev.  But now that I'm abandoning Flex, I 
think there should be a better way.  Perhaps my lack of experience with 
staticfiles is a factor in not seeing the light, but I would appreciate some 
insight into a sound deployment strategy.

Thanks,

Fred.


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




RE: Apache JQuery deployment advice

2013-03-21 Thread Sells, Fred
I do use CVS for source code control and have upgrading to git on my which 
list.   Changing from a binary build...deploy model to an ASCII deploy model 
does provide the opportunity to move out of the stone ages, just need to carve 
out some time/approval for git.

I'm still wrapping my head around staticfiles in django.  I guess I need to try 
it before I can ask intelligent questions.

Thanks for the eye opener.

Fred.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Michael Pimmer
Sent: Wednesday, March 20, 2013 6:34 PM
To: django-users@googlegroups.com
Subject: Re: Apache JQuery deployment advice

Have you ever worked with anything like SVN or GIT?

Templates are a very basic and useful thing, make sure you know what Django 
offers and why you don't want to use it.
As already mentioned: take a look at django South, too.



On 21/03/13 05:28, Sells, Fred wrote:
I'm converting a Java jnlp app with a tomcat backend to an HTML5/jQuery/AJAX UI 
with a Django/Apache backend.

This is an intranet application with <50 users and a very light workload.  Idle 
90% of the time and ~5 users active at a time.  There are only 2 or 3 pages in 
the entire project.  I don't think I need templates at all but can handle it 
with one static HTML page and AJAX, using jQuery's .load() function to assemble 
the "components" combined with a tabnavigator to change views.

While this application is not very "busy" it is very complex and the 
requirements change frequently.

My concern is coming up with a deploy strategy that makes it easy to manage 
upgrades and the occasional revert when an upgrade is buggy.  And yes I know it 
should be tested better, but there are internal issues that prevent that.

All my prior apps have used Adobe's Flex/Flash for client,  XML for data 
transfer and Apache/Django 1.3/MySQL for the server.  In those applications I 
would use a "daisy chain" of symlinks to point to the current deploy like this

Maindeploydir
/v001
   /v002
   ...
   /v099
   /current -> v099

Under htdocs and under my wsgi directory I would have symlinks that point to 
/home/maindeploydir/current/gui  and /home/maindeploydir/current/mydjangosite 
respectively

Thus a new deployment just involves changes the "current" symlink.

This seemed reasonable when the client was build using the Flex IDE and the 
server was built using Eclipse/PyDev.  But now that I'm abandoning Flex, I 
think there should be a better way.  Perhaps my lack of experience with 
staticfiles is a factor in not seeing the light, but I would appreciate some 
insight into a sound deployment strategy.

Thanks,

Fred.


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



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


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




General Apache Deploy Strategy

2013-04-02 Thread Sells, Fred
We use django for intranet applications.  There is minimal coupling between 
applications and we generally dedicate a virtual server for each application.  
Perhaps not the most efficient, but it works for our environment.

In django 1.3 I just copied the "site" directory to the deploy location and 
since the app directory was below that, it was a simple deploy.

With the revised directory structure of 1.4/1.5  I would need to copy the 
project root directory to the production server when deploying.  That's 
acceptable, except that I prefer to create a "docs" directory under the project 
to hold any specifications, critical instructions, etc and there is no need to 
deploy this, nor would I want to make it accessible to our user base.  Also I 
frequently work remotely on a wireless connection and copying unnecessary files 
is a pain.

It's not that I can't live with copying the project in its entirety, but is 
there a better, more django-esque way?

Thanks,

Fred.

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




how to combine multiple related applications in one project/site

2013-05-01 Thread Sells, Fred
We're a small organization with limited sysadmin support and a low thruput 
requirement.

I've got some common features  that are evolving that are used in all projects, 
even though the projects themselves are unrelated and on different servers.

I have a very specific logging function to a mysql DB (same server, different 
database) to comply with gov't regs.

I've got a very specific security feature that queries some legacy code via 
HTTP and another MYSQL DB (again a separate database from the main application).

I'm using django 1.5.1 and Python 2.6 on CentOs

I would like to use the same code in various projects.  Should I move these 
features into separate django applications and if so, how should I structure my 
directories and imports to keep it clean.

I suppose this might be a candidate for middleware, but I'm the only guy 
working on this and cannot devote much time to "infrastructure tangents" no 
matter how good they might be.

I would appreciate a little advice on the good, bad and ugly solutions to the 
above, based on the communities more extensive experience.

Thanks,

Fred.

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




RE: Deployment Conundrum

2013-06-08 Thread Sells, Fred
Once you get the configuration kinks worked out, using a script to copy a 
directory is brute force but easy.  You can always download XAMP  to get the 
apache/mysql stuff in windows.   Also it's hard to argue the cost of a discount 
service like Webfaction against the labor to "roll your own" but sometimes 
management can be difficult ;)  good luck.

Fred.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Daniel Braun
Sent: Tuesday, June 04, 2013 8:21 AM
To: django-users@googlegroups.com
Subject: Re: Deployment Conundrum

Thanks for your answer, I actually follow you on twitter so it's funny to get 
some "face time".

Anyway, what I mean by replicating Heroku is specifically the deployment 
workflow - not the scaling side of things.
I have personally already set up deployment on a physical linux box we have 
here in the office using fabric, git, nginx and gunicorn, so I have at least 
some idea on what I want to achieve.

I guess the main problem is getting fabric to work with Windows, which to my 
knowledge, isn't possible.
Does Windows have a remote access protocol similar to SSH, through which I can 
run deployment commands?

On Sunday, June 2, 2013 11:17:22 AM UTC+3, Russell Keith-Magee wrote:

On Sun, Jun 2, 2013 at 3:37 PM, Daniel Braun > 
wrote:
Hello,
I'm working in a non-profit organization. It's a design archive and research 
institute based in Israel.
We're developing (me actually, the only developer) a Django website to replace 
our ASP/MS-Access horrible system.

To the point - the only server I am allocated by the IT department is a Windows 
2008 server.
I'm currently working with Heroku, and needless to say, deployment is a breeze.
(Would love to stay with it, except I don't have the budget to pay for 
heroku/s3)

I realize I can run apache as a server, or even IIS. But how do I go about 
replicating heroku's deployment process (with git)?

Well, it depends what you mean by replicating Heroku.

If you just mean "getting a website up and running", then all you need is a git 
checkout of your source code, a web server configuration that points at that 
checkout, and a Python environment that can be called from the web server. I 
can't provide much specific advice here, but mod_wsgi configuration should be 
mostly standard regardless of the operating system, and it's not *that* hard to 
get working. Google has plenty of hits for "Django deployment windows"; you 
should be able to cobble something together from those links.

Once you've got your configuration working, redeploying should just be a matter 
of refreshing your git checkout and restarting/reloading the web server. It 
might be worthwhile writing some scripts to automate the update procedure, but 
worse case, it should only be a couple of commands.

If you want all the nifty auto scaling stuff that Heroku does -- that's another 
issue entirely. *That* sort of functionality means you need to have a deep 
understanding of your hosting environment. I don't think there are going to be 
any simple solutions here.

Is it viable to install a Ubuntu server virtual machine on top of the Windows 
installation? Does anyone have experience with it?

Is it possible? Yes. Will it perform as well as a native web server running on 
the native platform? No. Will the different between native and VM matter? That 
depends.

Whether this is a viable approach really depends on how comfortable you are 
with Unix vs Windows, and how much traffic you're actually going to serve. If 
you're going to serve a *lot* of traffic, then you probably want to avoid 
virtualisation - every little bit of extra performance will help. However, if 
you're only serving a handful of pages to a small internal group, then the 
overhead doesn't really matter -- If you've only got three people visiting your 
site, you could probably run the site on a Commodore 64 and still have CPU 
cycles to spare :-)

Yours,
Russ Magee %-)


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


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




RE: Cannot import mypackage with code in the __init__.py file

2013-06-19 Thread Sells, Fred
Thanks Bill, I've tried all but the __future__ option.  I'll give it a try.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Bill Freeman
Sent: Wednesday, June 19, 2013 3:03 PM
To: django-users
Subject: Re: Cannot import mypackage with code in the __init__.py file

Have you tried
   import app.mypackage
or
from app import mypackage
Or, from within views.py or mymodule.py, if you have done
from __future__ import absolute_imports
then try
  import .mypackage
(There is a period before "mypackage" on that line.)

On Wed, Jun 19, 2013 at 2:51 PM, fred 
mailto:fred.se...@adventistcare.org>> wrote:
I'm upgrading to django 1.5.1 on CentOs 6.4 with python 2.6.6  although I'm 
developing on a W7 with the django debug server.

I am getting executing my view.py and most of the modules it uses.  But in one 
scenario, the import fails, see directory outline below

NewMdsServer
   |___NewMdsServer
  |___settings.py
  |___wsgi.py
  |___ ...
   |___app
|___views.py
|___mymodule.py
|___mypackage
   |___  __init__.py
   |___  x.py
   |___  y.py

I have code in the __init__.py which then imports x, y, etc

I cannot seem to import mypackage from views or other modules at the same 
level.  I've tried multiple variants as shown below and sys.path includes the 
directory above app.
from app import mypackage  -- "No module named mypackage"
import mypackage  -- "No module named ..
import app.mypackage -- ditto

The really strange thing is I could swear this was working last week  before I 
got pulled off onto another project for a few days.  I'm the only one using 
this server and I have root access.  I've tried google, but cannot find a 
phrase that gives me anything useful.  I would really appreciate some advice on 
what I'm doing wrong.

Thanks,

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



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


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




RE: Cannot import mypackage with code in the __init__.py file

2013-06-20 Thread Sells, Fred
Yes, the files exist and they have read access and are owned by apache.  I do 
use a symlink of "current" to point to my actual project directory to 
facilitate testing.  I ported this from 1.3 by creating a new 1.5 project and 
then moving the contents of the old to the new.  The error looks like this:
Python Path:(this is the actual data, I simplified structure in my earlier 
posts.

['/var/www/mdsdeploy/current/AccNewMdsServer',
 '/usr/lib/python26.zip',
 '/usr/lib/python2.6',
. . .

 My wsgi.conf looks like this :

WSGIScriptAlias /mdsapi 
/var/www/mdsdeploy/current/AccNewMdsServer/AccNewMdsServer/wsgi.py


WSGIPythonPath /var/www/mdsdeploy/current
WSGIPythonPath /var/www/mdsdeploy/current/AccNewMdsServer

WSGIScriptReloading On

#commented the following out until I get it to work.
#WSGIReloadMechanism Process
#WSGIDaemonProcess djangoapps processes=2 threads=15 
python-path=/home/mdsdeploy/current:/home/mdsdeploy/current/AccNewMdsServer
#WSGIProcessGroup djangoapps
LogLevel info
WSGISocketPrefix /var/run/wsgi



Order allow,deny
Allow from all




Order allow,deny
Allow from all



Order allow,deny
Allow from all




Order allow,deny
Allow from all



-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Tom Evans
Sent: Thursday, June 20, 2013 4:50 AM
To: django-users@googlegroups.com
Subject: Re: Cannot import mypackage with code in the __init__.py file

On Wed, Jun 19, 2013 at 7:51 PM, fred  wrote:
> I'm upgrading to django 1.5.1 on CentOs 6.4 with python 2.6.6  
> although I'm developing on a W7 with the django debug server.
>
> I am getting executing my view.py and most of the modules it uses.  
> But in one scenario, the import fails, see directory outline below
>
> NewMdsServer
>|___NewMdsServer
>   |___settings.py
>   |___wsgi.py
>   |___ ...
>|___app
> |___views.py
> |___mymodule.py
> |___mypackage
>|___  __init__.py
>|___  x.py
>|___  y.py
>
> I have code in the __init__.py which then imports x, y, etc

Do the files NewMdsServer/NewMdsServer/__init__.py and 
NewMdsServer/app/__init__.py exist?

Cheers

Tom

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



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




RE: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-23 Thread Sells, Fred
Creating django management commands is easy and then all works nicely.  
Assuming you're at 1.5, not sure about older ones.  Just google it.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of DJ-Tom
Sent: Monday, September 16, 2013 10:26 AM
To: django-users@googlegroups.com
Subject: How do I create a standalone python application that uses the django 
environment (e.g. the ORM etc...)?

For reporting purposes I want to use List & Label from Combit. The web/online 
part is no big deal since the reporting module can be run without user 
interface (creating Excel or PDF files)

But the actual form designer part that is used to define the report layout is a 
windows GUI application, so I would like to have a python file inside my Django 
app that I can call to start the designer part on my local machine.

I have now read a bunch of descriptions on how to use Django in a standalone 
application but did not succeed so far in actually running my form designer.

This is what I currently have, i tried to start this via "python 
formdesigner.py", after activating the correct virtualenv:

from Tkinter import *
from ctypes import *
import django
from models import *

LL = windll.cmll18

### Declaration of application class omitted, this is plain python  

app = Application()
app.master.title("List & Label sample application")
app.mainloop()


Regardless what I try, I can't get the model class import to work.

I also tried SET DJANGO_SETTINGS_MODULE=settings and project.settings and 
project.app.settings... nothing worked.

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

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


multiple databases and syncdb problem

2013-10-29 Thread Sells, Fred
I can syncdb OK if I don't add allow_syncdb to my router, but if I add the 
allow_syncdb to the router, only my default db is synced.  Any idea what I'm 
doing wrong, code is:

def allow_syncdb(self, db, model):
print 'allow syncdb for* Inserv Router', db, 
model._meta.app_label
return db=='inserv' and model._meta.app_label == 'inserv'

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


Problem with syncdb and multiple databases

2013-11-11 Thread Sells, Fred
I'm using Django 1.5 and Mysql 5.1 and am in the early stages of a multiple app 
development and the schema is changing frequently as "hidden" requirements 
emerge.  I cannot get syncdb to sync anything other than my default db, and 
when I change my default, it still seems to see the old one.   Here is 
settings.py, with some junk removed for brevity.  Routers.py is attached and is 
in the same directory as settings.  I cannot figure out what's going wrong with 
syncdb, but the normal application seems to work correctly.I had commented 
out the "allow_syncdb" in the routers because I could not get it to work, it 
seems to have some impact but not sure what.

settings.py=
DATABASES = {
'default': {'ENGINE': 'django.db.backends.mysql', 'NAME': 'accstaff'...
},
'wnr': {   'ENGINE': 'django.db.backends.mysql', NAME': 'wnr'...},
'accstaff': {'ENGINE': 'django.db.backends.mysql', 'NAME': 
'accstaff'...},
'inserv': {  'ENGINE': 'django.db.backends.mysql', 'NAME': 'inserv'...}
}

DATABASE_ROUTERS = ['AccWeeklyNursingReport.routers.WnrRouter',
'AccWeeklyNursingReport.routers.AccStaffRouter',
'AccWeeklyNursingReport.routers.AccInservRouter']

=end settings.py===

The following is the output example

C:\all\django\AccWeeklyNursingReport>mysqladmin -f drop  accstaff
Database "accstaff" dropped

C:\all\django\AccWeeklyNursingReport>mysqladmin -f create  accstaff

C:\all\django\AccWeeklyNursingReport>python manage.py  syncdb 
--database=accstaff
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff sessions
allow syncdb for WnrRouter accstaff wnrapp
allow syncdb for WnrRouter accstaff wnrapp
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff sessions
allow syncdb for WnrRouter accstaff wnrapp
allow syncdb for WnrRouter accstaff wnrapp
Creating tables ...
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff contenttypes
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

C:\all\django\AccWeeklyNursingReport>echo DONE
DONE

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


routers.py
Description: routers.py


wsgi vs. debug server URL's

2013-11-12 Thread Sells, Fred
We deploy with Apache and it serves both django and generic html.  We are a 
small shop with internal applications and minimal server load and we are not 
ready to have a django server and an html server.

I use the /wsgi  prefix in my url's to identify what goes to django (via the 
httpd wsgi.conf file)

When I deploy with wsgi in production my urls look like  
http://myserver.mydomain.com/wsgi/myapp

But when running the debug server I get http://localhost/myapp

Is there a clean way to handle this without having to define the "/wsgi" prefix 
and use it conditionally based on whether I'm Unix (production) or Windows 
(debug)???

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


RE: [Suspected Spam] Redoing a C/CGI web app in Python/Django?

2011-04-13 Thread Sells, Fred
That's essentially what google does.

I would suggest dealing with the Python~C integration/test as a command
line execution and when that works, learn to call the python wrapper
from django.

It's been 15 years since I actually did any of this, but it is pretty
straight forward with SWIG.  There are other ways also, I just don't
know them.

Depending on how heavily site is used, you can also run the c program as
a shell script using popen, et. Al.  This is crude but effective when
you have unmaintainable C code that runs.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Graeck
Sent: Tuesday, April 12, 2011 7:15 PM
To: Django users
Subject: [Suspected Spam] Redoing a C/CGI web app in Python/Django?

Hi all,

Just looking for input ... tips, suggestions, etc.

We have an old web app written in C using CGIs.  All the html is
generating in the C code using print statements. It's become almost
impossible to do anything other than make very minor UI changes due to
the complexity of the code and the tediousness of trying to make UI
updates via 1000s of print statements. So, we're thinking of moving to
something like Django.

Since Python can call C code (libraries, functions, etc, if I'm
understanding correctly - I'm pretty new at Python myself - and
Django), would it be feasible to build the UI templates in Python/
Django and still be able to reuse some of our C code - the stuff that
crunches the huge amounts of data that we have to process?

I've started reading: http://docs.python.org/extending/extending.html

But any input (esp from people that might have trie such a migration
before) would be appreciated.

Thanks!

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


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



RE: Best Practice for Raw SQL

2011-04-13 Thread Sells, Fred
In my case I had to read some legacy data from a different schema on the
same MySQL server and it was easy (but perhaps not elegant) to just
establish a separate connection using MySQLdb module.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Jacob Kaplan-Moss
Sent: Monday, April 11, 2011 11:51 AM
To: django-users
Subject: Re: Best Practice for Raw SQL

On Mon, Apr 11, 2011 at 7:53 AM, Dan Gentry  wrote:
> Where I run into trouble is that the query returns data in columns,
> but not objects. That means that I can't reference an object attribute
> using dot notation in my templates or views. Instead, I have to
> include each attribute that will be needed as a query column. This
> will limit what I or someone else can do in templates later without a
> mod to the query.

You're looking for the `raw()` method: http://django.me/raw. It takes
a raw SQL query and yields models for you.

Jacob

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


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



  1   2   >