Integration with Legacy DB

2015-01-14 Thread Sells, Fred
Although I have not tried it, the docs are pretty clear about how to sync a 
django model to an existing legacy DB (sqlserver08 in this case).

But is there a way to sync to a select statement with multi-table joins without 
first creating a View?

I know that creating a view would be easiest, but I’ve got some policy/security 
issues in my organization that require jumping through additional hoops and am 
hoping there is some Django “magic” to solve this.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DCD75728F460F14586086EA606E830820133E90ADA%40ACEVXCHMBX1001.ADVENTISTCORP.NET.
For more options, visit https://groups.google.com/d/optout.


centos 6 python 2.6 django 1.7 install problem

2014-10-14 Thread Sells, Fred
Downloaded the gz file, unzipped and ran python setup.py install

Note, due to network security settings, I cannot use pip or any similar tool 
that needs external web access

I get the following errors,  any advice on how to fix?

…snip….
creating /usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg
Extracting Django-1.7-py2.6.egg to /usr/lib/python2.6/site-packages
SyntaxError: ('invalid syntax', 
('/usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg/django/forms/utils.py', 
57, 34, 'return {f: e.as_data() for f, e in self.items()}\n'))

SyntaxError: ('invalid syntax', 
('/usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg/django/utils/lru_cache.py',
 28, 34, ' fasttypes = {int, str, frozenset, type(None)},\n'))

SyntaxError: ('invalid syntax', 
('/usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg/django/test/signals.py',
 103, 41, "if kwargs['setting'] in {'LANGUAGES', 'LANGUAGE_CODE', 
'LOCALE_PATHS'}:\n"))

SyntaxError: ('invalid syntax', 
('/usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg/django/template/loader_tags.py',
 145, 19, 'for name, var in 
six.iteritems(self.extra_context)\n'))

SyntaxError: ('invalid syntax', 
('/usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg/django/contrib/humanize/tests.py',
 95, 40, "with translation.override('ja'), 
self.settings(USE_L10N=True):\n"))

SyntaxError: ('invalid syntax', 
('/usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg/django/contrib/formtools/tests/wizard/wizardtests/tests.py',
 128, 40, "with open(THIS_FILE, 'rb') as f, 
temp_storage.open(UPLOADED_FILE_NAME) as f2:\n"))

SyntaxError: ('invalid syntax', 
('/usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py',
 160, 40, "with open(THIS_FILE, 'rb') as f, 
temp_storage.open(UPLOADED_FILE_NAME) as f2:\n"))

SyntaxError: ('invalid syntax', 
('/usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg/django/contrib/auth/tests/test_forms.py',
 123, 42, "with self.settings(USE_I18N=True), 
translation.override('pt-br', deactivate=True):\n"))

SyntaxError: ('invalid syntax', 
('/usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg/django/contrib/gis/db/models/constants.py',
 4, 17, "'bbcontains', 'bboverlaps', 'contained', 'contains',\n"))

SyntaxError: ('invalid syntax', 
('/usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg/django/contrib/gis/db/backends/postgis/operations.py',
 79, 34, "valid_aggregates = {'Collect', 'Extent', 'Extent3D', 'MakeLine', 
'Union'}\n"))

SyntaxError: ('invalid syntax', 
('/usr/lib/python2.6/site-packages/Django-1.7-py2.6.egg/django/contrib/gis/db/backends/spatialite/operations.py',
 68, 33, "valid_aggregates = {'Extent', 'Union'}\n"))

-- 
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/DCD75728F460F14586086EA606E830820132593802%40ACEVXCHMBX1001.ADVENTISTCORP.NET.
For more options, visit https://groups.google.com/d/optout.


RE: [ELI5] how to deploy django

2014-03-18 Thread Sells, Fred
The latest “Two Scoops of Django” book claims to have good info on deploying; 
I’ve not read it yet.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Walter Wang
Sent: Tuesday, March 04, 2014 11:54 AM
To: django-users@googlegroups.com
Subject: Re: [ELI5] how to deploy django

Thanks alot for all your answers, I really appreciate it.

I am using ubuntu 12.04 lts hosted on digitalocean. Apache version is 2.2.2 and 
django is 1.6, I created a virtualenv in the home directory, named myproject, I 
am using python3.2 as the interpreter in the virtualenv.

All your answers has given renewed energy.

So from reading all your answers, based on having django 1.6. I should edit the 
wsgi.py file and I don't have to make a "wsgi file" according to the digital 
ocean instructions.

What about the httpd.conf file? According to sam I should not touch it, but the 
official documentation for 1.6 says otherwise.
--
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/2728636a-1b69-4836-b5f4-bb95c89f39ea%40googlegroups.com.
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DCD75728F460F14586086EA606E83082011A8C8552%40ACEVXCHMBX1001.ADVENTISTCORP.NET.
For more options, visit https://groups.google.com/d/optout.


RE: big legacy database with complex many to many relationships

2014-02-24 Thread Sells, Fred
Thanks,  I think you set me on the right track.

Fred.

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Javier Guerra Giraldez
Sent: Monday, February 24, 2014 3:12 PM
To: django-users@googlegroups.com
Subject: Re: big legacy database with complex many to many relationships

On Mon, Feb 24, 2014 at 2:54 PM, Sells, Fred <fred.se...@adventistcare.org> 
wrote:
> I have to integrate to a large read only legacy mssql database .


while certainly it's possible to configure this as a second database and use 
the ORM, I've found that it's more work than usually needed.
especially if you already have defined SQL patterns, or worse, stored 
procedures.  porting those to ORM means debugging them again...

but there's nothing preventing you from using any Python way to access that 
data.  particularly if you're going to treat it as read-only.
just write some utility functions that use ODBC or any other interface to pull 
your data and use that in your Django views, or even in your models.

--
Javier

--
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/CAFkDaoS1WBGDN80v5J%2BCh%2BXCx_g1SD2obvjG51AqO_YJA0mM7w%40mail.gmail.com.
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DCD75728F460F14586086EA606E8308201192B64A2%40ACEVXCHMBX1001.ADVENTISTCORP.NET.
For more options, visit https://groups.google.com/groups/opt_out.


big legacy database with complex many to many relationships

2014-02-24 Thread Sells, Fred
I have to integrate to a large read only legacy mssql database .

The many-to-many tables have a lot of additional fields like start/end dates of 
the relationship and their own naming conventions

Can anyone point me to some links that treat this topic in depth.  I've looked 
at the django book and that's a starting point,

Can anyone point me to some good "how to" links on this that provide some 
details and some pitfalls to watch for.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DCD75728F460F14586086EA606E8308201192B5406%40ACEVXCHMBX1001.ADVENTISTCORP.NET.
For more options, visit https://groups.google.com/groups/opt_out.


RE: need django.cache advice

2014-01-09 Thread Sells, Fred
Thanks, Javier.

The interesting 1000 records are changing very slowly.  A few records could be 
added/deleted every minute but mostly it's some field changes to the records in 
the set.

No change is more or less worthwhile than any other change. All need to get 
into the database "eventually".   Update is not expensive but regenerating the 
queryset is.

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Javier Guerra Giraldez
Sent: Thursday, January 09, 2014 4:58 PM
To: django-users@googlegroups.com
Subject: Re: need django.cache advice

On Thu, Jan 9, 2014 at 4:43 PM, Sells, Fred <fred.se...@adventistcare.org> 
wrote:
>
> Fred: I was unclear.  The initial join is 1 x 1000 x 20 x 100 ...  which 
> gets reduced to about 1000 records.  A few records are changed every second.


are the 'interesting' 1000 out-records always the same, or changing slowly?  is 
it easy to test if any specifc in-record alters the result or not?

if yes on both, then you might invert the calculation, from a 'pull'
method (the current) to a 'push', where you keep the result precalculated and 
on each modification you test if it's worthwhile to redo it.

this assumes:

A.- the process is expensive to do every time for every client (that's the 
problem)

B.- it's cheap to verify if the new data alters the result (my initial
questions)

C.- the queries are frequent enough that few precalcs would be unseen.
 (i guess so given the number of clients and rate of queries)


if condition C doesn't hold, but B does, then another thing to try:

- on each query, first check if the answer is already precalculated.
if it is, just get that

- if it's not, do the job and store in the cache

- on each input modification, check if it alters the result.  if so, just 
delete the cache.


finally, if condition B doesn't hold, just store the result in a cache entry 
that expires in a minute.  that means that the process would occur at most once 
a minute and the clients could get results that are at most a minute old.


--
Javier

--
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/CAFkDaoQf0PDDAMTjCzUp92jHk%2BS34CDcMt9iJS4uRTCJf%2BLQKw%40mail.gmail.com.
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DCD75728F460F14586086EA606E830820111A51276%40ACEVXCHMBX1001.ADVENTISTCORP.NET.
For more options, visit https://groups.google.com/groups/opt_out.


RE: need django.cache advice

2014-01-09 Thread Sells, Fred
Thanks Erick, I was not aware of Varnish.

Erik wrote:

1000 records from 6 tables shouldn't be a problem if your database is properly 
indexed. Databases are good at caching query results and not doing excess work 
when the data hasn't changed. Maybe the first request from a terminal will be 
slow(ish), but the rest should be fast.

Fred: I was unclear.  The initial join is 1 x 1000 x 20 x 100 ...  
which gets reduced to about 1000 records.  A few records are changed every 
second.

What sort of performance problems are you having? How fast is it now, and how 
fast do you need it to be? Have you profiled the requests from the terminal and 
determined that the culprit is indeed the database?

Fred: I suspect (but have not confirmed) that the problem in connection 
pooling (i.e. lack thereof).  Some requests timeout and blank out the web page 
on the terminal.  
The webpage itself is very simple.  Part of my "todo" is to put a 
timing decorator on this view method to confirm the problem.  I've increased 
virtual cpu's and ram on server
Which helped a little but deleting obsolete information helped a lot.

You could go with your own suggestion, you could create a database view, you 
could cache the result in Varnish if the terminals are doing HTTP requests. But 
it depends on where in the stack you are wasting time.

Fred:I cannot really cache the page because it should change every few 
minutes.  I can accept a minute or two of delay in getting the latest data but 
not 5 minutes. 
 I would probably (ugly) modify the cache and the model so users are 
not complaining that their changes don't show up.

Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/A179517C-499F-4C28-8B77-101A554B1885%40cederstrand.dk.
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DCD75728F460F14586086EA606E830820111A51205%40ACEVXCHMBX1001.ADVENTISTCORP.NET.
For more options, visit https://groups.google.com/groups/opt_out.


need django.cache advice

2014-01-09 Thread Sells, Fred
I've got a queryset that is ~ a 6 table join of a lot of data that generates 
about 1000 records with about 25 fields each

I've got ~100 terminals hitting this query every 1 minute looking for a subset 
of 25 records

~20 records change every minute

I was thinking about updating the data (queryset) once a minute on a cron job 
and saving that in the django.cache

Then each terminal would access the cache and and get the subset that applies 
to them.

Does that make sense?  Is there a better way?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DCD75728F460F14586086EA606E830820111A510C6%40ACEVXCHMBX1001.ADVENTISTCORP.NET.
For more options, visit https://groups.google.com/groups/opt_out.


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.


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


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.


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.


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




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.




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.




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.




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



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 <fred.se...@adventistcare.org> 
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.



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



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



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



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.



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.



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.



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: [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: 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 <akary...@yahoo.gr>:
> 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=3512322_id=85796
> =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: Looking for Django IDE

2012-04-02 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: 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: 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.



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



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.



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.



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.



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
<fred.se...@adventistcare.org> 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
<clell...@gmail.com>

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



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
<fred.se...@adventistcare.org> 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.



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.



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.



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.



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.



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.



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.



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.



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: 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
<fred.se...@adventistcare.org> 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.



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



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" <fred.se...@adventistcare.org>
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.



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: Django for a front end designer

2011-08-05 Thread Sells, Fred
I think many of the members of this group have a pro-python bias for a
good reason.  Most of us have had to work with many other frameworks and
languages and Python is the only one I would use to "unwind".

Sometimes it's worth "paying your dues"

-- 
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: Run an application periodically on django

2011-08-04 Thread Sells, Fred
You can run a django module directly if you do something like:

 

if __name__ == '__main__':

sys.path.append( '/all/projects/one-up-from-site directory) #may not
be needed in all cases.

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

 

The problem I just encountered using cron (which more experienced Unix
dudes would know) is that running as cron does not have all the same
environment variables set as when running as root.  So we used a shell
script to set the environment variables and then run the python module.
The shell script was launched by cron.

 

Having said all that, I think I like the curl solution better.  It keeps
all you code logic together and gives you the right environment.  

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Praveen Krishna R
Sent: Thursday, August 04, 2011 6:43 AM
To: django-users@googlegroups.com
Subject: Re: Run an application periodically on django

 

If you are on Linux machine, you can use cron jobs to schedule the jobs.

 

When I faced such a problem what I did was, I created a view to update
my site with a secret Url. I have scheduled a cron job to call this url.
So when the view gets called (with "curl" command I'm correct), the site
gets updated. I can call this url from a browser also, anytime. There
should be definitely  better methods of doing this, like importing
django to make a standalone app or something?! I haven't tried it yet!

 

 

On djcelery, I think you need to configure RabbitMQ or something to work
with!? correct me Kenneth, if I'm wrong. 

 

On Thu, Aug 4, 2011 at 8:12 AM, Mohamed Ghoneim 
wrote:

Hey guys,

 

I am new to djnago and I have heard a lot about its powerful
capabilities, so I preferred it over other web frameworks.

 

My problem is I have a webpage that its content should be updated
automatically every 30 seconds as I build an app that gets data from
another web page

and parse it and then updates my webpage.

 

My problem is how can I schedule this this app to run every 30 seconds?
and can I do this on a hosting website?

--
Mohamed Sayed Ghoneim

 

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




-- 

Thanks and Regards,

Praveen Krishna R

 

-- 
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 for a front end designer

2011-08-03 Thread Sells, Fred
I had to learn basic Php for a class.  It's worth it to subscribe to
Lynda.com for a few months to get their online training videos.  Removes
much pain.  Like all training, it covers the basics and you really don't
know what you don't know until you try to do something.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of biofob...@gmail.com
Sent: Tuesday, August 02, 2011 4:58 PM
To: Django users
Subject: Re: Django for a front end designer

Thank you all for the advices/sugestions.
For what i read most of you advice on PHP + framework and i can
understand that. I looked at django and rails as a option for me to
have. My PHP knowledge is very limited, and sometimes i need some
functionality on a wordpress site or on a textpattern one but my
knowledge doest allow me to do much. Thats when i "feel" i need to
learn some programing language in order to be able to do what i have
in 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-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 and Rich Client

2011-06-09 Thread Sells, Fred
FWIW  I use flex for the rich client and get xml out of django which
flex handles nicely.

I use Ldap for Authorization (had to use legacy junk for authentication
to be compliant) and I have a cron job that loads the ldap groups I need
and there members into my db.  Solves speed and reliability problems
we've had with our ldap server.

IMHO SOAP sucks unless you're using Java where you've got plenty of
tools.  

The Django templating system is sweet and if you combine it with jquery
you can use that .load() function to "assemble" a page of components.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Knack
Sent: Thursday, June 09, 2011 2:10 PM
To: Django users
Subject: [Suspected Spam] Django and Rich Client

Hi guys,

I've got a prototype DB + Rich Client app and need to make a proper
production app out of it. The client is written in PyQt and needs to
fullfill quite some functional and performance requirements (I would
really like to keep it). The client connects directly to the DB.

After some thoughts about security I came to the conclusion that using
django is the way to go. Now I seek some coarse advice / feedback
wether I'm heading in the right directions. I've got some miles to go
and looking forward to learning Django, but want to avoid newbie
pitfalls. So if something of the following sounds like bad ideas to
you, please let me know ;-).

Current plans are:

1) Using an Oracle DB
2) LDAP authentification
3) Role based authorisation. Here I'm a bit unsure about the approach.
I would implement it by myself within the django world (don't know yet
where exactly).
4) Transfering the data using a web service via https. Here are my
biggest uncertainties. What kind of web service to use? Rest, xml-rpc
or soap? How to package the acual data? Embedded in the html or xml?
As binary payload? I would need only basic stuff like log in, log out,
read and write whole database rows, which are basically the business
objects. Most of the logic is done on the rich client. I would
transfer large amounts (10s of business objects) of data at
startup time (very eager loading to the client). But also lazy loading
of course.
5) One important concept is that I change only a small amount of the
data objects. Most of the changes lead to new versions. Therefore I
hope to be able to use caching extensivly. The data objects which are
immutable could be permanently cached in memory. How about
authorisation of these cached objects? Are there ways django takes
care of this?

A long first post ;-). Any comments are appreciated!

Cheers,

Jan

-- 
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: This section is converting database table to excel file

2011-04-28 Thread Sells, Fred
Since Excel will import a csv file, why not just write a csv file.  In mysql, 
while ugly, you could shell down and use the mysql command line options to 
export a query to csv.

 

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Od-Erdene Ch
Sent: Thursday, April 28, 2011 6:23 AM
To: django-users@googlegroups.com
Subject: This section is converting database table to excel file

 

hi there

this section is converting database table to excel file.

 

problem is when converting database table to excel file (it is containing 6400 
[six thousand four hundred] rows) it is spending more than 10 minutes.

that is very slow. is there any idea to make more faster. Help me

 

 

CODE:

 

if request.GET.has_key('excel') :

if request.GET['excel'] == "true":

qs = CarDetails.objects.all().order_by(sord + sidx)

wb = xlwt.Workbook()

ws = wb.add_sheet(u'CarDetails')

labels = [u"型式", u"車名", 
u"車輌詳細コード",u'車体形状',u"類別区分番号",u"車輌重量諸元",u"全長",

  u"全幅",u"全高",u"用途",u"形状",u"原動機型式",u"総排気量",u"営・自家用区分",

  u"乗車定員",u"最大積載量",u"車輌総重量",u"燃料の種類",u"乗車定員括弧",u"最大積載量括弧",

  u"ローター数",u"燃料種類",u"燃料種類括弧 その他"]



ws.write_merge(0, 0, 0, 22, u'車輌マスター管理', get_title_style())



label_style = get_label_style2()

for i in range(len(labels)) :

ws.write(1, i, labels[i], label_style)

ws.col(0).width = get_computed_width(-30) # by pixel

ws.col(1).width = get_computed_width(150)

ws.col(2).width = get_computed_width(150)

ws.col(3).width = get_computed_width(150)

ws.col(4).width = get_computed_width(150)

ws.col(5).width = get_computed_width(150)

ws.col(6).width = get_computed_width(150)

ws.col(7).width = get_computed_width(150)

ws.col(8).width = get_computed_width(150)

ws.col(9).width = get_computed_width(150)

ws.col(10).width = get_computed_width(150)

ws.col(11).width = get_computed_width(150)

ws.col(12).width = get_computed_width(150)

ws.col(13).width = get_computed_width(150)

ws.col(14).width = get_computed_width(150)

ws.col(15).width = get_computed_width(150)

ws.col(16).width = get_computed_width(150)

ws.col(17).width = get_computed_width(150)

ws.col(18).width = get_computed_width(150)

ws.col(19).width = get_computed_width(150)

ws.col(20).width = get_computed_width(150)

ws.col(21).width = get_computed_width(150)

ws.col(22).width = get_computed_width(150)

today = datetime.strftime(datetime.today(),"%Y-%m-%d")

rown = 2

simple_style = get_simple_style()

 

for list in qs :

car_maker_code = ""

car_maker = ""

car_name2 = ""

tax = ""

model = ""

car_name = ""

name = ""

body = ""

class_type_number = ""

weight = ""

length = ""

width = ""

height = ""

usage = ""

view_type = ""

motor_type = ""

totol_piston_cc = ""

is_own = ""

human_size = ""

kg_size = ""

totol_weight = ""

fuel_type = ""

human_size_kakko = ""

kg_size_kakko = ""

rotor_number = ""

fuel_type_kakko = ""

fuel_type_kakko_sonota = ""

if list.model: model = list.model

if list.carname: car_name = list.carname

if list.name: name = list.name

if list.body: body = list.body

if list.class_type_number: class_type_number = 
list.class_type_number

if list.weight: weight = list.weight

if list.length: length = list.length

if list.width: width = list.width

if list.height: height = list.height

if list.usage: usage = list.get_usage_display()

if list.view_type: view_type = list.view_type

if list.motor_type: motor_type = list.motor_type

if list.totol_piston_cc: totol_piston_cc = list.totol_piston_cc

if list.is_own: is_own = list.get_is_own_display()

if list.human_size: human_size = list.human_size

if list.kg_size: kg_size = list.kg_size

if list.totol_weight: totol_weight = list.totol_weight

if list.fuel_type: fuel_type = list.get_fuel_type_display()

if list.human_size_kakko: 

RE: Please Help a django Beginner!

2011-04-19 Thread Sells, Fred
I received this helpful hint from Shawn M. when faced with the same issue:
import os

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'  #whereever your 
settings.py is located.


>From the docs:
http://docs.djangoproject.com/en/dev/topics/settings/



-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Aviv Giladi
Sent: Friday, April 15, 2011 2:41 PM
To: Django users
Subject: Re: Please Help a django Beginner!

Thank you for the response. Is there any documentation / books out
there that you would recommend reading to get acquainted with django
in that perspective?

On Apr 15, 10:58 am, Jirka Vejrazka  wrote:
> I use Djano ORM for a lot of my backend processing where no web is
> involved. Just make sure that DJANGO_SETTINGS_MODULE is defined in
> your environment and you can use pretty much any part of Django in
> your own code/scrits/whatever.
>
>   HTH
>
>     Jirka
>
> On 15/04/2011, Aviv Giladi  wrote:
>
>
>
> > Hey guys,
>
> > I am an experienced Python developer starting to work on web service
> > backend system. The system feeds data (constantly) from the web to a
> > MySQL database. This data is later displayed by a frontend side (there
> > is no connection between the frontend and the backend). The backend
> > system constantly downloads flight information from the web (some of
> > the data is fetched via APIs, and some by downloading and parsing
> > text / xls files). I already have a script that downloads the data,
> > parses it, and inserts it to the MySQL db - all in a big loop. The
> > frontend side is just a bunch of php pages that properly display the
> > data by querying the MySQL server.
>
> > It is crucial that this web service be robust, strong and reliable.
> > Therefore, I have been looking into the proper ways to design it, and
> > got the following recommendation:
> > django as the framework (over Apache).
> > wrapping my sources with Piston for API usage.
> > All if this sounds great. I used django before to write websites (aka
> > request handlers that return data). However I don't see how django can
> > fulfill a role of a constant running (non request-serving) system -
> > being that it uses views/forms, which are not a part of my backend
> > system. Is want I want at all possible / advisable with django? Is
> > django what you would recommend for this?
> > If so, could you please refer me to some documentation / help files
> > more specific to my needs?
>
> > Thank you so much,
> > Aviv
>
> > --
> > 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: Best Practice for Raw SQL

2011-04-13 Thread Sells, Fred
Xcellent improvement; that's (my code) what happens when you're too busy
fixing the problem to learn the tool ;)

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Nick Arnett
Sent: Wednesday, April 13, 2011 4:44 PM
To: django-users@googlegroups.com
Subject: Re: Best Practice for Raw SQL

 

 

On Wed, Apr 13, 2011 at 1:38 PM, Sells, Fred
<fred.se...@adventistcare.org> wrote:

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.

 

You shouldn't have to do that.  Use this:

 

from django.db import connection, transaction

cursor = connection.cursor()

 

Then you can do anything you would with a MySQLdb cursor, e.g.:

 

cursor.execute("UPDATE foo SET bar = 3")

 

After any operation that changes data, apparently you should also call
this:

 

transaction.commit_unless_managed()

 

I'm doing a lot of that right now to vastly speed up a huge data import.

 

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



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: [Suspected Spam] mysql problems after upgrading to django 1.3

2011-04-10 Thread Sells, Fred
Try mysql from the command line, make sure the service is running.
Sometimes the install does not set it up to start on a reboot.

Make sure you did not specify the port (socket) either when you
installed or in django -- usually it's 3306 on a pc, don't know about
mac.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Rosemarie
Sent: Sunday, April 10, 2011 7:54 PM
To: Django users
Subject: [Suspected Spam] mysql problems after upgrading to django 1.3

hi :)
I'm fairly new to django. I'm using it on mac os 10.5.8. I installed
django 1.2.4 and created a small project that communicated with a
mysql database.  Everything was good.

Then I upgraded to 1.3, followed uninstall instructions, installed the
new version, everything seemed good.  Except now I can't run my old
app because I get a mysql error: (it's lengthy, sorry!)

python manage.py runserver
Validating models...

Unhandled exception in thread started by >
Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/django/core/management/
commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
  File "/Library/Python/2.5/site-packages/django/core/management/
base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
  File "/Library/Python/2.5/site-packages/django/core/management/
validation.py", line 103, in get_validation_errors
connection.validation.validate_field(e, opts, f)
  File "/Library/Python/2.5/site-packages/django/db/backends/mysql/
validation.py", line 14, in validate_field
db_version = self.connection.get_server_version()
  File "/Library/Python/2.5/site-packages/django/db/backends/mysql/
base.py", line 338, in get_server_version
self.cursor()
  File "/Library/Python/2.5/site-packages/django/db/backends/
__init__.py", line 250, in cursor
cursor = self.make_debug_cursor(self._cursor())
  File "/Library/Python/2.5/site-packages/django/db/backends/mysql/
base.py", line 322, in _cursor
self.connection = Database.connect(**kwargs)
  File "/Users/Rose/Downloads/Django-1.3/newSite/__init__.py", line
81, in Connect

  File "/Library/Python/2.5/site-packages/MySQL_python-1.2.3-py2.5-
macosx-10.5-i386.egg/MySQLdb/connections.py", line 187, in __init__
_mysql_exceptions.OperationalError: (2002, "Can't connect to local
MySQL server through socket '/tmp/mysql.sock' (2)")

-

Things I have tried:
-uninstalling django again and re-installing
-uninstalling the python's mysqldb and reinstalling

Any ideas on what I can do to fix this?

-- 
You received this message because you are subscribed to the Google
Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+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: LDAP and 1.2

2011-04-05 Thread Sells, Fred
Because our active directory contains many more users than are allowed
to use my django app, I have a cron job that runs every 5 minutes and
updates a mysql database with the subset I care about.  That way if AD
is offline at the time, I'm not hosed.

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Szabo, Patrick
(LNG-VIE)
Sent: Tuesday, April 05, 2011 3:47 AM
To: django-users@googlegroups.com
Subject: LDAP and 1.2

 

Hi, 

 

has anyone sucessfully conncted their django 1.2 app with Active
Directory ?!

 

Which snippet did you use ?!

 

I'm concastantly getting  "Invalid credentials" Error -.-

 

 

Kind regards

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

Patrick Szabo
XSLT Developer 

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

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

Fax: +43 (1) 534 52 - 146 

 

 

-- 
You received this message because you are subscribed to the Google
Groups "Django users" group.
To post to this group, send email to django-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: [Suspected Spam] Django app for data management and visualization

2011-04-05 Thread Sells, Fred
There are guys in this group who are much more sophisticated meta
programmers than I.  But here's a very simple method:

It is easiest if each unique module has the same class name, such as
"class Controller:"

Then define and import all your plugins (does not allow uploading
plugin, but that's risky anyway).  You can get all the files in your
plugins dir and import them using the python function (forgot it's name,
don't use it) or just eval ('import %s' % filename)  crude but works for
older python

Create a dictionary of key:module's

Mymodule = ModuleDictionary[somekey]
Workingobject = Mymodule.Controller(**parms)

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of alessio c
Sent: Tuesday, April 05, 2011 9:40 AM
To: Django users
Subject: [Suspected Spam] Django app for data management and
visualization

Hello,

I am thinking about starting a Django app to manage data (I need it
for financial reporting).

What I am wondering about those days is a way to create an application
that:

1) Allows the privileged user to insert a "plug in" that adds a module
and its views.

2) Allows the user to add views and "scripts" to an existing model.

The way I think this is a model centric application with different
views and file uploaders. For me this would be a break out as we use
to run different reports from the same dataset (just changing the
grouping, filtering, formulas). I need file uploaders as the same
model can be populated from different files, organized in different
ways.

Do you have some aviced on best practices to achieve this? I don't
want the user to touch the main web site when adding modules and
views.

-- 
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: Advice: project hosting apps

2011-04-04 Thread Sells, Fred
I've seen a lot of chatter about Eclipse mylyn which can be integrated
with trak.  Not used it however.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Javier Guerra
Giraldez
Sent: Monday, April 04, 2011 10:21 AM
To: django-users@googlegroups.com
Subject: Re: Advice: project hosting apps

On Mon, Apr 4, 2011 at 8:25 AM, Peter Herndon 
wrote:
> I want to provide per-project issue
> tracking, wiki or other documentation building, and a nice view of
> each project's git repository.

i use Fossil (http://www.fossil-scm.org)
here's a nice blog about it:
http://sheddingbikes.com/posts/1276624594.html

-- 
Javier

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

2011-03-30 Thread Sells, Fred
This may be using a canon to swat a fly, but...

I had a project some time ago where I needed a very repetitive
java/swing UI.  I ended up creating python classes that had a __repr__
method that generated the java source code.  Then I was able to have
very concise python files that instantiated the classes I needed and
used that to generate java.

Perhaps a similar idea would work with .css possible even using the
django template system.

Now I use flex/flash a lot more than html/js/css so I could be out of
touch here



-- 
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 IDE : how to start the devserver in an editor?

2011-03-30 Thread Sells, Fred
Using eclipse you can create a run configuration that starts the
dbserver and it will auto-reload whenever you change a file.  Of course
since the dbserver auto restarts when it detects a file change, the
command line is not all that bad.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of MrMuffin
Sent: Wednesday, March 30, 2011 3:21 PM
To: Django users
Subject: Django IDE : how to start the devserver in an editor?

I`m trying to develop a simple plugin[0] for the Editra[1] editor for
django development. Right now it can create django projects and apps
from within the editor. The editor is based on wxPython and I want to
start the devserver from within the editor, show a simple form with
the option to stop or kill/restart the server.

The goal is to minimize the need to do repetetive tasks in the console/
shell. My reason for doing this is that I`m working in a Microsoft
only company where you seldom do stuff using the command line. Selling
django is hard when I`m in and out of the shell/command line to start/
restart the server, syncdb, migrate etc. To make the job of selling
django to my co-workers and hopefully make development easier ( at
least for the django developers who likes to work in an IDE ) I`ve
started the work on a plugin for Editra. Right now the plugin adds a
menu item called Django with two subitems; create project and create
app. A context menu is in the works which will give different options
depending on the content of the file being edited; right click in a
window holding settings.py will give you the option to start the
server, call syncdb, migrate etc. A right click in views.py will give
you options to help you generate views, in models.py scaffolding,
generation of admin.py etc.

The only thing I cannot get my head around is how to start/kill/
restart the devserver from inside the app. If anybody has any
information about this I`d be very grateful. When the plugin is more
stable and has a few more features I`ll post something, perhaps do a
screencast as well. Any help, input, comments or ideas are
appreciated.

NB! I know the main problem here is not django specific, more
wxpython, but I post the message here because I hope this project
might be of interest to other django developers as well.

Regards,
Thomas Weholt


[0] https://bitbucket.org/weholt/editra.djangomanagement
[1] http://editra.org/

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



noobie cannot get mod_wsgi to import settings

2011-03-30 Thread Sells, Fred
I've been googling and trying this for 2 days now, I'm sure I'm just
confused about something basic because it cannot be that hard.  I've
tried all the hints I found via google and they made sense but no
success.

I'm running RHEL 6 Python 2.6.5, django 1.2.4 and mod_wsgi 3.2.  I'm
trying to configure the server so I can deploy independent django sites
via wsgi.  So my directory structure looks like this:
/var/www/wsgi-scripts
-> myapp.wsgi
-> test2.wsgi
...  such that I can drop in any wsgi file to deploy a new app.

I plan to deploy my django sites (totally independent of one another,
but all related to our intranet) as follows
/home/djangodeploy
-> __init__.py
-> mysite1
-> mysite2

I got a basic myapp.wsgi working OK and it prints out sys.path as
follows:
/home/djangodeploy
/usr/lib/python26.zip
/usr/lib/python2.6
/usr/lib/python2.6/plat-linux2
...snip...
/usr/lib/python2.6/site-packages/webkit-1.0

I've made sure apache is the user for all files and even changed
permissions to 777.  I've remembered to restart apache each time.   I
tried to import settings.py from the command line to make sure there
were no syntax errors and it works.  This site worked under the debug
server also.

My wsgi.conf file looks like this:

LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /wsgi /var/www/wsgi-scripts
WSGIPythonPath /home/djangodeploy
LogLevel info
WSGISocketPrefix /var/run/wsgi


Order allow,deny
Allow from all


  ### I'm not sure about this last
Directory, grasping at straws.
Order allow,deny
Allow from all



My wsgi module to launch django looks like this

import os,  sys
print >>sys.stderr, __file__, sys.path
#import homeworks  # this did not work


os.environ['DJANGO_SETTINGS_MODULE'] = 'homeworks.settings' #this did
not work
#never gets here
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
__

And the output of the apache error log looks like this (timestamp and ip
deleted for brevity):
ImportError: Could not import settings 'homeworks.settings' (Is it on
sys.path? Does it have syntax errors?): No module named
homeworks.settings

/var/www/wsgi-scripts/test2.wsgi ['/home/djangodeploy',
'/usr/lib/python26.zip', '/usr/lib/python2.6',
'/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
'/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload',
'/usr/lib/python2.6/site-packages',
'/usr/lib/python2.6/site-packages/gst-0.10',
'/usr/lib/python2.6/site-packages/gtk-2.0',
'/usr/lib/python2.6/site-packages/webkit-1.0']

mod_wsgi (pid=2399): Exception occurred processing WSGI script
'/var/www/wsgi-scripts/test2.wsgi'.
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py",
line 230, in __call__
 self.load_middleware()
   File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py",
line 33, in load_middleware
 for middleware_path in settings.MIDDLEWARE_CLASSES:
   File "/usr/lib/python2.6/site-packages/django/utils/functional.py",
line 276, in __getattr__
 self._setup()
   File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line
40, in _setup
 self._wrapped = Settings(settings_module)
   File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line
75, in __init__
 raise ImportError("Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e))
[Wed Mar 30 11:46:53 2011] [error] [client 192.168.218.34] ImportError:
Could not import settings 'homeworks.settings' (Is it on sys.path? Does
it have syntax errors?): No module named homeworks.settings


Would someone be kind enough to show me my mistake.  I've tried all I
can think of.

-- 
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 config question

2011-03-29 Thread Sells, Fred
I'm just converting from mod_python to mod_wsgi and making progress.  I
would like to be able to deploy multiple independent webapps without
having to edit the apache configs each time.  I'm thinking of something
like

 

/var/www/wsgi-scripts

App1.wsgi

App2.wsgi

...

 

Where I could deploy a new app by just dropping the .wsgi file into my
"wsgi deploy directory"

 

But it looks like the WSGIScriptAlias would point to a specific file and
I would need to add a new directive each time I added a new app.  Not
exactly the worst thing in the world, but it would be nice to not have
to touch the apache .conf files once I get it working.  Any ideas?

 

Here's my wsgi.conf file

LoadModule wsgi_module modules/mod_wsgi.so

WSGIScriptAlias /myapp /var/www/wsgi-scripts/myapp.wsgi

WSGIDaemonProcess sunbelt.org processes=2 threads=15

WSGIProcessGroup sunbelt.org

LogLevel info

WSGISocketPrefix /var/run/wsgi



Order allow,deny

Allow from all



 

 

-- 
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: How to run a file.py in the django environement

2011-03-28 Thread Sells, Fred
It was explained very clearly to me, I believe by shawn, but I've lost the 
original reference.  If the file you want to run is in your django app 
directory you just need

import datetime, sys, os, logging
os.environ['DJANGO_SETTINGS_MODULE'] = 
'YourDirectoryThatContainsTheSettingsModule.settings'

If it's running elsewhere you'll need to do more with path manipulation, but I 
did not pursue that.  

I also created an option for >python manage.py myoption   but I had to copy 
that into django.core to get it to work due to my lack of knowledge and I got 
the above working before putting more effort into alternatives.




-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Mike Ramirez
Sent: Friday, March 25, 2011 9:23 PM
To: django-users@googlegroups.com
Subject: Re: How to run a file.py in the django environement

On Friday, March 25, 2011 06:06:39 pm José António Silva wrote:

> Is there any command like
> python manage.py shell filename.py (I know this particular command
> isn't allowed, but is there any other?)
> 
> thanks,
> JA

how about turning filename.py into a django command?

http://docs.djangoproject.com/en/dev/howto/custom-management-commands/


Mike
-- 
Paranoid Club meeting this Friday.  Now ... just try to find out where!

-- 
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: Rewriting Java UI for Django?

2011-03-25 Thread Sells, Fred
I also have made the conversion from Java/Swing/Webapp(jnlp) to Django,
but I used Flex (a.k.a. Flash)  for my UI because I've got a rich client
background and did not want to deal with Browser inconsistencies.  I'm
happy with that choice.  I use a very simple django template to render a
very consistent XML which Flex accepts.  This allowed me to initially
develop my UI using XML text files which allowed me to show results very
quickly.

 

You can get a free 60 day developer license from Adobe, which should be
enough to complete most of the task and then get management to buy a
licensee (~$500 depending on ???)  Adobe used to sell a very pricey
backend which you don't need with django.

 

If you decide to go this route, I can help you with the initial startup
issues.   If so, post back here with Flex + Django as the subject.  If
it gets too involved we can move off the django list, but others might
be interested.

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of David Kovar
Sent: Thursday, March 24, 2011 12:56 PM
To: django-users@googlegroups.com
Subject: Re: Rewriting Java UI for Django?

 

Patrick,

 

Thank you for the insight. Thankfully, I'm trying to port rather than
wrap so while I've got a learning curve ahead of me, it isn't a horrible
one.

 

-David

 

On Mar 24, 2011, at 11:40 AM, Patrick McDonnell wrote:





David - I'm not sure I follow exactly what you're asking.

 

If you're trying to basically port a Java/Swing application to Django:
Django is a web application framework.  Python with the Django libraries
are used on the back end, and HTML is used on the front end (technically
it is possible to use something other than an HTML front end, but that
woud be very unusual).  So, in answer to your question,
HTML/JavaScript/CSS/etc are used to develop your UI.  Django does offer
some utilities to make your job easier (see the docs for forms and
templates), but the majority of the UI design must be done by hand.

 

Also note that Django does automatically generate an admin UI for all of
your database models.  By default, its a pretty simple CRUD interface,
but you can modify it a bit, see the docs.

 

If, however, you're asking how to "wrap" an existing Java/Swing
application inside of Django... That would be much more complicated, and
probably not a very good idea.

 

HTH


 

On Thu, Mar 24, 2011 at 10:13 AM, David Kovar  wrote:

Greetings,

I'm fairly experienced with Python for backend, non UI/UX tasks but am
very new to trying to do any UI work other than command lines. This'll
come off as a very newbie question, and it is.

I need to take an existing Java/Swing UI and wrap it inside of Django to
provide authentication, customer support, etc. I've got a pretty good
handle on most of this, except for:

   What is the best Python approach to writing a web UI that
includes dropdown menus, radio buttons, etc?

It may be that Django will do this for me, but I've not figured out how
to do so yet.

Thanks

-David

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



RE: Implementing a ldap db backend

2011-03-22 Thread Sells, Fred
I'm using my own auth and ldap via python-ldap as a query only; others maintain 
it.  My only issue is that of response.  I query all the groups I care about 
and get all their members and keep that in a MySQL db that I refresh every 5 
minutes of an unrelated cron job.

 

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Felipe Prenholato
Sent: Tuesday, March 22, 2011 9:19 AM
To: django-users@googlegroups.com
Subject: Re: Implementing a ldap db backend

 

I have read and tested some more libs.

 

My concern is that:

 

django-ldapdb (http://opensource.bolloretelecom.eu/projects/django-ldapdb/): 
amazing idea, I'm working very well to query users, having some issues to write 
on LDAP but is more probably due server stuff and not django-ldapdb itself. 
Probably django-ldapdb is a good start for a backend, but doesn't have much 
documentation, mostly examples only.

 

django-auth-ldap (doc at http://packages.python.org/django-auth-ldap/, source 
at https://bitbucket.org/psagers/django-auth-ldap): testing now, the docs show 
that it's amazing with all backend and update of users working very well at 
user login. This kind of functionality is required for me.

 

Since ldapdb can search, update and add users as I see in code we just need to 
do some work on lookups and doc, because istartswith as example doesn't works, 
but it is not much trouble I guess. At other side ldapdb lacks a authentication 
backend that can update user data at login and is easy to update django tables 
like auth-ldap does (see documentation). I'll use both for now because my time 
about it is very small but in future I'm ready to join on efforts to merge both 
apps and construct a full ldap backend / ldap orm for django.

 

 


Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://chronosbox.org/blog
Twitter: http://twitter.com/chronossc




2011/3/21 David De La Harpe Golden 

On 03/11/10 07:48, sebastien piquemal wrote:

> I have thought of many solutions to replace ldapdb. I came to
> conclusion than the cleanest, and most useful for the community, would
> be to implement a real db backend for ldap. However, I have been told
> that it is an awfully big task !
>

It would be big...

BTW "pumpkin" is another project that attempts an ORM-like (let's say
ODM) interface.  It's not django integrated, i.e. it's not a ldap-nonrel
backend for the Django ORM, it's a separate Somewhat-Django-ORM-like
ODM.  http://pypi.python.org/pypi/pumpkin/0.1.0

I'd also recommend taking a close look at ldap.schema.models in
python-ldap source itself - it's "half an ODM" in itself, though it
can't save and still doesn't really datatype-map (python-ldap is a thin
layer on top of libldap and returns strings e.g. you get a "FALSE" back
not a python False. Yeargh), it does introspect the schema and handle
some horrible little details of attribute lookup for you.

We also grew something of an ODM for in-house use, sitting on top of
python-ldap, doing a little mapping of datatypes (only just enough for
our needs), allowing saving.  It's unreleased at time of writing and,
um, what happens to it later won't be up to me.  Pumpkin is probably
better anyway.  Our Django ORM integration, such as it is, is by "fake"
surrogate django models in RDBMS.  So again not a /backend/ for the
django ORM - Instead we (ab)use entryUUID and syncrepl entryCSN ldap
operational attributes to keep some almost featureless "LDAPEntry" model
instances in the RDBMS roughly in-sync via polling*.  This allowed
signals to fire etc so a django/celery based system can be somewhat
reactive to directory changes both inside and  outside its control.  But
our ldap directory is and will remain fairly small (thousands to tens of
thousands of entries) having an RDBMS row for every entry in ldap works
out okay, you wouldn't want to do it that way with a giant directory.

(* We toyed with the idea of making a full-blown syncrepl client on top
of python-ldap for something lighter weight than polling, but that's not
a small job either.  And there's some support in openldap for having
/slapd backend to RDBMS/, i.e. swap the problem around, but it's limited
and really only suited for specific setups...)

P.S. ldaptor also exists and is a pure-python lowlevel ldap interface
(unlike python-ldap which is on top of openldap libldap, so fully
bug-compatible with libldap)


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

RE: Django on Windows 7

2011-03-22 Thread Sells, Fred
It's painless.  I'm no sysadmin but I just followed the instructions and
everything worked.  I'm even using python 2.4 due to some outside
issues.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Vladimir
Sent: Tuesday, March 22, 2011 1:08 PM
To: Django users
Subject: Re: Django on Windows 7

I'm a beginner and haven't enough time to test, but I must answer You
I use Django on Windows 7

-- 
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 on EC2

2011-03-22 Thread Sells, Fred
I'm using a redhat enterprise 6 and all these are standard or available
as standard installs.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Eric Chamberlain
Sent: Tuesday, March 22, 2011 12:31 PM
To: django-users@googlegroups.com
Subject: Re: Django on EC2


On Mar 20, 2011, at 2:21 PM, ydjango wrote:

> I need to install a nginx(optional), Linux,  Apache, Django 1.2,
> python2.6 env and Mysql  on EC2 and ESB.
> 
> Can you please point to any recent instructions on how to install on
> amazon 2 and which images to use?
> 
> How has your experience been so far?
> 

We use the Amazon Linux AMI for our web/app servers and Amazon RDS for
our database.

--
Eric Chamberlain, Founder
RF.com - http://RF.com/







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



deploying flex and django

2011-03-21 Thread Sells, Fred
I would appreciate some guidelines on a better way to deploy a
flex/flash frontend with a django backend.

I've got flex and django working nicely using the Flex HTTPService and
XML and the message content.  Probably not as efficient as other methods
but this is an intratnet and performance is not an issue.  This is also
my first django app, and although it's grown to be pretty significant,
it still reflects some newbie mistakes.

I'm deploying on linux and apache and using mod_python (because we've
done that for years and I have not had time to research mod_wsgi).  I'm
more of a programmer than a Unix or Apache administrator but we are a
small shop and you gotta do what you gotta do to make it work.

Some url's have been edited to avoid exposing potentially proprietary
info.

The problem is that I deploy the client and server separately like this:

/var/www/html/myapp/index.html  launches my Flex app
/var/www/django/mysite/app ... contains my django app.

This works fine EXCEPT, I need to hardcode the django url into my Flex
App based on my target deploy something like this.

private static var LOCAL :String =
"http://localhost:/django/mysite/app/;; //I use this with the debug
server
private static var QA:String =
"http://mytestserver.mydomain.org/django/mysite/app/;;
private static var PRODUCTION:String =
"http://myprodserver.mydomain.org/django/mysite/app/;;
private static var DJANGO_URL:String =PRODUCTION;

So I have to edit and rebuild my Flex app for the different
environments.  While that's not much effort I know it's just bad
practice.  I would like the url's from flex/flash to django to be
relative and thus I guess I should deploy my flash from django, I'm just
a bit confused about the "static" and "media" directories.  I am using
django 1.2.4; however I could upgrade to 1.3 if that makes for a cleaner
solution.

FWIW my apache conf file looks like this.


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE app.settings
PythonOption django.root /var/www//django/app
PythonPath "['/var/www/django'] + sys.path"
PythonDebug On


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



user confused with select_related and a one_to_one field

2011-03-16 Thread Sells, Fred
I'm using python 2.4 and django 1.2.4 with MySQL 5.0 FWIW

I have the following models (code deleted to simplify)

class Message(models.Model):
facility= models.CharField(max_length=2, null=True, blank=True)
msgtype = models.CharField(max_length=3)


class Pv(models.Model):
message =  models.OneToOneField(Message, primary_key=True,
db_column='id')
location= models.CharField(max_length=6, null=True,
blank=True)
priorfacility   = models.CharField(max_length=2, null=True,
blank=True)


Now I've discovered that on rare occasions Pv does not exists and thus
referencing it like this

for message in  models.Message.objects.select_related():
new = [message.pv.facility, ... 

throws
django.db.models.base.DoesNotExist: Pv matching query does not exist.
When I encounter a missing PV record.

Is this my improper use of OneToOneField and I should have used
ForeignKeyField ?
Is there a way to see if the PV object exists other than surrounding it
with a try/except clause ?

The times when Pv is missing are rare; would it make more sense to just
create a record with nulls and maintain the 1-to-1 relationship?

-- 
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: using Django from cron

2011-03-16 Thread Sells, Fred
Thanks to all who responded and especially Shawn who said much the same
thing in a way I could grasp.

...

import os

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


>From the docs:
http://docs.djangoproject.com/en/dev/topics/settings/

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



using Django from cron

2011-03-10 Thread Sells, Fred
I'm sure the solution is out there somewhere, but my google search is
giving me too many false positives.

I have a stand along python program that will be run as a cron job and I
don't know how to launch it so it picks up the django settings, etc.

I can run it like this

>python manage.py shell
>>>import mymodule
>>>mymodule.execute()

But I would like to run it like 

>python mymodule.py

I really don't want to set the DJANGO_SETTINGS_MODULE as a system
environment variable since I have other django webapps I debug on this
box, but perhaps I just don't grasp the concept here.  I apologize for
asking something that I'm sure has been covered, I just could not find
it.

I'm currently using django 1.2.4 and Python 2.4 but could upgrade both
if that's the correct solution.

-- 
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: ReportLab and Django - templates? ; FK object has no attribute split

2011-01-07 Thread Sells, Fred
Depending on what you need to do
You could shell down and run FOP from Apache foundation which is xml,
xslt to pdf
Or if you are filling in a form, you can use Adobe LiveCycle to define a
form and use code like below to fill in the form

def getPDFContent(id):
values = getAllValues(id)
code = values['CODE']
completedfdf = getCompletedForm(values)
pdffilename = PDFTemplateMapper.get(code, None)
if pdffilename==None:
raise "No PDF Template defined for %s" % code
pdfpath = os.path.join(ThisDirectory, 'forms')
pdfpath = os.path.join(pdfpath, pdffilename)
pdftk = ["/usr/bin/pdftk" ,'pdftk'][os.name=='nt']
cmd = '%s %s fill_form - output - flatten' % (pdftk, pdfpath)
proc = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE,
shell=True, bufsize=1)
cmdout,cmderr = proc.communicate(completedfdf)
if cmderr != '':
raise cmderr
return cmdout

-Original Message-
From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Jirka Vejrazka
Sent: Thursday, November 18, 2010 4:14 AM
To: django-users@googlegroups.com
Subject: Re: ReportLab and Django - templates? ; FK object has no
attribute split

Hi Victor,

  It really depends on complexity of your PDF. I needed to do
something similar some time ago and used ReportLab addon called "pisa"
and used standard Django template language to define the PDF contents.

  You might want to take a look, it worked well enough for simple PDF
pages.

  Cheers

Jirka

On 18/11/2010, Victor Hooi  wrote:
> Hi,
>
> I'm trying to use ReportLab to produce a PDF output for one of my
> views.
>
> My first question is - at the moment, I'm building up the PDF inside
> my view. Is this really the recommended way of doing it? It's like
> I've got presentation code inside my view (controller). Isn't there a
> cleaner way of doing it, or going from a template to PDF somehow? (I
> know ReportLab offers a commercial package using RML templates,
> however I was hoping for an opensource/free method).
>
> Second question, I have a model with several FK fields. E.g.
>
> class Article(models.Model):
> category = models.ForeignKey(Category)
> subject = models.ForeignKey(Subject)
>
> Both the category and subject classes have fields called "name", and
> __unicode__ methods defined which return name.
>
> I'm trying to refer to these fields in my PDF output. I have a list of
> items in article_list (i.e. queryset):
>
> for item in article_list:
> text = item.category
> category = Paragraph(text, styles['Heading2'])
> story.append(category)
>
> text = '%s' % item.subject
> subject = Paragraph(text, styles['Heading3'])
> story.append(subject)
>
> When I try to run this code, I get:
>
> 'Category' object has no attribute 'split'
>
> and the same error with subject, obviously, once it gets to that bit
> of the code.
>
> Any idea why this might be, or how to fix it? Any help is much
> appreciated.
>
> Cheers,
> Victor
>
> --
> You received this message because you are subscribed to the Google
Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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: an error happened to apache2and wsgi

2011-01-06 Thread Sells, Fred
I've seen similar errors if I left in  print >>sys.stderr  statements,
although that was using mod_python.

 

From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Graham Dumpleton
Sent: Thursday, January 06, 2011 2:23 AM
To: django-users@googlegroups.com
Subject: Re: an error happened to apache2and wsgi

 

Which generally indicates that the HTTP client closed the connection
before all of the response could be written back.

 

There is no traceback because it is occurring after Django has returned
the response and mod_wsgi is trying to write/flush it back to HTTP
client.

 

By rights the 'Exception occurred' message should come before the
IOError line. I haven't looked yet why it isn't. :-(

 

Graham

On Thursday, January 6, 2011 5:48:44 PM UTC+11, CCC wrote:

site has runned based on apache and wsgi for a long time very well,but 
recently happened an error like this: 
[Sun Jan 02 20:41:02 2011] [error] [client ] IOError: failed to write 
data 
[Sun Jan 02 20:41:02 2011] [error] [client ] mod_wsgi (pid=2716): 
Exception occurred processing WSGI script '/usr/local/src/config/ 
mywsgi.wsgi'. 




-- 
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: RE: The Django-CMS 2.1 Release Candidate 1 has been released!

2010-12-26 Thread Sells, Fred
Thanks.

 

From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Jonas Obrist
Sent: Sunday, December 26, 2010 5:29 AM
To: django-users@googlegroups.com
Subject: Re: RE: The Django-CMS 2.1 Release Candidate 1 has been
released!

 

Hi fred

 

There's a lot of sites running it actually, for a list go to
http://www.django-cms.org/sites/, otherwise I can tell you that
companies such as PBS, National Geographic, Vodafone and a lot more use
it. 

 

If by example site you mean a site you can play around on, we plan to
launch a full demo site with our 2.1 final.

 

Jonas

-- 
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: The Django-CMS 2.1 Release Candidate 1 has been released!

2010-12-25 Thread Sells, Fred
Are there any example sites running 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.



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" <fred.se...@adventistcare.org> 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.



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.



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



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.



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



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: 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 <mhall...@gmail.com>

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.



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



  1   2   >