Re: What does an ideal django workflow setup look like?

2010-10-22 Thread Kenneth Gonsalves
On Fri, 2010-10-22 at 08:02 -0700, Ken wrote:
> Basically, please explain it in a way that a layman can follow the
> steps and setup a workflow without pulling his hair out. =P 

my method (I am not a professional programmer):

1. set up my code and create a mercurial repository. Test each change on
my local machine - I use nginx+runserver.

2. once the code is working - push the changes to a repository on the
internet (I use bitbucket)

3. from the repository pull the code to the staging server for the
client to test with real data (usually this data would be taken from the
production server)

4. once the client is happy - pull the code to the production server -
usually apache+wsgi or nginx+fcgi or tornado.

5. for changes in the database tables: run manage.py sqlall and save it
as before.sql. make the changes, again run sqlall and save it as
after.sql. Create a diff between the two and massage that into a script.
Test the script on the development machine and then on the staging
server, finally do it on the production server.

5. Note: settings.py is not put under version control as this holds
sensitive information and paths differ according to the server it is on.
I create a default.settings.py which has the sensitive information
removed. That is kept under version control.
-- 
regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



Re: Fixtures with deferred / auto-generated primary keys?

2010-10-22 Thread Russell Keith-Magee
On Saturday, October 23, 2010, Paul Winkler  wrote:
> Tried it out. Interestingly, natural keys are currently used only for
> foreign key references,
> the dump still contains primary keys.
> Looks like there's a patch for leaving out PK's when natural keys are
> used:
> http://code.djangoproject.com/ticket/13252
> That would get me 100% of the way there.

FYI - this ticket is on my list of thing to look at for 1.3. I can't
make any guarantees about when it will land, but i would like to see
this feature for exactly the use case you have described.

Yours,
Russ Magee %-)

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



Re: Database Setup

2010-10-22 Thread Everett
Thanks everyone for all your help! I found a binary for Python 2.7
Here's a the link: http://www.codegood.com/archives/129
Just in case someone stumbles upon these posts.

On Oct 16, 3:58 pm, Karen Tracey  wrote:
> 2010/10/16 Jonathan Barratt 
>
> > Hope you have visual studio installed! :p
>
> If you do not, or if you do not want to go to the trouble of building
> MySQLdb from source, it is usually possible to find Windows binary packages
> for MySQLdb by searching Google with terms like:
>
> mysqldb windows binaries python 2.7
>
> I have never built MySQLdb from scratch on Windows, I've always used
> pre-built binaries. (Though I have also not yet bothered to find binaries
> for Python 2.7...I have Windows boxes and use them for testing Django but I
> do not actually do any Django development on them, and I have not had time
> lately to do much Windows testing.)
>
> Karen

-- 
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: moving from Postgres to MySQL

2010-10-22 Thread Felipe Prenholato
hm seriously... why not use Django 1.2 and multidb? It is very easy not?

conf two dbs, default is your postgres db, I'll call db2 your mysql db and
you assert that you did a syncdb in both...

so for each model you do:

for item in Model.objects.all(): item.save(using='db2',force_insert=True)

Probably you just need to do it :), isn't beautiful, but similar stuff
worked for me on a project.

Convert a SQL file from mysql <-> postgres, (and inverse) is a little
painfull... but you can do with sed scripts or vim, I really prefer django
multi db  :)

2010/10/22 ringemup 

> Not spectacular, but mysqldump has flags that can increase the chances
> of portability, and one would hope pg_dumpall does too. I figured
> something like that might be worth a try before you write a custom
> migration script.
>
> On Oct 22, 2:58 am, Chris Withers  wrote:
> > On 21/10/2010 15:40, ringemup wrote:
> >
> > > MySQL has a tool (mysqldump) that will output the contents of an
> > > entire database to a SQL file that can then be loaded directly into
> > > another database.  Does Postgres not have anything analogous?
> >
> > Sure, pg_dumpall. Now, what're the chances of the SQL that spits out
> > being parsed correctly by MySQL without complaint? ;-)
> >
> > Chris
> >
> > --
> > Simplistix - Content Management, Batch Processing & Python Consulting
> > -http://www.simplistix.co.uk
>
> --
> 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.
>
>


-- 
Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://chronosbox.org/blog
Twitter: http://twitter.com/chronossc
Use http://1l.to to shrink your urls :)

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



too many options error when launching sqlite3 dbshell

2010-10-22 Thread John Yeukhon Wong
I have django 1.2.3.0 Final

In my setting, I have 'sqlite3' filled for the DATABASE_ENGINE.
I am able to work with the sqlite3 until I am told that I need to
access python manage.py dbshell

At first I got the error "sqlite3 is not recongized"
Then I read threads and I found that this can be solved by downloading
the exe file and set the environment variable path on Windows (I am on
XP Pro)

 I used this approach instead
http://groups.google.com/group/django-users/msg/cf0665c227030ae2?

Now when I access python manage.py dbshell, I am getting

[[[
C:\Documents and Settings\JohnWong\workspace\mysite\mysite>python
manage.py dbsh
ell
sqlite3: Error: too many options: "Settings\JohnWong\workspace\mysite
\sqlite.db"

Use -help for a list of options.
]]]
I tried with --database=name_of_my_db and still no luck

Any input is 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-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: Global variable during request

2010-10-22 Thread Daniel Roseman
On Oct 22, 5:35 pm, Jop  wrote:
> Hello all,
>
> I've been googeling for a while but haven't been able to find a
> solution for my problem. I will try to describe the problem
>
> I want to be able to set a variable in a view function on the start of
> the request. During the same request i want to use the variables value
> in a manager method.
>
> Originally I thought about using a session because I can import the
> session object anywhere, but I want the value to be reset after the
> request is closed. I also though about trying to define a 'setting'
> during runtime, though this seems to be -not done-.
>
> I have the feeling there must be a real simple solution, but I can't
> seem to figure it out.
>
> Any ideas?
>
> Thanx a lot!
>
> Jop

Use a middleware class to set the attribute on the request object,
then pass that into the manage method from the view when you need to.
--
DR.

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



Re: Global variable during request

2010-10-22 Thread Jop
Thnx, i'll try that :)

On 22 okt, 18:39, Michael  wrote:
> Use middleware to set a threadlocal variable in a global namespace on
> request, and unset it on response.
> --
> Michael 
>
>
>
> On Fri, 2010-10-22 at 09:35 -0700, Jop wrote:
> > Hello all,
>
> > I've been googeling for a while but haven't been able to find a
> > solution for my problem. I will try to describe the problem
>
> > I want to be able to set a variable in a view function on the start of
> > the request. During the same request i want to use the variables value
> > in a manager method.
>
> > Originally I thought about using a session because I can import the
> > session object anywhere, but I want the value to be reset after the
> > request is closed. I also though about trying to define a 'setting'
> > during runtime, though this seems to be -not done-.
>
> > I have the feeling there must be a real simple solution, but I can't
> > seem to figure it out.
>
> > Any ideas?
>
> > Thanx a lot!
>
> > Jop

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



inheriting User class

2010-10-22 Thread Miguel Araujo
Hello everyone,

I'm not very aware about what's the direction Django is taking about the
User model and making it swappable. Meanwhile I would like to ask if
inheriting the User class is advisable or not. As I have read many places
obscure bugs can happen and my code will be in production.

I'm using now an AUTH_PROFILE_MODULE at the moment, but I don't realy like
this approach, as it makes my class hierarchy more complicated.

Thanks, best regards
Miguel Araujo

-- 
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: Fixtures with deferred / auto-generated primary keys?

2010-10-22 Thread Paul Winkler
Tried it out. Interestingly, natural keys are currently used only for
foreign key references,
the dump still contains primary keys.
Looks like there's a patch for leaving out PK's when natural keys are
used:
http://code.djangoproject.com/ticket/13252
That would get me 100% of the way there.

- PW

On Oct 22, 12:38 pm, Paul Winkler  wrote:
> Thanks Shawn! That was quick!
>
> Meanwhile I just discoveredhttp://farmdev.com/projects/fixturewhich
> I have just confirmed works fine for hand-written fixtures with my
> app, although using python classes as fixtures feels a little odd.
> Nice that it's cross-platform though, it supports sqlalchemy and
> sqlobject and appengine as well as django.
>
> It looks like using Django 1.2's built-in natural keys support will be
> a lot less work in many situations, since Fixture doesn't (yet) have
> support for dumping existing Django data to a file.
> Going to try natural keys!
>
> - PW
>
> On Oct 22, 11:56 am, Shawn Milochik  wrote:
>
> > And like magic, it's there!
>
> >http://docs.djangoproject.com/en/dev/topics/serialization/#natural-keys
>
>

-- 
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: What does an ideal django workflow setup look like?

2010-10-22 Thread Brian Bouterse
There are whole books devoted to this topic, which is more of an industry
best practices question than a django question.  Personally I like
this 
bookon
continuous integration.  If not that one try googling for "continuous
integration"

Brian

On Fri, Oct 22, 2010 at 11:02 AM, Ken  wrote:

> *I've Googled, but have not found any really organized and layman-
> friendly overview, which is why I came here*
>
> I know how to get python/django working on my computer (PC or Mac) and
> have developed simple test apps using django's built-in dev server and
> a mysql back-end. So I can get things to work and don't need help on
> installing stuff.
>
> But as a coding hobbyist, I don't know how to set up a pro workflow. I
> don't know best practices on how to setup and maintain a dev and
> production environment, how to efficiently publish to production, how
> to integrate all that into a version control system (i.e., git),
> basically anything that a pro coder at a startup would take for
> granted as "the way to do things".
>
> I understand there are many different ways and products to use to
> setup a great workflow for developing in django, but would like to
> hear how you or your startup team (or corporate dev group) does it.
> Specifics would be amazing, as I need a little hand holding, i.e.
> please cover anything and everything that I should know in order to
> develop efficiently, robustly, and eventually collaboratively.
>
> Basically, please explain it in a way that a layman can follow the
> steps and setup a workflow without pulling his hair out. =P
>
> --
> 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.
>
>


-- 
Brian Bouterse
ITng Services

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



[solved] Re: Can't uninstall debug toolbar?

2010-10-22 Thread ringemup

Never mind, restarting Apache did the trick, although I have no clue
why that was necessary.

On Oct 22, 1:01 pm, ringemup  wrote:
> For some reason, even though I've removed it from my INSTALLED_APPS
> and MIDDLEWARE_CLASSES, and touched my wsgi file, the debug toolbar
> just won't go away.  I'm sure I'm doing something remarkably stupid,
> but at this point can't fathom what that might be.  Any ideas?
>
> Thanks!

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



Can't uninstall debug toolbar?

2010-10-22 Thread ringemup
For some reason, even though I've removed it from my INSTALLED_APPS
and MIDDLEWARE_CLASSES, and touched my wsgi file, the debug toolbar
just won't go away.  I'm sure I'm doing something remarkably stupid,
but at this point can't fathom what that might be.  Any ideas?

Thanks!

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



Re: Global variable during request

2010-10-22 Thread Michael
Use middleware to set a threadlocal variable in a global namespace on
request, and unset it on response.
-- 
Michael 

On Fri, 2010-10-22 at 09:35 -0700, Jop wrote:
> Hello all,
> 
> I've been googeling for a while but haven't been able to find a
> solution for my problem. I will try to describe the problem
> 
> I want to be able to set a variable in a view function on the start of
> the request. During the same request i want to use the variables value
> in a manager method.
> 
> Originally I thought about using a session because I can import the
> session object anywhere, but I want the value to be reset after the
> request is closed. I also though about trying to define a 'setting'
> during runtime, though this seems to be -not done-.
> 
> I have the feeling there must be a real simple solution, but I can't
> seem to figure it out.
> 
> Any ideas?
> 
> Thanx a lot!
> 
> Jop
> 

-- 
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: Fixtures with deferred / auto-generated primary keys?

2010-10-22 Thread Paul Winkler
Thanks Shawn! That was quick!

Meanwhile I just discovered http://farmdev.com/projects/fixture which
I have just confirmed works fine for hand-written fixtures with my
app, although using python classes as fixtures feels a little odd.
Nice that it's cross-platform though, it supports sqlalchemy and
sqlobject and appengine as well as django.

It looks like using Django 1.2's built-in natural keys support will be
a lot less work in many situations, since Fixture doesn't (yet) have
support for dumping existing Django data to a file.
Going to try natural keys!

- PW

On Oct 22, 11:56 am, Shawn Milochik  wrote:
> And like magic, it's there!
>
> http://docs.djangoproject.com/en/dev/topics/serialization/#natural-keys

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



Global variable during request

2010-10-22 Thread Jop
Hello all,

I've been googeling for a while but haven't been able to find a
solution for my problem. I will try to describe the problem

I want to be able to set a variable in a view function on the start of
the request. During the same request i want to use the variables value
in a manager method.

Originally I thought about using a session because I can import the
session object anywhere, but I want the value to be reset after the
request is closed. I also though about trying to define a 'setting'
during runtime, though this seems to be -not done-.

I have the feeling there must be a real simple solution, but I can't
seem to figure it out.

Any ideas?

Thanx a lot!

Jop

-- 
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: What does an ideal django workflow setup look like?

2010-10-22 Thread Phil Gyford
After reading a few articles on this kind of thing, I tried to figure
out a good, repeatable way to do some of this, and wrote up the whole
process here: 
http://www.gyford.com/phil/writing/2010/09/29/django-environment.php

It doesn't (yet) cover the best ways of integrating dev/production
servers. I'm only really getting started myself, so would welcome any
further suggestions for improvement.

Phil


On Fri, Oct 22, 2010 at 4:02 PM, Ken  wrote:
> *I've Googled, but have not found any really organized and layman-
> friendly overview, which is why I came here*
>
> I know how to get python/django working on my computer (PC or Mac) and
> have developed simple test apps using django's built-in dev server and
> a mysql back-end. So I can get things to work and don't need help on
> installing stuff.
>
> But as a coding hobbyist, I don't know how to set up a pro workflow. I
> don't know best practices on how to setup and maintain a dev and
> production environment, how to efficiently publish to production, how
> to integrate all that into a version control system (i.e., git),
> basically anything that a pro coder at a startup would take for
> granted as "the way to do things".
>
> I understand there are many different ways and products to use to
> setup a great workflow for developing in django, but would like to
> hear how you or your startup team (or corporate dev group) does it.
> Specifics would be amazing, as I need a little hand holding, i.e.
> please cover anything and everything that I should know in order to
> develop efficiently, robustly, and eventually collaboratively.
>
> Basically, please explain it in a way that a layman can follow the
> steps and setup a workflow without pulling his hair out. =P
>
> --
> 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.
>
>



-- 
http://www.gyford.com/

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



Re: Fixtures with deferred / auto-generated primary keys?

2010-10-22 Thread Shawn Milochik
And like magic, it's there!

http://docs.djangoproject.com/en/dev/topics/serialization/#natural-keys

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



Fixtures with deferred / auto-generated primary keys?

2010-10-22 Thread Paul Winkler
It would sometimes be useful to be able to write fixtures that
essentially say "I don't care what the PK of this record is, as long
as I have a way for other records in this fixture to refer to it."

Use case: I'd like a way to pass around useful data sets that people
can load into deployments of my app.  A user could choose to load any
of these in any combination, possibly combined with data created by
any other means, eg. the admin UI.   But this means there's no safe
way to know what the PKs should be - unless we use UUIDs for ids,
which I'd really rather not do (uuid.uuid4().int is too big to fit
into an integer id;  changing all my apps to use varchar IDs would be
a huge pain, and I assume would be less efficient.)

(Another possible wrinkle is that each fixture file should not refer
to records not contained in that fixture; I think that could
reasonably fall into the category of "just don't do that". Not sure.)

I found an old discussion which suggests a possible solution to
explore, inspired by Rails:
http://groups.google.com/group/django-users/browse_frm/thread/5fb1d260f69a2a9f/e047e049d366b3c1?lnk=gst=loaddata+primary#e047e049d366b3c1
...  but the thread quickly degenerated and fizzled, so I'm guessing
nothing ever came of this.
Anybody know otherwise?

The Rails approach looks pretty sensible to me - essentially it just
means supporting a variation of the fixture format, which I would
think could be easily detect at load time:
http://api.rubyonrails.org/classes/Fixtures.html

Ideally there'd be a dumpdata option to write out PK-less fixtures,
but that could come later - I think just supporting this feature in
loaddata for hand-written fixtures would be useful as a first step.

I have no idea yet how easy it would be to write this, just wondering
at this stage if anybody had already written something to solve this
problem  :)

- PW

-- 
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: What does an ideal django workflow setup look like?

2010-10-22 Thread Max Countryman
There was a great article on HN regarding project structure although now I 
can't seem to find it. Perhaps someone has it bookmarked?

On Oct 22, 2010, at 11:02, Ken  wrote:

> *I've Googled, but have not found any really organized and layman-
> friendly overview, which is why I came here*
> 
> I know how to get python/django working on my computer (PC or Mac) and
> have developed simple test apps using django's built-in dev server and
> a mysql back-end. So I can get things to work and don't need help on
> installing stuff.
> 
> But as a coding hobbyist, I don't know how to set up a pro workflow. I
> don't know best practices on how to setup and maintain a dev and
> production environment, how to efficiently publish to production, how
> to integrate all that into a version control system (i.e., git),
> basically anything that a pro coder at a startup would take for
> granted as "the way to do things".
> 
> I understand there are many different ways and products to use to
> setup a great workflow for developing in django, but would like to
> hear how you or your startup team (or corporate dev group) does it.
> Specifics would be amazing, as I need a little hand holding, i.e.
> please cover anything and everything that I should know in order to
> develop efficiently, robustly, and eventually collaboratively.
> 
> Basically, please explain it in a way that a layman can follow the
> steps and setup a workflow without pulling his hair out. =P
> 
> -- 
> 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.



What does an ideal django workflow setup look like?

2010-10-22 Thread Ken
*I've Googled, but have not found any really organized and layman-
friendly overview, which is why I came here*

I know how to get python/django working on my computer (PC or Mac) and
have developed simple test apps using django's built-in dev server and
a mysql back-end. So I can get things to work and don't need help on
installing stuff.

But as a coding hobbyist, I don't know how to set up a pro workflow. I
don't know best practices on how to setup and maintain a dev and
production environment, how to efficiently publish to production, how
to integrate all that into a version control system (i.e., git),
basically anything that a pro coder at a startup would take for
granted as "the way to do things".

I understand there are many different ways and products to use to
setup a great workflow for developing in django, but would like to
hear how you or your startup team (or corporate dev group) does it.
Specifics would be amazing, as I need a little hand holding, i.e.
please cover anything and everything that I should know in order to
develop efficiently, robustly, and eventually collaboratively.

Basically, please explain it in a way that a layman can follow the
steps and setup a workflow without pulling his hair out. =P

-- 
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: moving from Postgres to MySQL

2010-10-22 Thread ringemup
Not spectacular, but mysqldump has flags that can increase the chances
of portability, and one would hope pg_dumpall does too. I figured
something like that might be worth a try before you write a custom
migration script.

On Oct 22, 2:58 am, Chris Withers  wrote:
> On 21/10/2010 15:40, ringemup wrote:
>
> > MySQL has a tool (mysqldump) that will output the contents of an
> > entire database to a SQL file that can then be loaded directly into
> > another database.  Does Postgres not have anything analogous?
>
> Sure, pg_dumpall. Now, what're the chances of the SQL that spits out
> being parsed correctly by MySQL without complaint? ;-)
>
> Chris
>
> --
> Simplistix - Content Management, Batch Processing & Python Consulting
>             -http://www.simplistix.co.uk

-- 
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: AutoField field that increments with regards to a foreign key?

2010-10-22 Thread derek
Have a look at this thread:

http://groups.google.com/group/django-users/browse_thread/thread/deda522d2545325e/bbaa8edbeda204e3?lnk=gst=production+number#bbaa8edbeda204e3

The author has a similar problem i.e. he says:

"There is a high risk of concurrency so just finding the previous max
and then do a +1 before saving is not what I want. "

On Oct 21, 11:54 pm, orokusaki  wrote:
> Correction: I meant for the third ticket to have pk: 3.
>
> On Oct 21, 3:18 pm, Yo-Yo Ma  wrote:
>
> > Example:
>
> > Company has many Tickets
> > Tickets have a PK, as well as a "number".
> > Each Ticket's "number" should be the highest prior "number" for a
> > Ticket with the same Company
>
> > Ticket: pk: 1, number: 1, company: XYZ
> > Ticket: pk: 2, number: 1, company: Acme
> > Ticket: pk: 1, number: 2, company: XYZ
>
> > unique_together=(("number", "company"),)  # number is not unique
> > itself.
>
> > How should I handle this non-sense?
>
> > Confusing, convoluted, in-depth (sort of) explanation:
>
> > I have a model that sets the value of one of it's fields in the save()
> > method. It does this by reading the value of another field, and using
> > that value to calculate the value based on how many instances there
> > are with the same value in the other field (Basically an auto field
> > that increments with regards to a foreign key). The field that save()
> > sets is a unique field. This means that if 2 people on other sides of
> > the globe hit "submit" at the same time, the number of instances with
> > "other field"s value will be the same (e.g. 500). Then save() will
> > make self.number = 501, causing an IntegrityError for which ever one
> > takes longer to finish. How can I get around this? Or, better yet: How
> > should I do this instead?
>
> > Thanks in advance.

-- 
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-autocomplete - styling?

2010-10-22 Thread derek
OK - managed to fix this myself...

In the inline_searchinput.html file,  add a line after the section of
code that starts:

  $('#lookup_{{ name }}').autocomplete('{{ search_path }}', {
  extraParams: {
  'search_fields': '{{ search_fields }}',
  'app_label': '{{ app_label }}',
  'model_name': '{{ model_name }}'
  },

with:
  inputClass: "vForeignKeyTextAdminField",

You can use any name, of course - but the same name should be used in
your .css file. I found that a styling of width:85% gave a suitably
large display for showing a long text entry...

Derek

On Oct 21, 4:06 pm, Derek  wrote:
> A quick question for anyone using the django-autocomplete ... where/how do I
> style the display box used for displaying the "static" text?
>
> Thanks!
> Derek

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



django-filter as part of Django Admin?

2010-10-22 Thread Derek
For  anyone who is using django-filter -
http://github.com/alex/django-filter/ - do you know if it is possible to
either:

(a) use it directly as part of Django Admin, or

(b) replicate its functionality Django Admin (and, if so, how?? because the
existing "sidebar" filters are not dynamic)

Thanks
Derek

-- 
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: dump sqlite to file when testing

2010-10-22 Thread Phlip


On Oct 21, 10:54 pm, Russell Keith-Magee 
wrote:
> On Fri, Oct 22, 2010 at 12:37 PM, Phlip  wrote:
> > I just tried it:
>
> > DATABASES = {
> >    'default': {
> >        'ENGINE': 'django.db.backends.sqlite3',
> > #  TODO restore        'NAME': ':memory:',
> >        'NAME': '/home/phlip/fun.db',
> >        'USER': '',
> >        'PASSWORD': '',
> >        'HOST': '',
> >        'PORT': '',
> >    }
> > }
>
> > Yes that's in my test_settings, yes I'm using "python manage.py test --
> > settings=test_settings", and no I can't find that in the home folder.
>
> > If I create models in a setUp(), and if the tests use transactions
> > around each case, doesn't that mean the transaction would roll the
> > objects back to nothing, providing test isolation, but at least the
> > file itself would stick around? Or is :memory: somehow defaulted in,
> > there?
>
> As I said in my last email, the relevant setting is TEST_NAME. NAME is
> your normal database name. TEST_NAME is the name of the database
> during testing.

Ouch tx I'm still in Django 1.2.

> Yes, it defaults to ':memory:' for SQLite. And yes, the test database
> will be rolled back (if you're using a django.test.TestCase. However,
> if you're not using a django.test.TestCase, or you break out of the
> test (e.g.,using sys.exit()), the database will exist on disk.

I won't try exit() because I thought that throws an exiting exception
that even the TestCase can catch.

>
> Yours,
> Russ Magee %-)

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



Pg pool II configuration in Django

2010-10-22 Thread yabins...@yahoo.co.in
Hai friends,
 I am trying to implement pg pool II in my django
application .Followings are configuration parameter i used in the
settings.py file

DATABASE_ENGINE = 'postgresql_psycopg2'   #
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'test' # Or path to database file if using
sqlite3.
DATABASE_USER = testuser' # Not used with sqlite3.
DATABASE_PASSWORD = 'test' # Not used with sqlite3.
DATABASE_HOST = 'localhost' # Set to empty string for
localhost. Not used with sqlite3.
DATABASE_PORT = '5433' # Set to empty string for default.
Not used with sqlite3.

when i try the database using the command
python manage.py dbshell  two idle process are come in my process
list

postgres 11508  0.0  0.0   7452   616 ?S17:15   0:00
pgpool: testuser test 127.0.0.1(50047) idle
postgres 11509  0.0  0.2  42712  2076 ?Ss   17:15   0:00
postgres:testuser test 127.0.0.125(50593) idle

 but when i am trying through my djnago  application it is comming
like

postgres 11509  0.0  0.2  42712  2076 ?Ss   17:15   0:00
postgres:testuser test 127.0.0.125(50593) idle

and the same time  all the pgpool connections are waiting for the new
connection.

How i can solve this issue.Hope i will get the support from here

Thanks in advance


Regards

Binsun N T

-- 
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: Cross Domain POST Request

2010-10-22 Thread Masklinn
On 2010-10-22, at 11:53 , Viet Nguyen wrote:
> Hi there, I am quite new to Django and encounters a problem which
> takes me a lot of time to figure out. As I known, Django provides some
> functionality to prevent cross domain AJAX requests.
Last time I checked, Django didn't integrate any ajaxy facilities and let 
developers do whatever they wanted on that front. In fact, Django would be 
quite unable to manage cross-domain xhr requests considering that's a feature 
of JS clients aka your web browser.

> However, using
> jQuery you can specify a callback (JSONP) and could talk and get data
> back from the server. For example:
> 
> $.getJSON('http://127.0.0.1:8000/biotool/prepDownload/login/?user=' +
> uName + '=' + pWord + '=?',
>   function (data) {
>   if (data != null) {
>   Load.displayPackages(data);
>   window.location = "#_sepa";
>   }
>   else {//request failed
>   var element = 
> document.getElementById("loginError");
>   element.innerHTML = "Could not authenticate 
> with server";
>   }
>   });
Please note that you're not doing what you're talking about at all here. jQuery 
provides built-in facilities for jsonp namely the 'jsonp' dataType which can be 
provided as an option to most jQuery ajax calls. But the code above doesn't use 
jsonp, as far as I can tell it uses regular json.

> However, for some cases, when you need to send a large amount of data
> to the server (in JSON format), you may have to use $.post(). This is
> a sample section of code:
> 
>  $.ajax( {
>'url': 'http://127.0.0.1:8000/biotool/
> prepDownload/test/',
>'type': 'POST',
> 'data': {'rowID': '2', 'taxon': 'aaa'},
>'success': function (s) {
> alert (s);
> } });
Again, you're not using jQuery's jsonp facilities here. But in any case, jsonp 
the way it is generally implemented (via 

Cross Domain POST Request

2010-10-22 Thread Viet Nguyen
Hi there, I am quite new to Django and encounters a problem which
takes me a lot of time to figure out. As I known, Django provides some
functionality to prevent cross domain AJAX requests. However, using
jQuery you can specify a callback (JSONP) and could talk and get data
back from the server. For example:

 $.getJSON('http://127.0.0.1:8000/biotool/prepDownload/login/?user=' +
uName + '=' + pWord + '=?',
function (data) {
if (data != null) {
Load.displayPackages(data);
window.location = "#_sepa";
}
else {//request failed
var element = 
document.getElementById("loginError");
element.innerHTML = "Could not authenticate 
with server";
}
});
However, for some cases, when you need to send a large amount of data
to the server (in JSON format), you may have to use $.post(). This is
a sample section of code:

  $.ajax( {
'url': 'http://127.0.0.1:8000/biotool/
prepDownload/test/',
'type': 'POST',
 'data': {'rowID': '2', 'taxon': 'aaa'},
'success': function (s) {
 alert (s);
 } });

My views.py:

def test(request):
print request.POST
print request.GET
return HttpResponse('test')
The problem is the request.POST is empty. If I set the 'type' to GET:
the request.GET contains 2 elements which I sent as parameters. I have
searched the web for ages and did not find a solution to this problem.
I can solve the problem using GET, however, the data I sent may be
large and requires some kinds of structure. Please if anybody has
experience on this. There is a user with similar problems:

http://groups.google.com/group/django-users/browse_thread/thread/d01903c1a85f79ed/8573e61b2f8e296d?lnk=gst=external+post+request#8573e61b2f8e296d

I have disabled all CSRF protections just to test this.
P/s: I have a log in page and some other pages using jQuery to
generate cross domain GET requests and they work fine. The problem
only arises when I use POST.

Thanks,
Viet Nguyen

-- 
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: filepath (system file system path) field

2010-10-22 Thread BigBlogMaker
look like this solved the problem
a source in Russian

http://translate.google.ru/translate?js=n=_t=ru=UTF-8=2=1=ru=en=http://blog.vernart.ru/programming/python/django/sobstvennye-filepathfield-dlya-django-spisok-direktorij/


On 23 сен, 01:07, pixelcowboy  wrote:
> That field seems to grab all the files in a given directory according
> to a set filtering. I actually just want to register the actual
> directory names, and possible launch a file picker for the user to
> select it.
>
> On Sep 22, 2:30 am, Nuno Maltez  wrote:
>
>
>
> > On Tue, Sep 21, 2010 at 6:17 PM, pixelcowboy  
> > wrote:
> > > Hi, I have seen this asked before here (without answers), but I wanted
> > > to know how to go on about creating a field that stores filepath names
> > > from the client filesystem, so I wanted to check if someone could
> > > recommend the best apporach: Creating a custom field perhaps? Or
> > > perhaps extending the filefield? Or maybe just use a charfiled and do
> > > it all in validation? What do you guys think?
>
> > Hmmm something like 
> > this?http://docs.djangoproject.com/en/dev/ref/models/fields/#filepathfield
>
> > Nuno

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



Customize behavior of admin inlines

2010-10-22 Thread Bojan Mihelac
I would like to customize behavior of admin inlines interface so when
the editor edit a parent model he is offered with all possible
variations of child objects.

Here is simplified use case:

class Shirt(models.Model):
name = models.CharField(max_length=80)

class Color(models.Model):
name = models.CharField(max_length=80)

class ShirtColorPrice(models.Model):
shirt = models.ForeignKey(Shirt)
color = models.ForeignKey(Color)
price = models.DecimalField(max_digits=9, decimal_places=2)

Since there is an limited number of colors, it would be desired that
when editing an Shirt object, editor have all ShirtColorPrice objects
listed as inlines prepopulated with existing colors where he would
write price only for colors that the shirt is available in. When
saving parent object all ShirtColorPrice inlines without price would
be deleted if they existed or not saved at all.

I found this entry (http://stackoverflow.com/questions/442040/pre-
populate-an-inline-formset) which is analogous to my own use case.
Also, I tried to overide and customize InlineModelAdmin interface, but
found that it would take lot of duplication of existing
django.contrib.admin code to get this working inside ModelForm.

One of the possible ways to take is to write admin action that would
handle this case in new page. Before going this way I would like to
know if anyone had similiar needs and what path you choose. Maybe
someone already solved this in open source project or have better
solution for similiar cases?

best,
Bojan

-- 
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: moving from Postgres to MySQL

2010-10-22 Thread Kenneth Gonsalves
On Fri, 2010-10-22 at 07:58 +0100, Chris Withers wrote:
> On 21/10/2010 15:40, ringemup wrote:
> > MySQL has a tool (mysqldump) that will output the contents of an
> > entire database to a SQL file that can then be loaded directly into
> > another database.  Does Postgres not have anything analogous?
> 
> Sure, pg_dumpall. Now, what're the chances of the SQL that spits out 
> being parsed correctly by MySQL without complaint? ;-) 

practically zero
-- 
regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



Re: moving from Postgres to MySQL

2010-10-22 Thread Chris Withers

On 21/10/2010 15:40, ringemup wrote:

MySQL has a tool (mysqldump) that will output the contents of an
entire database to a SQL file that can then be loaded directly into
another database.  Does Postgres not have anything analogous?


Sure, pg_dumpall. Now, what're the chances of the SQL that spits out 
being parsed correctly by MySQL without complaint? ;-)


Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk

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