Re: asynchronous operations

2008-07-07 Thread Joseph Heck

Look into using a queue system of some form. Django-queue-service
(http://django-queue-service.googlecode.com/) was developed to enable
this but there's similiar mechanisms in use through many sites. Either
developed internally, or using heavier-duty queuing mechanisms.

-joe

On Mon, Jul 7, 2008 at 12:02 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Certain events require another operation to run. But it doesn't need
> to happen immediately.
>
> I'm curious what people use for message passing / job queuing.
>
> Right now, I run cronjobs that run routine background processes, but
> also some operations which should really be event driving.
>
> I was thinking that a piece of middleware could record a call to make
> (and objects / parameters to pass) AFTER the view returned. This way,
> you wouldn't need to schedule another process, and the job could
> benefit from the full context.
>
> Can anyone scope this task for me? How hard would it be to make such a
> middleware module? Where is a good place to start in writing a
> middleware module?
>
> Thanks,
> Ivan
> tipjoy.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Change the model name

2008-05-31 Thread Joseph Heck

If you're talking about changing the display name in the
administrative interface, there is the option of setting "verbose
name" - see http://www.djangoproject.com/documentation/model-api/#table-names
for more information. You can also change the database table name
associated with the model object if you feel you must. More details
are in that same documentation page.

-joe

On Sat, May 31, 2008 at 11:45 AM, Kless <[EMAIL PROTECTED]> wrote:
> Is possible to change the model name?
>
> From a class as *class FooBar*
> it's got a model called *foobar*,
> but I would to get a model called 'foo_bar', without change the class
> name to 'Foo_Bar'.
>
> >
>

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



Re: Display only some tables

2008-05-31 Thread Joseph Heck

Hey Kless,

I think you need to be a bit clearer on your question. What are you
trying to accomplish?

On Sat, May 31, 2008 at 11:47 AM, Kless <[EMAIL PROTECTED]> wrote:
>
> How to show only any tables to any users -as to the visitors-?
> >
>

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



Re: Django on MOSSO?

2008-05-06 Thread Joseph Heck

what's MOSSO?

On Tue, May 6, 2008 at 12:01 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>  Has anyone got it to work? Maybe with a hack or two?
>  >
>

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



Re: Best practices sending out http requests from within django code

2008-04-18 Thread Joseph Heck

I've been using urllib2 very effectively - do be careful with it
though - assuming you're planning on using it in view code - the time
it spends waiting for something is the time that your user spends
waiting.

-joe

On Thu, Apr 17, 2008 at 4:31 PM, Russell Keith-Magee
<[EMAIL PROTECTED]> wrote:
>
>  On Fri, Apr 18, 2008 at 12:51 AM, Dan-Cristian Bogos
>  <[EMAIL PROTECTED]> wrote:
>  > Folks,
>  >
>  > I was wondering what is the best way to send out http requests from within
>  > django. Shall I use an external library (like urllib) or use some django
>  > internals?
>  > Eg: I want to POST some info on some other django site.
>
>  Django is a framework for a HTTP server; it has almost no built-in
>  client capabilities. You will need to use urllib or something similar.
>
>  Yours,
>  Russ Magee %-)
>
>
>
>  >
>

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



Re: How to do background processing with Django

2008-03-26 Thread Joseph Heck

You can certainly hide this additional complexity with your
application either using Django as a pass through or configuring up
something with a reverse proxy in Apache or such. There's no reason
that I can think of that the complexity of maintaining a queueing
system for asynchronous processing would need to be passed outward to
a user.

If you want to give the user feedback on what's happening, you might
consider maintaining a state message like "in progress" or such within
Django that can be polled via an Ajax call or the like.

-joe

On Wed, Mar 26, 2008 at 9:07 AM, shabda <[EMAIL PROTECTED]> wrote:
>
>  Not the end user but the people who would be downloading this
>  application, and want to use this, in a shared hosting environment.
>
>
>  On Mar 26, 7:39 pm, "Ian Lawrence" <[EMAIL PROTECTED]> wrote:
>  > Hi
>  >
>  > >  are django and apache. Adding a HTTP server or configuring django-
>  > >  queuing is too painful for the average user. :(
>  >
>  > what does the end user have to do with this?
>  > you have a server by doing
>  > wgethttp://svn.cherrypy.org/trunk/cherrypy/wsgiserver/__init__.py-O
>  > wsgiserver.py
>  > and setting up xml-rpc is not much more than this...i did this recently 
> athttps://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/GPS...
>
>
> > and it is pretty simple to do (and really the best way IMO to run
>  > background processes)
>  >
>  > Ian
>  >
>  > --http://ianlawrence.info
>  >
>

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



Re: help

2008-03-26 Thread Joseph Heck

The docs at http://www.djangoproject.com/documentation/i18n/ really do
outline what you need to do. make-messages.py can take a little
tweaking to work properly under Win32 (i.e. instead of invoking
./make-messages.py you invoke python make-messages.py), but it all
works quite smoothly.

-joe

On Wed, Mar 26, 2008 at 3:43 AM, ha bo <[EMAIL PROTECTED]> wrote:
> hi
> i need your help,two weeks a go , im in the same probleme with my django
> application,i need my application in 2 languages.the user have to choose his
> favorite language any time he accede to application,the local middelware the
> project take the language of exploitation system.
> i did read to documentation section 3:how django,but dosnt work.
> and also i didnt know how to create message file (.po),i use windows.
> please its urgent
> 
> Appelez vos amis de PC à PC -- C'EST GRATUIT Téléchargez Messenger, c'est
> gratuit !
>  >
>

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



Re: How often do you update your django?

2008-03-25 Thread Joseph Heck

Justin does have a very valid point here - there's a LOT of
functionality that isn't in the 0.96.1 release, and there's no word on
when a next release will be coming. Just make sure you keep up with
changes in the trunk when the developers get into making backwards
incompatible updates.

-joe

On Tue, Mar 25, 2008 at 10:40 AM, Justin Lilly <[EMAIL PROTECTED]> wrote:
> I would suggest the exact opposite, really. I found it much harder in terms
> of documentation / help with .96 than trunk. Besides, hearing "Oh. You're on
> .96? You don't have that feature." can get a bit tiresome.
>
> In terms of updating, its (for me) as easy as going to the directory and
> running git-svn fetch (or most probably in your case:  svn up ).
>
>  -justin
>
>
> On Tue, Mar 25, 2008 at 1:26 PM, Joseph Heck <[EMAIL PROTECTED]> wrote:
>
> >
> > It's more than a file - it's more like a directory :-)
> >
> > If you're new to django, you might find it a lot easier to start with
> > the release version. The trunk has been reasonably stable lately, but
> > there's no promise that it will remain so - and you might find
> > yourself in a bind if you loose track of the trunk for a while and
> > don't keep up with changes. They can be backward incompatible.
> >
> > -joe
> >
> >
> >
> >
> > On Tue, Mar 25, 2008 at 10:23 AM, jmDesktop <[EMAIL PROTECTED]>
> wrote:
> > >
> > >  Do you just copy over the old file and restart your server?
> > >
> > >
> > >  On Mar 25, 12:58 pm, "Justin Lilly" <[EMAIL PROTECTED]> wrote:
> > >  > I update it every time I'm reminded of it (I just updated), at the
> end of a
> > >  > sprint or when I get errors (in hopes it was a bug that was fixed).
> > >  >
> > >  >  -justin
> > >  >
> > >
> > > > On Tue, Mar 25, 2008 at 12:50 PM, jmDesktop <[EMAIL PROTECTED]>
> wrote:
> > >  >
> > >  > > How often do you use svn to get the latest django and update your
> > >  > > implementation?  I'm new to all of this and never have used cvs or
> svn
> > >  > > and am trying to figure out the best way to use it.
> > >  >
> > >  > --
> > >  > Justin Lilly
> > >  > Web Developer/Designerhttp://justinlilly.com
> > >
> > >
> > > >
> > >
> >
> >
> >
>
>
>
> --
> Justin Lilly
> Web Developer/Designer
>
> http://justinlilly.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How often do you update your django?

2008-03-25 Thread Joseph Heck

It's more than a file - it's more like a directory :-)

If you're new to django, you might find it a lot easier to start with
the release version. The trunk has been reasonably stable lately, but
there's no promise that it will remain so - and you might find
yourself in a bind if you loose track of the trunk for a while and
don't keep up with changes. They can be backward incompatible.

-joe

On Tue, Mar 25, 2008 at 10:23 AM, jmDesktop <[EMAIL PROTECTED]> wrote:
>
>  Do you just copy over the old file and restart your server?
>
>
>  On Mar 25, 12:58 pm, "Justin Lilly" <[EMAIL PROTECTED]> wrote:
>  > I update it every time I'm reminded of it (I just updated), at the end of a
>  > sprint or when I get errors (in hopes it was a bug that was fixed).
>  >
>  >  -justin
>  >
>
> > On Tue, Mar 25, 2008 at 12:50 PM, jmDesktop <[EMAIL PROTECTED]> wrote:
>  >
>  > > How often do you use svn to get the latest django and update your
>  > > implementation?  I'm new to all of this and never have used cvs or svn
>  > > and am trying to figure out the best way to use it.
>  >
>  > --
>  > Justin Lilly
>  > Web Developer/Designerhttp://justinlilly.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: unit testing Q

2008-03-25 Thread Joseph Heck

Absolutely - the "making a seperate DB" is all wrapped in
"django-admin.py test" or "./manage.py test" - which does a number of
things for you. You don't have to use that at all - and just running
standard python unit tests will work against your system. You'll need
to set up your environment to use the right "django" bits - the same
as you would from using any other general python script external to
the webserver, but it works just fine.

-joe

On Tue, Mar 25, 2008 at 7:44 AM, Jeff Gentry <[EMAIL PROTECTED]> wrote:
>  As a relative newcomer to Django, I recently starting looking at how best
>  to implement unit tests for my app.  I came across this page:
>  http://www.djangoproject.com/documentation/testing/
>  as well as a couple of other examples online.
>
>  If I'm understanding things correctly, the unit testing framework creates
>  a temporary DB separate from the main DB for the purpose of running the
>  tests, which is then removed afterwards.  For my situation, that falls
>  somewhere between impractical and impossible - OTOH, I do all of my
>  development using a sandbox DB which I very much would not mind if the
>  unit tests worked against.
>
>  Is it possible (and if so, how?) to point the unit tests at my sandbox DB?

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



Re: Showing day in html but cannot check the day on django

2008-03-25 Thread Joseph Heck

Python has a number of good date/time packages that you can use to do
this... why don't you look into one of those.

-joe

On Tue, Mar 25, 2008 at 12:53 AM, soe <[EMAIL PROTECTED]> wrote:
>
>  Hi all,
>   I would like to check the current day on the django not on html, mean
>  today is monday or tuesday. The day can be check on html using
>  datetime format using "l", to show each current day.
>
>  Thanks for helps
>  >
>

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



Re: Django hosting service running Os C

2008-02-20 Thread Joseph Heck

For something as specific as MacOS X based hosting, that's a damn good price.

-joe

On Mon, Feb 18, 2008 at 7:35 AM, Dj Gilcrease <[EMAIL PROTECTED]> wrote:
>
>  On Feb 17, 2008 3:12 PM, Flavio Curella <[EMAIL PROTECTED]> wrote:
>  >
>  > Hi,
>  >
>  > I developed a small application using django and CoreGraphics library
>  > as a school project. I'm wondering to put it online and I googled
>  > around looking for a web hosting solution (shared or VPS) running on
>  > Os X and that supports Django.
>  >
>  > Does anybody know one?
>
>
>  A quick Google search found a few, but most of them were way over
>  priced for what you got (One I saw was $55/month for shared hosting).
>  http://serverlogistics.com/hosting.php seemed like the most reasonably
>  priced one I could find
>
>
>
>  >
>

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



Re: How/where do you add middleware (was: empty PATH_INFO with LiteSpeed / FastCGI)

2008-02-20 Thread Joseph Heck

Austin,

There's an excellent overview of the how's and why's of Middleware at
http://www.djangoproject.com/documentation/middleware/

Fundamentally, you're just specifying a class that you've implemented
somewhere. It can be in a folder or not - that's just matching
python's module structure to the class name that you import.

I'd suggest working with "print" statements in a dev server instance
to get the feel for what's flowing through a middleware class. It
taught me a lot when I was getting started.

On Sun, Feb 17, 2008 at 11:29 AM, Austin Govella
<[EMAIL PROTECTED]> wrote:
>
>  On Jan 22, 9:39 pm, Dan Conner <[EMAIL PROTECTED]> wrote:
>  > well, one way to do this is through a middleware class, like this:
>  > class SetEmptyPathInfo(object):
>  > def process_request(self, request):
>  > if not request.path:
>  > request.META['PATH_INFO'] = '/'
>  > request.path = '/'
>  >
>  > seems to be working for now.
>
>  I'm hitting a similar error where PATH_INFO is empty and I get a
>  TypeError:
>
>  Exception Type: TypeError
>  Exception Value: unpack non-sequence
>
>  I'm trying to add the middleware class mentioned above, but I'm not
>  sure where it goes.
>
>  I created a middleware folder in my project folder and saved the
>  middleware class as SetEmptyPathInfo.py but I keep getting the above
>  error with PATH_INFO set to " ".
>
>  Is that how you add middleware to an app (add a middleware folder to
>  your project)? Is there a middleware tutorial somewhere that explains
>  where you save custom middleware files?
>
>
>
>  --
>  Austin Govella
>
>
>
>  >
>

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



Re: django runserver freeze after 10-15 min

2008-02-16 Thread Joseph Heck

Mark was also the one who got me working it. :-) At OSCON 2007 as well...

On Feb 16, 2008 12:47 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
>
> On Sat, 2008-02-16 at 12:43 -0800, Joseph Heck wrote:
> > The link to Gordon's page is much nicer than the hackery I did some
> > time back, but I thought I'd pipe in with a comment that the
> > WSGIServer from CherryPy works very nicely.
>
> Seconded.
>
> Mark Ramm pointed out to me at OSCON this year how self-contained
> CherryPy's server was (one file in CherryPy 3) and I've been
> experimenting with it a bit now. I'm quite impressed.
>
> Malcolm
>
> --
> If it walks out of your refrigerator, LET IT GO!!
> http://www.pointy-stick.com/blog/
>
>
>
> >
>

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



Re: "Presales" questions

2008-02-16 Thread Joseph Heck

There isn't a visual interface for creating new fields, but don't let
that stop you. It is really very straight forward and well documented.
If you don't own the printed version of the django book, I'd recommend
hitting their web site and reading or at least glancing through
Chapter 5 (http://djangobook.com/en/1.0/chapter05/).

-joe

On Feb 16, 2008 12:37 PM, Phoenix Kiula <[EMAIL PROTECTED]> wrote:
>
> Actually, it seems we skipped past my most important question:
>
> Is it easy to create "custom fields" in Django? For example, is there
> an admin interface where I can create a section of my website, called
> Reviews. Then assign new fields to it -- Name of book, author, ISBN,
> my review title, my review content, amazon URL, rating.
>
> I guess in a framework I could do this using config files and whatnot,
> but I want to know if there's a simple visual admin interface for app
> development.
>
> Thx!
>
>
> >
>

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



Re: django runserver freeze after 10-15 min

2008-02-16 Thread Joseph Heck

The link to Gordon's page is much nicer than the hackery I did some
time back, but I thought I'd pipe in with a comment that the
WSGIServer from CherryPy works very nicely. We've embedded it into our
Django Queue Service project (I yanked the WSGIServer directly -
didn't need the rest:
http://code.google.com/p/django-queue-service/source/browse/trunk/qs/server.py)
and it works exceptionally well as a super-portable "run it anywhere"
application server.

(run it anywhere in my case means Win32, Linux, and MacOS X)

-joe

On Feb 16, 2008 4:31 AM, diadya_vova <[EMAIL PROTECTED]> wrote:
>
> > Have a look at thishttp://www.gordontillman.info/Development/DjangoCherryPy
> Oh! Thank you.
> It's looks like the best choice for me.
>
>
> >
>

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



Re: django-admin.py just doesn't go

2008-02-15 Thread Joseph Heck

Need just a little more information...

First - what platform are you working on? Second, how did you install django?

It might be as simple as needing to set some execute permissions
(linux or Mac), bind .py to a specific program (win), or just have you
invoke "python django-admin.py" to work around either of those.

-joe

On Fri, Feb 15, 2008 at 7:01 PM, doNascimento <[EMAIL PROTECTED]> wrote:
>
>  simply typing django-admin.py doesn't work. Even if I'm the very own
>  place the djago-admin.py is it still doesn't work, I mean, I can't
>  execute ANY python script or file without typing python before it. How
>  can I solve that.
>  Thks.
>  >
>

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



Re: django-queue-service documentation

2008-01-30 Thread Joseph Heck

I'm always willing to take suggestions. We've expanded on the basics
in the "unstable" branch - mostly focusing on adding a pure REST
interface, which Rajesh has done a wonderful job with. It does have
it's own settings when using it standalone - it's a pretty straight-up
Django application that way.

It's not much work to integrate it into your app straight off - like I
said, that's actually where I personally started with the concept. I
just thought it had more value separate :-) It's not super-particular
about the database - just like any other Django application.

-joe

On Jan 30, 2008 3:22 PM, Tane Piper <[EMAIL PROTECTED]> wrote:
> That sounds fantastic - I think we might look at integrating it into
> the application as it's pretty vital (imagine having to wait for a 50
> or 100mb repository to clone!).
>
> If your interested, I'd be happy to provide some code back if we can
> make any improvements.  For example, we're using a forked version of
> django-dbsettings and it would be very handy to put the settings to
> control the application here, stuff like throttling, limits, etc.
>
> Does it have it's own settings file if it's using a SQLLite backend?
> Would it be much work, or even worth it to integrate it into the
> database within our app?  Of course our app supports using SQLLite as
> a DB option (especially good for our app running off a pen drive :)

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



Re: django-queue-service documentation

2008-01-30 Thread Joseph Heck
gt; cloning a repo, after saving, a post_save signal calls mercurial's
> hg.clone function, and the screen waits until this is done, which can
> be a while for larger repos, or one on slower servers.
>
> I'd like to be able, once the user submits the form, validate the save
> information and create the database entry for it then hand off to a
> background process to get the repo, so acts more asynchronously.
>
> Any information would be greatly appreciated.
>
> On Jan 27, 2008 9:14 PM, Joseph Heck <[EMAIL PROTECTED]> wrote:
> >
> > Sorry for the lack of docs - I think we've all been focused elsewhere,
> > and the project is being somewhat quiet right now.
> >
> > Do you want to integrate it into your application directly, or use it
> > as a standalone critter? What kind of information on using it would be
> > most useful to you?
> >
> > I've got some ideas, but since I helped create it they may be well
> > skewed. I know the internals very well - and it all seems somewhat
> > obvious to me, although I know that's not an outside view at all. Your
> > suggestions for what you need would be very welcome and useful!
> >
> > Are you looking for an example of how to write a client and push and
> > pull messages from a queue? How to integrate it into your application
> > and what code to use to to push messages in?
> >
> > -joe
> >
> >
> > On Jan 26, 2008 10:48 PM, shabda <[EMAIL PROTECTED]> wrote:
> > > I want to use django-queue-service to run long running processess in
> > > background, but I can not find any documentation about this. Their
> > > website http://code.google.com/p/django-queue-service/ does not
> > > contain any docs. Does any one have any links, about how to use it?
> > > >
> > >
> >
> > >
> >
>
>
>
> --
> Tane Piper
> Blog - http://digitalspaghetti.me.uk
> Wii: 4734 3486 7149 1830
>
> This email is: [ ] blogable [ x ] ask first [ ] private
>
>
> >
>

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



Re: django-queue-service documentation

2008-01-27 Thread Joseph Heck

Sorry for the lack of docs - I think we've all been focused elsewhere,
and the project is being somewhat quiet right now.

Do you want to integrate it into your application directly, or use it
as a standalone critter? What kind of information on using it would be
most useful to you?

I've got some ideas, but since I helped create it they may be well
skewed. I know the internals very well - and it all seems somewhat
obvious to me, although I know that's not an outside view at all. Your
suggestions for what you need would be very welcome and useful!

Are you looking for an example of how to write a client and push and
pull messages from a queue? How to integrate it into your application
and what code to use to to push messages in?

-joe

On Jan 26, 2008 10:48 PM, shabda <[EMAIL PROTECTED]> wrote:
> I want to use django-queue-service to run long running processess in
> background, but I can not find any documentation about this. Their
> website http://code.google.com/p/django-queue-service/ does not
> contain any docs. Does any one have any links, about how to use it?
> >
>

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



Re: Performance of a django website

2007-12-11 Thread Joseph Heck

Definitely take that specific dynamic page and profile it - see what's
happening and why its slow. That's clearly your first bottleneck to
work on from the data you've provided.

There's a wiki page on that very process here:
http://code.djangoproject.com/wiki/ProfilingDjango and there's
additionally some information you can get when you enable DEBUG to see
how long the SQL queries are taking for that dynamic page. There's a
nice snippet to help there at
http://www.djangosnippets.org/snippets/93/

-joe


On Dec 11, 2007 10:49 AM, Richard Coleman <[EMAIL PROTECTED]> wrote:
>
> Brian Morton wrote:
> > Are you serving static content from the same apache instance?  Also,
> > what kind of network connectivity do you have between your web and
> > mysql servers?  It sounds like apache might need some tuning in terms
> > of thread parameters.  Have you enabled caching yet?  Turn on the
> > cache framework site-wide and set your expiration period to 1 minute
> > or something like that.  You can go back and only enable it for views
> > that you want cached later.
> >
> >
> 1. Static content and dynamic are on the same server (that will change
> on production).  But they are on different apache virtual.  Mod_python
> is turned off for the static stuff.  Hitting only a static page is very
> fast (6500 requests per second).  Hitting the dynamic side is slow (300
> requests per second).
>
> 2. It's gigE between the web server and mysql server, on a dedicated
> switch.  The database is working pretty hard (7000 selects per second),
> but doesn't seem to be the bottleneck.  The webserver is hammered
> (typing any command takes a long time).
> 3. I'm using prefork MPM on apache with maxclients set to 1000.
>
> We are starting to experiment with caching, but I want to improve the
> raw performance of the site as well.
>
>
> Richard Coleman
> [EMAIL PROTECTED]
>
> >
>

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



Re: Performance of a django website

2007-12-11 Thread Joseph Heck

Add on to Rajesh's list -

what pages are you requesting and have you profiled them to understand
what's taking long?

-joe

On Dec 11, 2007 10:08 AM, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
>
> Hi Richard,
>
> >
> > When I stress test the dynamic part of the site, I am only getting about
> > 300 requests per second on my test setup.  This is using two Dell 1950's
> > (one for web, one for mysql database).  These are very powerful machines
> > (3.0ghz Xeons, 8 cores each, 16 gig of ram, 15k SAS drives, etc.)
>
> - How are you running your Django app? Mod_python? FastCGI?
> - What web server are you using?
> - What's the nature of the dynamic Django request you are measuring?
> How many DB queries does it make? Is DEBUG mode off?
> - What kind of numbers do you get when you serve a simple and small
> HTML file statically from your Web server without Django?
> - What kind of numbers do you get when the Django view you are
> benchmarking goes directly to a simple template (i.e. no DB queries)?
> - Are you using memcache?
>
> -Rajesh D
>
>
>
> >
>

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



Re: static on separate what?

2007-12-09 Thread Joseph Heck

running the media off a non-standard port without a front-end proxy to
make it "look" like it's coming from somewhere on Port 80 may get you
some trouble. In particular, we found that a lot of folks behind
firewalls and in corporate environments simply didn't get anything on
the media server *unless* we were shipping it out from Port 80.

damned annoying - ain't right and all that, but there it is.

-joe

On Dec 9, 2007 1:30 PM, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
>
> On Dec 9, 2007 3:07 PM, andy baxter <[EMAIL PROTECTED]> wrote:
> > Does this mean running the django server on a different port to the
> > static files, or is there a way to do it through virtual hosts?
> >
>
> If you only have one IP, you could run media off a non-standard port.
> If you have multiple IPs, just bind your media server to a different
> IP (but still port 80).
>
>
> >
>

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



Re: Combating submission form Spam

2007-12-05 Thread Joseph Heck

I'd recommend something along those lines - otherwise they'll hit you
hard and keep coming!

-joe

On Dec 5, 2007 4:50 PM, Darryl Ross <[EMAIL PROTECTED]> wrote:
> Hey All,
>
> One of the websites I run has started getting spam via the contact form.
>
> What is the recommended way of dealing with this? Do I need to go the
> route of using something like django-captcha?
>
> Thanks for any insight.
>
> Regards
> Darryl
>
>

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



Re: newform: Why Doesn't This work

2007-10-16 Thread Joseph Heck

The "choice = " is getting evaluated as a class, and the self.q_prime
is referring to an instance of the class myForm. At least I think
that's what's happening here...

-joe

On 10/16/07, johnny <[EMAIL PROTECTED]> wrote:
>
> Below  is my form class.  Inside myForm, I tried doing this:
>
> choice = forms.ChoiceField(label="My choice",
>choices=myChoice(self.q_prime).choices())
>
> I get an error right here "choices=myChoice(self.q_prime).choices()":
> name 'self' is not defined
>
> My Form Class:
>
> class myChoice:
> def __init__(self, q_prime):
> _choice = []
> #_choice.append(q_prime)
>
> def choices():
> _choice.append("yellow")
> _choice.append("red")
>
> return _choice
>
> class myForm(forms.Form):
> def __init__(self, *args, **kwargs):
> try:
> self.q_prime = kwargs.pop('q')
> except:
> pass
> super(myForm, self).__init__(*args, **kwargs)
>
> choice = forms.ChoiceField(label="My choice",
>choices=myChoice(self.q_prime).choices()) #I
> get an error right here: name 'self' is not defined
>
>
> >
>

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



Re: OT: How did you handle asynchronous tasks?

2007-10-16 Thread Joseph Heck

On 10/16/07, David Larlet <[EMAIL PROTECTED]> wrote:
> 2007/10/15, Joseph Heck <[EMAIL PROTECTED]>:
> >
> > Hi David,
> >
> > If you'd be willing to indulge me, why doesn't DQS doesn't fit your
> > requirements? I'd love to have some explicit feedback on where it
> > could be improved to match your needs. And yes, I know there's a LOT
> > of places where it could be improved... :-)
> >
>
> Hi Joe,
>
> Here are a couple of suggestions of what I'd like to do if I need to
> use this project:
>
> * Turns it to a RESTful one which mean at least use HTTP verbs instead
> of /delete/ and so one in URLs, I will probably use
> django-rest-interface to do that.
> * Move doctests to the tests.py file and add more tests before the next point.
> * Review some parts of the code, for example use queryset.count()
> instead of len(queryset), or change this part:
>
> q = None
> try:
> q = Queue.objects.get(name=queue_name)
> except Queue.DoesNotExist:
> pass
> if q is None:
> return None
>
> To this one:
>
> try:
> q = Queue.objects.get(name=queue_name)
> except Queue.DoesNotExist:
> return None
>
> I don't know if it works but it seems more natural to me.

Thanks for the feedback!

We (well Rajesh and Marcus) have been adding a huge number of tests in
a development branch, so you'll be seeing that fairly shortly. I
appreciate the request for RESTful verbs in the environment, we'll
definitely look into that.

If I'm reading it correctly, the lack of RESTful verbs was your
primary consideration for what the API to the queue service failed to
provide. Is that correct?

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



Re: OT: How did you handle asynchronous tasks?

2007-10-15 Thread Joseph Heck

Hi David,

If you'd be willing to indulge me, why doesn't DQS doesn't fit your
requirements? I'd love to have some explicit feedback on where it
could be improved to match your needs. And yes, I know there's a LOT
of places where it could be improved... :-)

-joe

On 10/15/07, David Larlet <[EMAIL PROTECTED]> wrote:
>
> 2007/10/15, Jarek Zgoda <[EMAIL PROTECTED]>:
> >
> > We started with cron jobs, but when it grew to unmanageable bunch of
> > scripts, we started thinking on using queuing service (ActiveMQ,
> > RabbitMQ - something that is compatible with AMQP and/or can be used
> > with python client). Still no decision, though.
>
> Thanks for your suggestion, I didn't know AMPQ, it looks very
> interesting. I'd love to know your final decision :).
>
> 2007/10/15, johan de taeye <[EMAIL PROTECTED]>:
> > David,
> >
> > It's a very common requirement, and some people have run into this
> > before.
> > Have a look at this:
> >http://code.google.com/p/django-queue-service/
> >
> > I doubt if this 'll be as robust and reliable as a real messaging
> > product, but for simple setups it'ld do the trick.
>
> Thanks Johan for your reminder, I totally forget this project.
> Unfortunately it doesn't fit my needs but it can be an interesting
> start.
>
> Regards,
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: custom method for view

2007-10-04 Thread Joseph Heck

Get an instance of the model and call getValue() on it.

i.e.

my_model_instance = myClass.objects.get(pk=12)
my_model_instance.getValue()

-joe

On 10/4/07, Goon <[EMAIL PROTECTED]> wrote:
>
> probably a dumb question, what's the syntax for calling a method in
> models.py from views.py?
>
> so like:
>
> #models.py
> class myClass (models.Model):
>   value = 24
>   def getValue(self):
>return value
>
>
> #views.py
> def myFunction():
>   myData = ###what do I put here to call "getValue()" instead of
> looking up the value field itself?
>
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Sending encrypted email

2007-10-04 Thread Joseph Heck

Sorry - Its worth noting that you could start by working with the
EmailMultiAlternatives class in django.core.mail. It has a method
"attach_alternative()" that works on the EmailMessage subclass to
attach alternative representations of the content. I'm not sure what
the "right" way to send an encrypted message with GPG is, but that
might be something of use...

-joe

On 10/4/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
> Nothing built in - You're going to have to head towards the low-level
> libraries to make this happen.
>
> -joe
>
> On 10/4/07, Francis <[EMAIL PROTECTED]> wrote:
> >
> > Hello,
> >
> > I need to send an email with a encrypted part in it. Is there a built-
> > in way to do this in python or django (since it is a django apps).
> > Maybe the entire can be encrypted, but it is only a piece that
> > requires it.
> >
> > i look at some encryption mechanism, but nothing seem to be
> > straightforward. (PGP, OTP)
> >
> > Francis
> >
> >
> > > >
> >
>

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



Re: Sending encrypted email

2007-10-04 Thread Joseph Heck

Nothing built in - You're going to have to head towards the low-level
libraries to make this happen.

-joe

On 10/4/07, Francis <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I need to send an email with a encrypted part in it. Is there a built-
> in way to do this in python or django (since it is a django apps).
> Maybe the entire can be encrypted, but it is only a piece that
> requires it.
>
> i look at some encryption mechanism, but nothing seem to be
> straightforward. (PGP, OTP)
>
> Francis
>
>
> >
>

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



Re: django database setup problem

2007-10-04 Thread Joseph Heck
ql.c:2526: error: invalid operands to binary -
> _mysql.c:2526: warning: comparison between pointer and integer
> _mysql.c:2526: warning: passing argument 2 of â__builtin_strcmpâ from
> incompatible pointer type
> _mysql.c:2526: error: invalid operands to binary -
> _mysql.c:2526: warning: comparison between pointer and integer
> _mysql.c:2526: warning: passing argument 2 of â__builtin_strcmpâ from
> incompatible pointer type
> _mysql.c:2526: error: invalid operands to binary -
> _mysql.c:2526: warning: comparison between pointer and integer
> _mysql.c:2526: warning: passing argument 1 of âstrlenâ from
> incompatible pointer type
> _mysql.c:2526: warning: passing argument 2 of â__builtin_strcmpâ from
> incompatible pointer type
> _mysql.c:2526: error: invalid operands to binary -
> _mysql.c:2526: error: invalid operands to binary -
> _mysql.c:2526: warning: statement with no effect
> _mysql.c:2526: error: invalid operands to binary -
> _mysql.c:2526: warning: statement with no effect
> _mysql.c:2526: error: invalid operands to binary -
> _mysql.c:2526: warning: statement with no effect
> _mysql.c:2526: warning: passing argument 2 of â__builtin_strcmpâ from
> incompatible pointer type
> _mysql.c:2527: error: âselfâ undeclared (first use in this function)
> _mysql.c:2527: warning: passing argument 1 of âPyMember_SetOneâ from
> incompatible pointer type
> _mysql.c:2527: warning: passing argument 3 of âPyMember_SetOneâ from
> incompatible pointer type
> _mysql.c:2529: warning: passing argument 2 of âPyErr_SetStringâ from
> incompatible pointer type
> error: command 'gcc' failed with exit status 1
> 
>
> I searched the intrenet for solutions and some people suggested to
> install mysql-devel package. I tried to install mysql-devel package,
> but getting lots of "Failed dependencies" error. I am working on
> Fedora 4 system. Do I have to upgrade my system to setup django
> properly? Any idea?
>
> Many thanks,
> Swati
>
>
> On Oct 3, 10:25 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> > You're on the right track - missing the MySQL python libraries. It
> > looks like Python is also missing the zlib libraries...
> >
> > not sure which OS you're using, but there's probably an "apt-get
> > install ..." or "rpm -Uvh ..." command that will get you the MySQL
> > Python libraries that you need. Looking on an Ubuntu box, the package
> > I installed was:
> >
> > "apt-get install python-mysqldb"
> >
> > -joe
> >
> > On 10/3/07, swati <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Hi All,
> >
> > > I am setting up first django project. When I set up django without any
> > > database settings, I could see the first welcome page from django.
> > > After this initial success, when I specify the database settings in
> > > the 'settings.py' and tried to run django, I am getting error,-
> >
> > > "ImproperlyConfigured: Error loading MySQLdb module: No module named
> > > MySQLdb"
> >
> > > I have downloaded python-mysql and tried installing it, where I am
> > > getting error,-
> >
> > > ---
> > > Traceback (most recent call last):
> > >   File "setup.py", line 5, in ?
> > > import ez_setup; ez_setup.use_setuptools()
> > >   File "/home/djtstdir/MySQL-python-1.2.2/ez_setup.py", line 85, in
> > > use_setuptools
> > > import setuptools; setuptools.bootstrap_install_from = egg
> > > zipimport.ZipImportError: can't decompress data; zlib not available
> > > ---
> >
> > > I have installed zlib also, but getting same error.
> >
> > > I am working remotly on linux
> > > I am working as root
> > > I have apache, mysql, python 2.4, and mod_python installed in my
> > > machine.
> >
> > > Any idea what I am missing out? Please help.
> >
> > > Many Thanks,
> > > Swati
>
>
> >
>

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



Re: django database setup problem

2007-10-03 Thread Joseph Heck

You're on the right track - missing the MySQL python libraries. It
looks like Python is also missing the zlib libraries...

not sure which OS you're using, but there's probably an "apt-get
install ..." or "rpm -Uvh ..." command that will get you the MySQL
Python libraries that you need. Looking on an Ubuntu box, the package
I installed was:

"apt-get install python-mysqldb"

-joe

On 10/3/07, swati <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> I am setting up first django project. When I set up django without any
> database settings, I could see the first welcome page from django.
> After this initial success, when I specify the database settings in
> the 'settings.py' and tried to run django, I am getting error,-
>
> "ImproperlyConfigured: Error loading MySQLdb module: No module named
> MySQLdb"
>
> I have downloaded python-mysql and tried installing it, where I am
> getting error,-
>
> ---
> Traceback (most recent call last):
>   File "setup.py", line 5, in ?
> import ez_setup; ez_setup.use_setuptools()
>   File "/home/djtstdir/MySQL-python-1.2.2/ez_setup.py", line 85, in
> use_setuptools
> import setuptools; setuptools.bootstrap_install_from = egg
> zipimport.ZipImportError: can't decompress data; zlib not available
> ---
>
> I have installed zlib also, but getting same error.
>
> I am working remotly on linux
> I am working as root
> I have apache, mysql, python 2.4, and mod_python installed in my
> machine.
>
> Any idea what I am missing out? Please help.
>
> Many Thanks,
> Swati
>
>
> >
>

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



Re: python script

2007-10-03 Thread Joseph Heck

just modify sys.path as you need...

On 10/3/07, Xan <[EMAIL PROTECTED]> wrote:
>
> In http://code.djangoproject.com/ticket/5534 there is a howto for
> doing that.
> But it's only when the script is in the root project directory.
> What happens if we want the script in other location? What line we
> have to add?
>
> Thanks a lot,
> Xan.
>
> On Sep 18, 8:27 pm, Horst Gutmann <[EMAIL PROTECTED]> wrote:
> > You mean an error telling you that you need to set the
> > DJANGO_SETTINGS_MODULE environment variable? Or something else?
> >
> > os.environ['DJANGO_SETTINGS_MODULE']='mysite.settings'
> >
> > right at the top of yourscript(after the #! and the import for os ;) )
> > should solve this.
> >
> > Then you should probably also add the parent directory of your project
> > to sys.path :-)
> >
> > - Horst
> >
> > Xan wrote:
> > > Hi,
> >
> > > If we have the models models.py:
> >
> > > from django.db import models
> >
> > > class Poll(models.Model):
> > > question = models.CharField(max_length=200)
> > > pub_date = models.DateTimeField('date published')
> >
> > > class Choice(models.Model):
> > > poll = models.ForeignKey(Poll)
> > > choice = models.CharField(max_length=200)
> > > votes = models.IntegerField()
> >
> > > [example extracted 
> > > frohttp://www.djangoproject.com/documentation/tutorial01/]
> >
> > > how can I write apythonscriptfor create various polls?
> >
> > > I tried:
> >
> > > a.py:
> >
> > > #!/usr/bin/python
> > > from mysite.polls.models import Poll
> > > import datetime
> >
> > > i = 0
> > > while i<4:
> > > a = str(i)
> > > print a
> > > Poll.create(question=a, data=datetime.date.today())
> > > i = i+1
> >
> > > but when I runpythona.py in bash, there are problems with imports.
> > > What lines of imports we need for running a standalonepythonscript?
> >
> > > Thanks in advance,
> > > Xan.
> >
> > > PS: There is no doc in official site mentioning that. Maybe good to
> > > add it to site.
>
>
> >
>

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



Re: fell sad will a newform implement

2007-10-02 Thread Joseph Heck

Narrow this down and you should be able to work through it.

First - is the view getting invoking correctly, regardless of what
newforms is doing? If you're running on a dev server instance (i.e.
django-admin runserver), then try printing out the request.POST or
request.GET in the view to see what is coming through.

You can also invoke django-admin shell and load up the Form and "poke
at it", which I've found to be a pretty good debugging tool. i.e.

>>> import forms
>>>
>>> example_data = { 'name' : 'test', 'description' : 'blue', 'vendor'
: 'ford' }
>>> f = forms.AddTypeForm(example_data)
>>> f.is_valid()
True

or whatever.

Break it down into steps to debug it, and then determine if each piece
is working. You'll make good progress that way.

-joe



On 10/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> can somebody help me out of newform,i spend one whole day to study
> djangosnipppets.com's newform, but it did not work for me.
>
> models.py:
> class Vendor(models.Model):
>
> name = models.CharField(maxlength=100)
> slug = models.SlugField()
>
> class Type(models.Model):
>
> vendor = models.ForeignKey(Vendor)
> name = models.CharField(maxlength=100)
> description = models.TextField()
>
> forms.py:
> from django import newforms as forms
> from models import Vendor
>
> attrs_dict = { 'class': 'required' }
>
> class AddTypeForm(forms.Form):
> def __init__(self, *args, **kwargs):
> super(AddTypeForm, self).__init__(*args, **kwargs)
> self.fields['language'].choices = [('', '--')] +
> [(x.id, x.name) for x in Vendor.objects.all()]
>
>
> name = forms.CharField(max_length=100,
> widget=forms.TextInput(attrs=attrs_dict))
> description =
> forms.CharField(widget=forms.Textarea(attrs=attrs_dict))
> vendor = forms.ChoiceField(choices=(),
> widget=forms.Select(attrs=attrs_dict))
>
> views.py:
> def add_car(request):
>
> if request.method == 'POST':
> form = forms.AddTypeForm(request.POST)
> if form.is_valid():
> new_type = Type(name=form.clean_data['name'],
>
> description=form.clean_data['description'],
>
> vendor_id=form.clean_data['vendor'],
>)
> new_type.save()
> return HttpResponseRedirect(new_type.get_absolute_url())
> else:
> form = forms.AddTypeForm()
> return render_to_response('rate/add_car_form.html',
>   { 'form': form },
>
> context_instance=RequestContext(request))
> add_car = login_required(add_car)
>
> templates:
> 
>
>
> and i got this error:
>
> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1/cars/add/
>
> No Vendor matches the given query.
>
>
>
> can somebody help me, 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Post question

2007-10-02 Thread Joseph Heck

Yes, absolutely.

You have all the form data in the request object that comes into the
view - you can use that to tweak data and send off another request
externally. It's relatively high latency, but it definitely is
possible.

-joe

On 10/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I dunno if this is possible or not. I have a form that posts to a
> third party. It's a paypal payment processing type thing. What I want
> to do is go through a view (or middleware??) and do something before I
> go on to where the form was posting to. But I need to pass all the
> form data on to the third party without losing it. So is it doable?
>
>
> >
>

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



Re: Create and send post data to a view?

2007-10-01 Thread Joseph Heck

Right on - a better solution if you're keeping it all in the same server!

-joe

On 10/1/07, Marty Alchin <[EMAIL PROTECTED]> wrote:
>
> On 10/1/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
> > You could do it by having your view act as a proxy. Basically
> > instantiate a new connection to the view in question from your web
> > application using urllib2 or the like. Then get the results, process
> > them as you wish, and send the results of that post-processing (if
> > any) back to the original client request.
>
> To be fair, that's even more overhead than is really necessary. You
> can actually just do "from django.http import HttpRequest" and create
> a request that way, and just pass it to the other view. There's no
> need to actually involve any HTTP traffic, plus it wouldn't rely on
> any particular URL scheme. It would go straight to the view, no
> questions asked.
>
> Something like the following could work, but what you add to the the
> request object will depend on what the other view does with it.
>
> from django.http import HttpRequest
>
> from myapp.views import real_view
>
> def proxy_view(request):
> req = HttpRequest()
> req.method = 'POST'
> req.POST = {'arg1': 'value1', 'arg2': 'value2'}
> response = real_view(req)
> if response.status == 200:
> return response
> else:
> # Handle errors here
>
> Keep in mind that in this scenario, real_view won't have any
> middleware processing, it'll just get the request exactly as you pass
> it. So if the view needs request.user, for instance, you'll have to
> set it manually (req.user = request.user) before passing the new
> request to the view.
>
> Of course, if all you're doing is adding POST data, you could probably
> get by with just changing the method on the actual request, and adding
> POST data, then triggering the other view:
>
> from myapp.views import real_view
>
> def proxy_view(request):
> request.method = 'POST'
> request.POST = {'arg1': 'value1', 'arg2': 'value2'}
> return real_view(request)
>
> I hope this helps.
>
> -Gul
>
> >
>

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



Re: Create and send post data to a view?

2007-10-01 Thread Joseph Heck

You could do it by having your view act as a proxy. Basically
instantiate a new connection to the view in question from your web
application using urllib2 or the like. Then get the results, process
them as you wish, and send the results of that post-processing (if
any) back to the original client request.

-joe

On 10/1/07, Greg <[EMAIL PROTECTED]> wrote:
>
> I was wondering if I could send POST data to another view for
> processing.  My original view would not be sent any POST data.  The
> post data would get generated in my view and sent to another view for
> processing.
>
> Is this possible?
>
>
> >
>

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



Re: USE HTML

2007-09-24 Thread Joseph Heck

Django has an excellent starter tutorial at
http://www.djangoproject.com/documentation/tutorial01/ that should get
you started with what you're asking and want to know. Do the tutorial,
it's worth it.

-joe

On 9/23/07, mayank bhargava <[EMAIL PROTECTED]> wrote:
>
> How to use html or how to create dunamic html pages with django ?
>
> best regards
> mayank
>
>
> >
>

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



Re: how to implement "stay logged on this computer until i log out"?

2007-09-24 Thread Joseph Heck

You can certainly access cookies manually and do with them as you
like. That's how we've implemented a "remember who it was that last
logged in from this computer" kind of feature.

There's a set_cookie() method on the request object that can do this
work for you - but it's not thoroughly documented. I'd recommend
looking at the code directly and maybe checking out this thread:

http://www.google.com/url?sa=t=res=4=http%3A%2F%2Fgroups.google.com%2Fgroup%2Fdjango-users%2Fbrowse_thread%2Fthread%2F7b65ff5783f71b9c%2Fa4079aa60e7dfa37=GFT3Ro7tOKGegAPn49C_BA=AFQjCNHCE35TvLu4ZdYy1SklwYZh8b_wqg=fPsOuIxzECnESDy_ZtHWqg

-joe

On 9/23/07, Mark Green <[EMAIL PROTECTED]> wrote:
>
> Hi list,
>
> I would like to have sessions normally timeout after
> 8 hours, that is easily achieved by setting
> SESSION_COOKIE_AGE in settings.py.
>
> But additionally I'd like to provide a checkbox to "stay logged
> in on this computer until i log out" which shall make the
> session immortal (remove expiry).
>
> Is there anything in the API to implement that or can I get
> at the session-cookie meat to do it manually?
>
> I basically need to override the default from
> SESSION_COOKIE_AGE for individual sessions.
>
>
> -mark
>
>
> >
>

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



Re: ORM / Performance

2007-09-18 Thread Joseph Heck

Without knowing a hell of a lot more of the details of you site, what
you're trying to do, etc - nobody can reasonably answer this question.
The ORM is fine, but if it's not as fast as you need for certain
queries, you can always drop back to RAW sql to see if that will give
you speed. At the level of activity you're citing, you'll have to make
some serious choices between how personalized you'd like the site and
how much resource you can throw at the problem.

Between caching, profiling, and having a good sense of what your
current hardware can run to, you can scale out Django horizontally to
achieve the scale you need.

-joe

On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
>
>
>
> On Sep 18, 10:23 pm, yezooz <[EMAIL PROTECTED]> wrote:
> > On Sep 18, 10:14 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> >
> > > two words: intelligent caching
> >
> > > Know what you're asking for commonly, and cache it up with memcache.
> > > That will do you a world of benefit.
> >
> > Well of course caching will solve some of the problems, but cache
> > still needs to regenerated sometime...
>
> I should say that I'm thinking about few millions of pageviews a day
>
> >
> >
> >
> > > -joe
> >
> > > On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
> >
> > > > hi all,
> >
> > > > I'm sure many of you run high traffic websites in Django and I'm very
> > > > curious how you're avoiding performance hit caused by built-in ORM.
> > > > Select_related not always working and it's still might generate dozens
> > > > of select's.
> > > > Are you just running custom SQL queries with joins ?
> >
> > > > greetings
>
>
> >
>

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



Re: ORM / Performance

2007-09-18 Thread Joseph Heck

two words: intelligent caching

Know what you're asking for commonly, and cache it up with memcache.
That will do you a world of benefit.

-joe

On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
>
> hi all,
>
> I'm sure many of you run high traffic websites in Django and I'm very
> curious how you're avoiding performance hit caused by built-in ORM.
> Select_related not always working and it's still might generate dozens
> of select's.
> Are you just running custom SQL queries with joins ?
>
> greetings
>
>
> >
>

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



Re: Django, CherryPy and threading

2007-08-28 Thread Joseph Heck

You get to decide the version of "safe" - i've done something similiar
with a little REST queuing app and run it up to fairly significant
loads without issue.

-joe

On 8/28/07, Justin Johnson <[EMAIL PROTECTED]> wrote:
>
>
> I've managed to get Django working nicely with CherryPy using WSGI.
> Previously I've deployed Django with Apache and ModPython where each
> requested is serviced by a separate Python instance.
>
> This isn't the case with CherryPy though as it's thread based which
> leads me to the following concern:  is it safe to serve Django with
> CherryPy?
>
> Cheers,
>
> Justin
>
> >
>

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



Re: Web developement with Python

2007-08-27 Thread Joseph Heck

To answer your specific question about can Django handle 100 page
hits/sec, the answer is yes. Like any other technology, how you
achieve that scale depends on a lot of things other than just the
framework.

There's a nice (but not detailed) interview about Pownce at
http://immike.net/blog/2007/07/06/interview-with-leah-culver-the-making-of-pownce/
- which I suspect is one of the higher traffic sites that actively use
Django. Never mind the little guys like the Washington Post...

-joe

On 8/27/07, AMBROSE <[EMAIL PROTECTED]> wrote:
> I need a clear info on why Python is good for enterprise web
> developement .
>
> Can Python be used for a website having several 100 page hits /sec ?
>
> I am not bothered of coding complexity .
>
> How about linux OS, ,Python and
> DB2 express edition for webdevelopement?
>
> Ambrose
> PeterMary.com -- coming soon
>
>
> >
>

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



Re: Help with Django installation on OSX 10.4.10

2007-08-26 Thread Joseph Heck

Use the path settings from my earlier post - that fits perfectly with
MacPorts and should do you.

-joe

On 8/26/07, Brandon Taylor <[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
>
> I scrapped my custom install of Python 2.4.4 and Django in favor of an
> install from MacPorts. So, now I have Python 2.5.1 and Django
> installed.
>
> But, now when I run python in bash, I get version 2.3.5. Mac Ports has
> insalled everything to /opt/local/var/macports/software
>
> I have django-admin.py, python2.5, python2.5-config, smtpd2.5.py and
> pydoc2.5 in /opt/local/bin
>
> Can someone help me get the correct path settings in bash_profile,
> profile, bash_login or whatever files I need to edit? I would really
> appreciate the help. I'm anxious to get started with Python and
> Django.
>
> TIA,
> Brandon
>
>
> On Aug 26, 1:34 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> > On 26-Aug-07, at 11:51 AM, Brandon Taylor wrote:
> >
> > > -bash: django-admin.py: command not found
> >
> > what happens if you run /usr/local/bin/django-admin.py, that is, with
> > the full path name. If it runs, then it means your path does not
> > contain /usr/local/bin. If it doesnt run, your alias is borked.
> >
> > --
> >
> > regards
> > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/
>
>
> >
>

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



Django Queue Service

2007-08-26 Thread Joseph Heck

For anyone interested, I've made available the code (using Django) to
a project that implements a message queue for use with Django (or
anything, really) projects. The brilliantly conceived name is "Django
Queue Service", and the source is available at
http://django-queue-service.googlecode.com/. I've written up the
background at my blog
(http://www.rhonabwy.com/wp/2007/08/25/django-queue-service/) and just
wanted to let you all know it was there if you wanted or needed such a
critter.

The code was hacked up in a few evenings at OSCON 2007. Like so many
other folks, I've run into "I want to run some background processing
that is initiated from a django project, but I didn't see any
brilliant queueing solutions that I could take and run with. Hence
this was born, intending to replicate over Amazon's Simple Queue
Service REST API.

It is not set up as a drop-down-and-run service, but there isn't too
much more that's needed to use it directly if you're interested. I've
also included a pure python WSGI server from CherryPy within the
source - which I found was a very effective way to run the code. I've
been wanting to do a pure python server for a while, and this really
did the trick for me.

-joe

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



Re: Help with Django installation on OSX 10.4.10

2007-08-26 Thread Joseph Heck

It is most likely an improper reference in django-admin.py to the
location of python - or the "wrong" python.

If you invoke python in your terminal, which do you get?

BTW: I used the MacPorts install of Python, and I keep the following
in my .profile:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

which does the trick for my installation.

-joe

On 8/25/07, Brandon Taylor <[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
>
> I'm just getting started with Django/Python. I have installed Python
> 2.4.4, and Django from the latest build. I can run 'python' and
> 'import django' from bash and it does not error out, so I'm assuming
> my installs are correct.
>
> I have made an alias of 'django-admin.py' and placed it in my '/usr/
> local/bin'. When I attempt to run 'django-admin.py startproject foo',
> bash gives me an error:
>
> -bash: django-admin.py: command not found
>
> What can I do to resolve this error? All of my .bash_profile
> and .bash_login PATH settings seem to be pointing in the right place
> for my django installation.
>
> Thanks in advance,
> Brandon
>
>
> >
>

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



Re: non-event driven method called?

2007-08-23 Thread Joseph Heck

common problem, but a pretty straightforward solution. You can run a
script via cron that imports and uses Django bits as you like - we do
that quite often. Just make sure you have your environment set up
appropriately when you invoke the script - adding in the proper
PYTHONPATH and such.

-joe

On 8/23/07, John Menerick <[EMAIL PROTECTED]> wrote:
> Inside my django app, regardless of the events of my django-application, I
> would like to call a method every minute.  Since Django is heavily event
> driven, I'm at a loss as how to make this work.  I'm looking for a way to
> make this happen.  Any ideas?
>
>
>
> John Menerick
>
>  >
>

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



Re: cmemcached etc

2007-08-13 Thread Joseph Heck

What platform are you trying to install this onto?

-joe

On 8/13/07, TheMaTrIx <[EMAIL PROTECTED]> wrote:
>
> Ok, I've used memcached for quite some time with PHP sites and that
> was rather easy.
>
> Now I see you can use it with Django, but to get memcached support you
> need to either install cmemcached or python-memcached.
>
> Neither of these apps has any kind of information on their sites or in
> the archives on how you can install those modules so you can enable
> memcached in the django config. They seem to think that everyone knows
> everything about Python or something ...
>
> Anyone know how to do 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: full-text indexing

2007-08-08 Thread Joseph Heck

There was a very impressive demonstration of SOLR at OSCON this year,
and it looks very, very easy to set up for light(i.e. reasonable but
not-heavy) usage. The default install comes pretty much ready to roll
- you'll have to tweak out a "schema" description of what you're
indexing, and work on a way to do inserts, updates, and deletes from
your database (it's a straight REST interface) - but that's really it.

I've started working on this myself, but I haven't gotten past getting
SOLR loaded onto the local machine and digging into my (current)
TSearch2 schema to see what I want to load, index, and store within
SOLR.

-joe

On 8/8/07, Gábor Farkas <[EMAIL PROTECTED]> wrote:
>
> Jarek Zgoda wrote:
> > I don't know what do you mean by "transactions" in case of full-text
> > search engine as it doesn't do any multi-step updates (only single-
> > step deletes or inserts in case of PyLucene).
> >
> > Anybody who wants to use PyLucene, be aware that you cann't embed (iow
> > "use", "import") PyLucene in your Django application code if your web
> > server is either forking or threadinig one. You have to build a
> > service that is separated from any threading or forking. Does it still
> > seems reasonable to anybody? Well, if yes, welcome to pylucene-dev
> > mailing list. ;)
>
> another way to use Lucene in django would be solr
> (http://lucene.apache.org/solr/), but i have never tried it.
>
> gabor
>
> >
>

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



Re: remember me feature

2007-08-01 Thread Joseph Heck

If you want something that lasts longer than a session (for how-ever
you configured it on your system), then you might consider writing
your own cookie, and checking for it at the relevant places. I don't
use this mechanism for authentication, but as a little additional
personalization touch to remember who's logged in from that browser
previously.

It's not super-obvious, but here's a little snippet example of setting
the cookie:

my_response.set_cookie(key=USER_PERSISTENCE_NAME,
   value=username,
   max_age=None,
   expires=expires,
   domain=settings.SESSION_COOKIE_DOMAIN
)

and getting rid of it:

my_response.delete_cookie(USER_PERSISTENCE_NAME)

and to read it, we added a little to a central Context Processor to
make the data available in all the templates:

ctx['saved_username'] = request.COOKIES.get(USER_PERSISTENCE_NAME, "")




On 8/1/07, JHeasly <[EMAIL PROTECTED]> wrote:
>
> Hey James,
>
> This might get you going in the right direction:
>
> "The default SessionMiddleware that comes with Django lets you pick if
> you want all sessions to be browser-length or persistent, if you want
> to use different types of sessions based on a users preference (e.g.
> the good old "Remember Me" check-box) you're gonna have to write your
> own middleware. ... "
>
> http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware
>
> Hope this helps.
>
> John
>
>
> >
>

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



Re: learning django's HttpRequest Object and Middleware

2007-07-31 Thread Joseph Heck

The middleware is loaded by whatever is serving your requests, and
when it loads it'll process through that file - invoking "foofunc()"
in the path and executing it.

I'm not sure I understand your second question though.

-joe

On 7/31/07, james_027 <[EMAIL PROTECTED]> wrote:
>
> Hi Thomas
>
> > The methods of each middleware are called one for every request. If your
> > changes need information from the request, that's the right place.
> >
> > If you want to add a method which should be added once the server 
> > (mod_python,
> > scgi, ...) starts you can use this place too. But it is better if you use
> > the module level of the middleware:
> >
> > MyMiddleWare.py
> >
> > foofunc() # executed on server start
> >
> > class MyMiddleWare:
> > def process_request(...):
> > # executed for every request.
>
> Thanks for this info. What is this foofunc() (a method that can be
> anyware in the django source?)
>
> I have another question, when do I use middleware for additional
> attribute to put place on the request object VS the request.session
> objects?
>
> Thanks
> james
>
>
> >
>

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



Re: Django Blocking/ Background Jobs

2007-07-30 Thread Joseph Heck

A side conversation from the Django BOF at OSCON this year made some
noises about "TheSchwartz" (http://code.sixapart.com/trac/TheSchwartz)
- a Perl job queue that SixApart (Brad FitzPatrick) has made
available. I'd heard there were now Ruby and Python bindings to it,
but I haven't found the relevant links as yet.

It sounded very promising.

-joe

On 7/23/07, Norjee <[EMAIL PROTECTED]> wrote:
> Apart from twisten there are other libraries which offer remoting for
> python:
> spyro: http://lsc.fie.umich.mx/~sadit/spyro/spyro.html
> pyro: http://pyro.sourceforge.net/manual/PyroManual.html
>
> If i remember well there is atleast one more, i forgot the name of
> that project.
>
> I'm affraid there is no ready made backgrounddrb, but to me it seems
> rather simple to implement. Only one problem: you need to be sure the
> backgroundserver is running, if not, then start it. But the last time
> i checked backgrounddrb (months ago) it had the same problem ;). As
> for reporting the progress, that's as simple as giving each job an id,
> and of course, keep track of the progress inside the jobs.. Threads
> (or maybe async io) would just do that ;)
>
>
> >
>

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



Re: tsearch2 problems in postgres?

2007-07-30 Thread Joseph Heck

We pre-process the search query with our own simple code, converting
"and" and "or" and verifying that the resulting query is acceptable.
Ultimately, we fall back to a method that just checks against TSearch2
itself to verify the query is "OK":

def _validate_query(querystring):
""" validates the internal form of the query strings to be used
with TSearch2/Postgres.

Returns a boolean with the validation, and warns to the standard
logging handle if an invalid query was used.
"""
ll=logging.getLogger("searcher")
cursor = connection.cursor()
query = "SELECT count(to_tsquery('default',%s))"
row = None
try:
cursor.execute(query,[querystring])
row = cursor.fetchone()
except Exception:
ll.warn("search query reported invalid: %s" % querystring)
return False
return True


On 7/26/07, John <[EMAIL PROTECTED]> wrote:
>
> SELECT *, rank(ts_vec, to_tsquery('default', 'lc & 11(')) FROM us
> WHERE ts_vec @@ to_tsquery('default', 'lc & 11(') LIMIT 9 OFFSET 0
>  this query gives an error
>  in tsearch2
>  saying syntax error
>  any idea on how 2 strip the non safe tsearch stuff
>  before feeding it to sql
>  this is from a web search interface?
>  psycopg2.ProgrammingError at /search ->
>  if i give inpu as lc !! (
>  is there a list of characters that need to stripped out before doing
> @@ in tsearch2
>
>
> >
>

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



Re: Can Google index Django's pages?

2007-07-16 Thread Joseph Heck

You can optimize a bit for Google as well by implementing a sitemap
(see: http://www.djangoproject.com/documentation/sitemaps/)

-joe

On 7/13/07, felixhummel <[EMAIL PROTECTED]> wrote:
>
> Thanks for this fine answer, Julio!
> Now nothing is going to hold me back! ;)
>
> On Jul 13, 8:22 pm, "Julio Nobrega" <[EMAIL PROTECTED]> wrote:
> >   hi Felix,
> >
> >   Yes, Google will index your website even if you use Django. The only
> > stuff that stop Google are the robots.txt, meta tags, and a direct
> > request. Don't worry, if you can access your website using a browser,
> > there's at least one link to it somewhere, and you didn't do any of
> > the three things I mentioned to stop Google, search engines will find
> > you.
> >
> > On 7/13/07, felixhummel <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Hi!
> >
> > > Before I decide to dive into Django, could you please tell me if
> > > Google can crawl pages created by Django natively?
> > > I am running an Apache with mod_python. Does this matter?
> > > Thanks in advance!
> >
> > > Felix
> >
> > --
> > Julio Nobrega -http://www.inerciasensorial.com.br
>
>
> >
>

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



Re: request

2007-07-10 Thread Joseph Heck

Hi Sreelatha,

When you say "send a messae to multiple users", do you mean display a
message on your site to a set of users?

There's a couple of different ways to attack this kind of problem -
but the easiest is to have a view that queries a storage place (likely
a model) and displays any messages from there if the user matches the
criteria that you're interested in.

There is a built in messaging mechanism that works for authenticated
users, but it is "per user" - in that a view can push a message into
the session for the user, and then a future template or view can pull
those out and display them. There's also work (I think...) ongoing to
do that for anyone that has a session, although I don't know its
status off the top of my head. Neither of these options are
particularly "broadcast" kinds of mechanisms though.

-joe

On 7/9/07, sreelatha <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I am Sreelatha I have struck up at one place please help me out.
> The problem is I want to send a single message to multiple users but I
> dont want to save the message to all the users which is a hectic work.
> I s there any way to solve this problem.
>
>
> >
>

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



Re: installation issues

2007-07-09 Thread Joseph Heck

Where are you getting stuck? I assume you it works - it's just a
matter of getting the pieces/parts installed.

-joe

On 7/8/07, surfwizz <[EMAIL PROTECTED]> wrote:
>
> I am having trouble installing Django on Mac OSX 10.4.10.  Any help
> would be welcome.  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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django books application i18n

2007-07-09 Thread Joseph Heck

Even with generic views, you have custom templates. For anything in
the template, first {% load i18n %} and then follow the instructions
for internationalizing the text on the template.

If it's something coming from your inside model, there's really no
option for internationalizing that data aside from something you do
yourself. To use the i18n functionality, the text has to be known
ahead of time - there's nothing built in to django to automagically
translate words from one language to another.

If this doesn't answer your question - take another stab at asking it.
I'm not 100% sure I understood what you were asking.

-joe

On 7/8/07, Gianluca <[EMAIL PROTECTED]> wrote:
>
> Thanks...but in my case?
> I have thought to extends the "change_form.html" generic template. But
> how can I refer to a field of my data model? ( book name field for
> example)
>
> Thanks.
>
> Joseph Heck ha scritto:
>
> > I think most everything that you'd like to know is detailed out at
> > http://www.djangoproject.com/documentation/i18n/
> >
> > -joe
> >
> > On 7/6/07, Gianluca <[EMAIL PROTECTED]> wrote:
> > >
> > > Hello,
> > > I'm following the Django tutorial about books application. How can I
> > > internationalize this application?
> > > For example, how can I internationalize a field name of insert book
> > > form?
> > > Thanks
> > >
> > > Gianluca
> > >
> > >
> > > >
> > >
>
>
> >
>

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



Re: Django books application i18n

2007-07-06 Thread Joseph Heck

I think most everything that you'd like to know is detailed out at
http://www.djangoproject.com/documentation/i18n/

-joe

On 7/6/07, Gianluca <[EMAIL PROTECTED]> wrote:
>
> Hello,
> I'm following the Django tutorial about books application. How can I
> internationalize this application?
> For example, how can I internationalize a field name of insert book
> form?
> Thanks
>
> Gianluca
>
>
> >
>

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



Re: Using simplejson

2007-06-21 Thread Joseph Heck

Without seeing your code, it's hard to know what's happening. It
sounds like you're having a problem using JSON objects with
javascript, so I'll try and throw out a short example and see if that
helps. If this doesn't do it for you, put up the actual javascript
that's causing you the trouble, and we'll see if we can't debug it.

The example: http://www.djangosnippets.org/snippets/292/

This example uses Dojo, the idea being checking to see if a username
is available. Most of the text of that example is pulling all the
parts together, but the critical line to using JSON within the
javascript is:

arrayData = dojo.json.evalJson(data);

which evaluates the data and returns it as object literals that you
can then access with dot notation or whatever you use. In my case, I
used the javascript array/dictionary lookup notation to get my simple
"is it there" response and then I spew in some HTML accordingly.

-joe


On 6/20/07, aman r <[EMAIL PROTECTED]> wrote:
> yes, u have understood my problem correctly but the JSON object is not
> recognized in the html page so if i try to say something like list.name
> (where list has my JSON and name is its one of the values present in that
> list) then it doesnt get recognized, is gives me Type mismatch error , is
> there any conversion or decode i need to do ?
>
>
> On 6/20/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
> >
> > If I understand correctly, that sounds reasonably doable - what is
> > your question? Taking JSON from whatever source and generating a form
> > in HTML is pretty much straight javascript and/or templating.
> >
> > -joe
> >
> > On 6/20/07, cess <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi All,
> > >I am very new to the Django framework, i have tried using free
> > > admin API , it works fine,so i  wanted to design my own page where i
> > > dont interact with database and dont create any models, i rather call
> > > an JSP page in my view which returns an JSON object, i want to convert
> > > it into a form which i can use to display in my template ( i.e.,) in a
> > > form python form or something and access all different fields from
> > > that JSON result.
> > >
> > >
> > > >
> > >
> >
> >
> >
> >
>
>
>  >
>

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



Re: classes

2007-06-21 Thread Joseph Heck

Ahhh! Thanks, didn't know (obviously) about that one!

-joe

On 6/21/07, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
>
> Actually, type is a function, not a method.
> type(x) == x.__class__
>
> Regards,
> Aidas Bendoraitis aka Archatas
>
>
> On 6/18/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
> >
> > x = '123'
> > x.__class__ will give a reasonable answer, x.type() doesn't. (Python 2.4)
> >
> > If you can get away with using type(), it's probably a lot cleaner to use...
> >
> > -joe
> >
> > On 6/18/07, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
> > >
> > > or type()
> > >
> > > On 6/7/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
> > > >
> > > > .__class__
> > > >
> > > > On 6/7/07, Lic. José M. Rodriguez Bacallao <[EMAIL PROTECTED]> wrote:
> > > > > how can I know insede a method the type of my class dynamicaly?
> > > > >
> > > > > --
> > > > > Lic. José M. Rodriguez Bacallao
> > > > > Cupet
> > > > >  >
> > > > >
> > > >
> > > > >
> > > >
> > >
> > > >
> > >
> >
> > >
> >
>
> >
>

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



Re: Graphs and django

2007-06-20 Thread Joseph Heck

I've been using FusionGraphs (flash based graphing, generating the
"data" through XML templates) with good success. It's not directly in
python using PIL or anything, but it's been quick and effective.

-joe

On 6/20/07, Gerry Steele <[EMAIL PROTECTED]> wrote:
>
> i was wondering if anyone had any experience integrating any python
> graphing or anything similar libraries into django and which library
> people might recommend.
>
> My needs are to create line, bar and pie charts.
>
>
> Many Thanks
> Gerry
> --
> Gerry Steele
> http://belfast.no-ip.info/
>
> >
>

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



Re: Using simplejson

2007-06-20 Thread Joseph Heck

If I understand correctly, that sounds reasonably doable - what is
your question? Taking JSON from whatever source and generating a form
in HTML is pretty much straight javascript and/or templating.

-joe

On 6/20/07, cess <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>I am very new to the Django framework, i have tried using free
> admin API , it works fine,so i  wanted to design my own page where i
> dont interact with database and dont create any models, i rather call
> an JSP page in my view which returns an JSON object, i want to convert
> it into a form which i can use to display in my template (i.e.,) in a
> form python form or something and access all different fields from
> that JSON result.
>
>
> >
>

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



Re: classes

2007-06-18 Thread Joseph Heck

x = '123'
x.__class__ will give a reasonable answer, x.type() doesn't. (Python 2.4)

If you can get away with using type(), it's probably a lot cleaner to use...

-joe

On 6/18/07, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
>
> or type()
>
> On 6/7/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
> >
> > .__class__
> >
> > On 6/7/07, Lic. José M. Rodriguez Bacallao <[EMAIL PROTECTED]> wrote:
> > > how can I know insede a method the type of my class dynamicaly?
> > >
> > > --
> > > Lic. José M. Rodriguez Bacallao
> > > Cupet
> > >  >
> > >
> >
> > >
> >
>
> >
>

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



Re: get subversion revision-number in a django-project

2007-06-15 Thread Joseph Heck

I don't know about Gabor, but I actually use it in a dashboard view on
my site to know what version of the software is deployed at any given
time. Very handy that way.

-joe

On 6/15/07, Udi <[EMAIL PROTECTED]> wrote:
>
> Mind if I ask why?
>
> Udi
>
>
> >
>

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



Re: newbie seeks relevant examples

2007-06-14 Thread Joseph Heck

Just so you're aware - switching from a Web Start application to
Django is a fairly significant change in how you attack some problems.
With WebStart, you have a full user interface API with Swing (or
whatever you're using) running in it's own JVM, and in Django you're
pushing this all into a browser and doing the web application
post-back-to-send-data sort of set up.

It's certainly not impossible to make this kind of conversion, and if
you're conversant in javascript and comfortable with Ajax style
programming (as Brian Luft alludes to), you can do quite a bit - but
there's a significant different metaphor in operation.

The djangoproject wiki has a number of links to sites
(http://code.djangoproject.com/wiki/DjangoResources) that include
source code. Djangoproject's site
(http://code.djangoproject.com/browser/djangoproject.com/django_website)
itself is available, and Jeff Croft has made some source available for
a couple of sites
(http://www2.jeffcroft.com/blog/2007/feb/25/two-new-django-sites-both-source-available/).

Not knowing more about the specifics of what you're trying to
accomplish, it's hard to point you in any better direction.

-joe

On 6/14/07, Sells, Fred <[EMAIL PROTECTED]> wrote:
> I've got a java webstart app that I would like to rebuild in django.  It is
> basicly a simple structured text editor where the user can select employees
> and update goals/scheduled tasks/accomplishments with some industry specific
> details that are not too important for this discussion.
>
> So I need some menu/selection capability and a series of identical text
> editor windows.  Not all that hard, but ...
>
> I would appreciate it if anyone could point me toward some sample web sites
> to get an idea of what can be done.  My searches so far have shown me alot
> of "newsletter" style web pages, but I need interactive user editors.
>
> Any pointers would be appreciated.
>
> ---
> The information contained in this message may be privileged and / or
> confidential and protected from disclosure. If the reader of this message is
> not the intended recipient, you are hereby notified that any dissemination,
> distribution or copying of this communication is strictly prohibited. If you
> have received this communication in error, please notify the sender
> immediately by replying to this message and deleting the material from any
> computer.
> ---
>
> >
>

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



Spread and Django

2007-06-13 Thread Joseph Heck

Has anyone investigated or used Spread (spread.org) as a messaging bus
between systems, either using Django or not?

I am looking for something to transport messages between systems -
basically a message queue mechanism. Spread seemed like it might do
the trick, and has some reasonable python libraries.

-joe

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



Re: How to set up full text field in models.py?

2007-06-07 Thread Joseph Heck

Nothing built in to Django enables that - you have to do it externally
to the Django framework.

On 6/7/07, Warvin Barker <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I can set up fulltext indices via MySql directly, but is there a way to do 
> this in models.py?
>
> Thanks!
>
> -Warren
>
> >
>

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



Re: classes

2007-06-07 Thread Joseph Heck

.__class__

On 6/7/07, Lic. José M. Rodriguez Bacallao <[EMAIL PROTECTED]> wrote:
> how can I know insede a method the type of my class dynamicaly?
>
> --
> Lic. José M. Rodriguez Bacallao
> Cupet
>  >
>

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



Re: Django Deployment Headache (Apache Permissions?)

2007-06-06 Thread Joseph Heck

Well, it certainly looks right. I guess my next step in debugging
would be to "act like the webserver" as much as possible to make sure
I didn't miss anything.

su - apache
cd /
export PYTHONPATH=/home/thebest/TheBest/alpha1
export DJANGO_SETTINGS_MODULE TheBest.settings
django-admin.py validate

and see what happens.

-joe

On 6/6/07, ATLBeer <[EMAIL PROTECTED]> wrote:
>
> Apache is running under the user/group apache
>
> I added chgrp'd apache to the directory (recursively) and chmod'd as
> well.
>
> Still the errors.
>
> I also added apache to the group bestx. This is the group that  the
> user 'thebest' belongs to.
>
>
>
> On Jun 6, 6:07 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> > What user does apache run as - set group read permissions (at least) to 
> > that.
> >
> > If you're using Ubuntu or Debian, it is likely "www-data", so the
> > following commands (as root) would do the trick:
> >
> > chgrp -R www-data /home/thebest/TheBest/
> > chmod -R g+r /home/thebest/TheBest/
> >
> > -joe
> >
> > On 6/6/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > I'm trying to push a beta build of an App I wrote to my Apache server
> > > but, I'm running into some problems (I'm pretty sure it's permission
> > > related)
> >
> > > Here's the details.
> >
> > > httpd.conf
> > > [code]
> > > 
> > >  SetHandler python-program
> > >  PythonPath "['/home/thebest/TheBest/alpha1'] + sys.path"
> > >  PythonHandler django.core.handlers.modpython
> > >  SetEnv DJANGO_SETTINGS_MODULE TheBest.settings
> > >  PythonDebug On
> > > 
> > > [/code]
> >
> > > /home/thebest/TheBest/alpha1/TheBest is the root of the Django project
> > > (contains __init__.py)
> >
> > > I can successfully run stuff like manage.py validate / shell /
> > > runserver
> >
> > > So I KNOW the App can see the settings but, when I try to load the web-
> > > side of it i get
> >
> > > [code]
> > > Mod_python error: "PythonHandler django.core.handlers.modpython"
> > > **snip**
> > > EnvironmentError: Could not import settings 'TheBest.settings'
> > > (Is it on sys.path? Does it have syntax errors?): No module named
> > > TheBest.settings
> > > [/code]
> >
> > > I know the paths are correct and everything is in the right place so
> > > I'm left thinking Apache just doesn't have the proper permissions
> > > here.
> >
> > > [code]
> > > [EMAIL PROTECTED] alpha1]# ls -al
> > > total 24
> > > drwxr-xr-x 3 thebest bestx 4096 Jun  6 15:31 .
> > > drwxr-xr-x 3 thebest bestx 4096 Jun  6 15:31 ..
> > > drwxr-xr-x 9 thebest bestx 4096 Jun  6 15:35 TheBest
> > > [/code]
> >
> > > [code]
> > > [EMAIL PROTECTED] TheBest]# ls -al
> > > drwxr-xr-x 9 thebest bestx 4096 Jun  6 15:35 .
> > > drwxr-xr-x 3 thebest bestx 4096 Jun  6 15:31 ..
> > > drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:35 CRON
> > > -rwxr-xr-x 1 thebest bestx   82 Jun  6 15:31 ._.DS_Store
> > > -rwxr-xr-x 1 thebest bestx 6148 Jun  6 15:30 .DS_Store
> > > drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:30 xapp
> > > -rwxr-xr-x 1 thebest bestx0 May 25 12:25 __init__.py
> > > -rwxr-xr-x 1 thebest bestx  141 May 29 17:48 __init__.pyc
> > > -rwxr-xr-x 1 thebest bestx  546 May 25 12:25 manage.py
> > > drwxr-xr-x 2 thebest bestx 4096 May 30 13:55 media
> > > drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:30 xapp
> > > drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:30 xapp
> > > drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:30 SCRIPTS
> > > -rwxr-xr-x 1 thebest bestx 4096 Jun  6 15:34 ._settings.py
> > > -rwxr-xr-x 1 thebest bestx 3169 Jun  6 15:34 settings.py
> > > -rwxr-xr-x 1 rootroot  2343 Jun  6 15:35 settings.pyc
> > > drwxr-xr-x 6 thebest bestx 4096 Jun  6 10:26 templates
> > > -rwxr-xr-x 1 thebest bestx 4382 Jun  6 15:32 ._urls.py
> > > -rwxr-xr-x 1 thebest bestx 2758 Jun  6 14:13 urls.py
> > > -rwxr-xr-x 1 thebest bestx 5259 Jun  6 14:14 urls.pyc
> > > [/code]
>
>
> >
>

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



Re: Django Deployment Headache (Apache Permissions?)

2007-06-06 Thread Joseph Heck

What user does apache run as - set group read permissions (at least) to that.

If you're using Ubuntu or Debian, it is likely "www-data", so the
following commands (as root) would do the trick:

chgrp -R www-data /home/thebest/TheBest/
chmod -R g+r /home/thebest/TheBest/

-joe

On 6/6/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I'm trying to push a beta build of an App I wrote to my Apache server
> but, I'm running into some problems (I'm pretty sure it's permission
> related)
>
> Here's the details.
>
> httpd.conf
> [code]
> 
>  SetHandler python-program
>  PythonPath "['/home/thebest/TheBest/alpha1'] + sys.path"
>  PythonHandler django.core.handlers.modpython
>  SetEnv DJANGO_SETTINGS_MODULE TheBest.settings
>  PythonDebug On
> 
> [/code]
>
> /home/thebest/TheBest/alpha1/TheBest is the root of the Django project
> (contains __init__.py)
>
> I can successfully run stuff like manage.py validate / shell /
> runserver
>
> So I KNOW the App can see the settings but, when I try to load the web-
> side of it i get
>
> [code]
> Mod_python error: "PythonHandler django.core.handlers.modpython"
> **snip**
> EnvironmentError: Could not import settings 'TheBest.settings'
> (Is it on sys.path? Does it have syntax errors?): No module named
> TheBest.settings
> [/code]
>
> I know the paths are correct and everything is in the right place so
> I'm left thinking Apache just doesn't have the proper permissions
> here.
>
> [code]
> [EMAIL PROTECTED] alpha1]# ls -al
> total 24
> drwxr-xr-x 3 thebest bestx 4096 Jun  6 15:31 .
> drwxr-xr-x 3 thebest bestx 4096 Jun  6 15:31 ..
> drwxr-xr-x 9 thebest bestx 4096 Jun  6 15:35 TheBest
> [/code]
>
> [code]
> [EMAIL PROTECTED] TheBest]# ls -al
> drwxr-xr-x 9 thebest bestx 4096 Jun  6 15:35 .
> drwxr-xr-x 3 thebest bestx 4096 Jun  6 15:31 ..
> drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:35 CRON
> -rwxr-xr-x 1 thebest bestx   82 Jun  6 15:31 ._.DS_Store
> -rwxr-xr-x 1 thebest bestx 6148 Jun  6 15:30 .DS_Store
> drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:30 xapp
> -rwxr-xr-x 1 thebest bestx0 May 25 12:25 __init__.py
> -rwxr-xr-x 1 thebest bestx  141 May 29 17:48 __init__.pyc
> -rwxr-xr-x 1 thebest bestx  546 May 25 12:25 manage.py
> drwxr-xr-x 2 thebest bestx 4096 May 30 13:55 media
> drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:30 xapp
> drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:30 xapp
> drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:30 SCRIPTS
> -rwxr-xr-x 1 thebest bestx 4096 Jun  6 15:34 ._settings.py
> -rwxr-xr-x 1 thebest bestx 3169 Jun  6 15:34 settings.py
> -rwxr-xr-x 1 rootroot  2343 Jun  6 15:35 settings.pyc
> drwxr-xr-x 6 thebest bestx 4096 Jun  6 10:26 templates
> -rwxr-xr-x 1 thebest bestx 4382 Jun  6 15:32 ._urls.py
> -rwxr-xr-x 1 thebest bestx 2758 Jun  6 14:13 urls.py
> -rwxr-xr-x 1 thebest bestx 5259 Jun  6 14:14 urls.pyc
> [/code]
>
>
> >
>

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



Re: robots.txt?

2007-06-05 Thread Joseph Heck

Yes, you'd set in something like:


   SetHandler None
 

(which is exactly what I've done)

-joe

On 6/5/07, Rob Hudson <[EMAIL PROTECTED]> wrote:
>
> I'm not using mod_rewrite currently (and may even have it turned off
> in Apache to save memory).  Is there another solution?
>
> I have my static media folder set in Apache with:
>
>   
> SetHandler None
>   
>
> Can you do the same for single files?
>
> Thanks,
> Rob
>
> On Jun 4, 8:12 am, KpoH <[EMAIL PROTECTED]> wrote:
> > You can "mod_rewrite" /robots.txt to /static/robots.txt for example
> >
>
>
> >
>

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



Re: problem representation

2007-06-04 Thread Joseph Heck

If it's the *same* information, then use a foreign-key relationship.
If it's different information, then it needs to be stored separately,
and defining that on the models is a good way of doing that.

You can shoot yourself in the foot by trying to re-use too much as
well as too-little. It is ultimatley a tradeoff choice that you need
to make for your own code.

-joe

On 6/4/07, Lic. José M. Rodriguez Bacallao <[EMAIL PROTECTED]> wrote:
> that is repeating a lot of common information about my models, what about
> DRY, reusing, etc?
>
> On 6/4/07, Joseph Heck < [EMAIL PROTECTED]> wrote:
> >
> > Maybe a foreign key relationship would work, but you might just
> > consider adding all those attributes to each model. Unless you think
> > you'll end with really sparse tables, it may be worth it for the
> > simplicity.
> >
> > You wouldn't want to use a one-to-one table for common elements among
> > different models.
> >
> > -joe
> >
> > On 6/4/07, Lic. José M. Rodriguez Bacallao <[EMAIL PROTECTED]> wrote:
> > > Hi for everyone. I'm stuck with django, I want to represent this
> situation:
> > >
> > > I have a lot of content types like, news, images, urls, etc. All of them
> > > have common attributres like creation date, expiration date, publication
> > > date, title and so on. The problem is how to represent this with django
> > > models so I don't have to repeat all of those attributes in all models.
> > > Until now, I represented this situation like a
> Generalization/Specialization
> > > relationship with a on-to-one relation but I don't want to use it due to
> > > this relation is going to change in future versions of django so, I
> don't
> > > know what to do, anyone could help me?
> > >
> > >
> > > --
> > > Lic. José M. Rodriguez Bacallao
> > > Informatics Science University
> > > Habana-Cuba.
> > >  >
> > >
> >
> >
>
>
>
> --
> Lic. José M. Rodriguez Bacallao
> Cupet
>
>  >
>

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



Re: query parameters for search

2007-06-04 Thread Joseph Heck

While it may look ugly, it's actually pretty effective - depending on
what you want to enable with search queries overlaid on URL's. If you
only had simple (i.e. one word) terms, you could write the query into
the URL itself, but I found that using a url like /search/ and then
appending on ?q=... and page=... was really about the most expedient
path.

-joe


On 6/4/07, Jiri Barton <[EMAIL PROTECTED]> wrote:
>
> What is the best way of adding query parameters (aka GET parameters)
> to a URL?
>
> return HttpRedirect(reverse('animal-search') + '?q=%s=%d' %
> (animal.name, current_page))
>
> seems awkward to me (not to mention escaping the name). How can I
> avoid creating query parameters manually? Or, should I avoid query
> parameters altogether? It seems every page is using query parameters
> in searches.
>
> And how should I create such URLs from within templates?
>
> Thank you,
> Jiri
>
>
> >
>

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



Re: Big app, big db, all users are authenticated

2007-06-04 Thread Joseph Heck

Another thing to keep an eye out for is referencing one model from
another  - when loading up the choices for something that has > 1000
possible associated objects, then system will take a while to pull all
those into place. Setting "raw_admin_id" in the model will help
alleviate this, but you loose some additional functionality as a
consequence.

Fundamentally, look at your queries to see how what's going on and
taking time. Maybe just a few indexes are needed, or it might help you
identify a coding mistake.

I frequently use the middleware snippet at
http://www.djangosnippets.org/snippets/264/ to assist here (had a
problem with our sitemap setup over the weekend I diagnosed with
that). I didn't create that middleware originally - found it on this
list. Sorry I can't tell you who created it originally.

-joe

On 6/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> On Jun 4, 3:48 pm, "and_ltsk" <[EMAIL PROTECTED]> wrote:
> > 1. 100MB per request - is it normal?
>
> not likely.  I have apache processes serving a couple of different
> sites within separate python interpreters and they are all somewhere
> in the 10-30MB memory range.
>
> Common gotcha: make sure you have DEBUG set to False, otherwise Django
> stores all executed SQL queries in memory.
>
> > 2. I can't use cache because one user receives cached response for another 
> > user. Did you know any solution for authenticated cache?
>
> You can set up caching per-session, look for  "vary_on_headers" and
> "Cookie" in the cache documentation.  But that greatly increases the
> cache size, of course.
>
> I prefer to cache template fragments, see 
> http://code.djangoproject.com/ticket/1065
> -- this way the parts that don't depend on logged-in user can be
> cached only once for the whole site and I still can cache fragments
> per-session.
>
> > 3. While any table growing, the responses became slower to 2-10 minutes. 
> > How to avoid the big dicts or use another another solution?
>
> Make sure you have indexes in the database.  Also, check your
> templates and code for "if big_queryset" instead of "if
> big_queryset.count" -- the former pulls all the data from the
> queryset, the latter does not.
>
> > For any performance tip thanks in advance.
>
> Point 3. looks like a hint there is something wrong with the way you
> pull data from the database.  Look into the queries, perhaps there is
> a large number of them or some of the queries download too much data.
>
> -mk
>
>
>
> >
>

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



Re: problem representation

2007-06-04 Thread Joseph Heck

Maybe a foreign key relationship would work, but you might just
consider adding all those attributes to each model. Unless you think
you'll end with really sparse tables, it may be worth it for the
simplicity.

You wouldn't want to use a one-to-one table for common elements among
different models.

-joe

On 6/4/07, Lic. José M. Rodriguez Bacallao <[EMAIL PROTECTED]> wrote:
> Hi for everyone. I'm stuck with django, I want to represent this situation:
>
> I have a lot of content types like, news, images, urls, etc. All of them
> have common attributres like creation date, expiration date, publication
> date, title and so on. The problem is how to represent this with django
> models so I don't have to repeat all of those attributes in all models.
> Until now, I represented this situation like a Generalization/Specialization
> relationship with a on-to-one relation but I don't want to use it due to
> this relation is going to change in future versions of django so, I don't
> know what to do, anyone could help me?
>
>
> --
> Lic. José M. Rodriguez Bacallao
> Informatics Science University
> Habana-Cuba.
>  >
>

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



Re: The Coding Is Wrong

2007-05-29 Thread Joseph Heck

Your question is far to vague for anyone here to help you. You need to
ask an explicit question, giving an example.

-joe

On 5/29/07, xzh <[EMAIL PROTECTED]> wrote:
>I am a rookie of Diango . I have problem.I wrote a template then
> test it in the browser, the coding was not I want . How can I settle
> this problem.
>  Thanks very much!
>
>
> >
>

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



Re: Best practice: How to test site using openid-only login

2007-05-29 Thread Joseph Heck

You might take a look at twill (http://twill.idyll.org/) - Although I
find it a tad trickier to get rolling with than Selenium, it has the
functionality that you want (emulating a browser, including cookies)
and can be 'programmed' to walk to an OpenID login site and back again
following redirects. You can think of it as a more complex/complete
version of the test client in Django.

If that doesn't suit, consider one of the browser automation engines -
Pamie, Samie, or Watir. Given that you're programming python already,
Pamie (http://pamie.sourceforge.net/) is probably of more interest.
It's basically driving "IE" on windows through it's COM interface.

-joe



On 5/29/07, Almad <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'd like to ask about best testing practice. I'm looking at test
> client in SVN, which looks great for most of cases and I can get rid
> of Selenium (great tool, but slow). TestClient looks promising, but I
> don't knew how to authorize(), when site is only using OpenID login.
>
> Any suggestions? (I'd like to use as less workaround/hacks as
> possible)
>
> Thanks,
>
> Almad
>
>
> >
>

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



Re: How to delete a session

2007-05-23 Thread Joseph Heck

Ah - right. The middleware returns that all wrapped up. You can use
the _session attribute on it to get down to the actual session object
(I think - at least based on a quick glance through the code).

So (I think)

x=request.session._session
x.delete()

-joe

On 5/23/07, Ramashish Baranwal <[EMAIL PROTECTED]> wrote:
>
> > On May 23, 10:18 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> >
> > > The session is a model in Django - so you can delete it like any other -
> >
> > > x=request.session
> > > x.delete()
> >
> > > There's also the daily_cleanup.py script included with Django that
> > > just goes straight to the 
> > > database:http://code.djangoproject.com/browser/django/trunk/django/bin/daily_c...
> >
> > Thanks Joe, but thats not working. I'm getting the following error-
> >
> > AttributeError
> > 'SessionWrapper' object has no attribute 'delete'
> > Exception Type: AttributeError
> > Exception Value:'SessionWrapper' object has no attribute 'delete'
>
> Sorry for the multiple postings. It was due to some network problem at
> my end.
>
> -Ram
>
>
> >
>

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



Re: Explicit SQL not working ...

2007-05-23 Thread Joseph Heck

When you're done with the command (assuming you're not being explicit
about the transactions), use:

 transaction.commit_unless_managed()

to force the commit.

-joe

On 5/23/07, ZebZiggle <[EMAIL PROTECTED]> wrote:
>
> More info ...
>
> I wrote a little program to execute the query directly via psycopg and
> it works fine. Even if I take this test code and put it in the running
> django code, it continues to work fine.
>
> The SQL is an UPDATE command, like
>
> UPDATE
> content
> SET
> "voteTotal" = "voteTotal" + 1,
> "voteCount" = "voteCount" + 1
> WHERE
> id = 25
>
> It seems like there something about the CursorWrapper or the
> DatabaseWrapper that is preventing the execute() from working ...
>
> I'm using 0.96 with DATABASE_ENGINE = 'postgresql' backend. Everything
> else about django works fine.
>
> anyone?
>
> -S
>
>
> >
>

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



Re: LIKE '%something%' custom queries

2007-05-23 Thread Joseph Heck

Don't put the % inside of " characters, or Python will attempt to
evaluate it out. Alternately, escape it so it doesn't eval. I
generally form up my custom SQL strings outside of the execute()
method to make debugging this kind of thing a tad easier.

-joe

On 5/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I'm reimplementing an in-database tree system and I'm using custom SQL
> queries. I want to use % in LIKE but Django doesn't let me.
>
> The code:
> ##
> def getBranch(table_name, parent_depth, parent_cutLevel, max_depth):
> cursor = connection.cursor()
> cursor.execute("SELECT *, INSTR(level,'0')-1 AS depth,
> INSTR(level,'0')-1 - "+ parent_depth +" AS relativeDepth FROM  " +
> table_name + " WHERE level LIKE '"+ parent_cutLevel +"%' AND
> INSTR(level,'0')-1 <= ("+ max_depth +"+"+ parent_depth +") ORDER BY
> level")
> row = cursor.fetchall()
> return row
> ##
>
> The exception:
> ##
> not enough arguments for format string
> Exception Location: /usr/lib64/python2.4/site-packages/django/db/
> backends/util.py in execute, line 19
> ##
> I can "print" the query string, but can't make the query as cursor
> code uses %letters... Is there a solution for this. ( \ doesn't work,
> % in variable also)
>
>
> >
>

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



Re: How to delete a session

2007-05-23 Thread Joseph Heck

The session is a model in Django - so you can delete it like any other -

x=request.session
x.delete()

There's also the daily_cleanup.py script included with Django that
just goes straight to the database:
http://code.djangoproject.com/browser/django/trunk/django/bin/daily_cleanup.py

-joe

On 5/23/07, Ramashish Baranwal <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> How can I delete the session of a request? The docs speak about using
> session as a dict and setting and removing specific keys on that, but
> I want to remove the session itself, something like del request.session
>
> Any ideas?
>
> Thanks in advance,
> Ram
>
>
> >
>

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



Re: Search options

2007-05-11 Thread Joseph Heck

We determined that Postgres was portable enough to any platform we'd
host on, and went with TSearch2 and have been pretty happy. Having
done hard-core search work in a previous life (www.singingfish.com), I
know it isn't everything you can get in the search world, but it was
sufficient for our needs. I personally feel that TSearch2 falls very
nicely between better than the simplistic "like"+wildcard SQL
statements and a sophisticated indexing engine like Lucene.

If you're willing to go "search server", you might even consider SOLR
(lucene based search server with a web api). Especially if you scale
out your front end's (the django app servers) horizontally in a large
environment, it becomes appealing. How many front-end's you have
actually becomes something to seriously consider, because the likes of
PyLucene, Xapian, and others all have search related indices that then
need to be kept up to date and available to the searcher processes.



On 5/11/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
>
> On 5/11/07, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
> >
> > - Am I doomed to have a separate server? This complicates things a lot
> > and I very much inclined to use some in-process thing
>
> Probably. :)
>
> > - Are there any solutions on a scale between simplistic "likes" and
> > sophisticated indexers like Lucene?
>
> http://www.osreviews.net/reviews/misc/hyperestraier
> http://cheeseshop.python.org/pypi/estraiernative/0.2
>
> http://swish-e.org/
> http://cheeseshop.python.org/pypi/Swish-E/0.5
>
> >
>

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



Re: How well should I know Python before using Django?

2007-05-09 Thread Joseph Heck

Beginner, at least in my opinion. YMMV.

On 5/9/07, walterbyrd <[EMAIL PROTECTED]> wrote:
> Before attempting to use Django, a person should have a Python
> programming skill level of:
>
> 1) beginner
> 2) intermediate
> 3) expert
>
> To use Django, a developer should have an  exceptionally strong
> knowledge of the following area(s) of Python: __
>
>
> >
>

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



Re: Scalability / Traffic-Volume Numbers

2007-05-09 Thread Joseph Heck

Back in February, TrenchMice was hit with a reasonable load from a
front-page Slashdot article, and they wrote it up at
http://www.cogitooptimus.com/2007/02/11/wow-we-made-it/

I helped them with some load testing before the site ever went live,
and it looked to be able to handle it with aplomb. They are making use
of memcached and anonymous view caching, by the way.

-joe

On 5/9/07, Jimmy <[EMAIL PROTECTED]> wrote:
>
> I am trying to get good stats for sites run off of Django to prove that
> Django can really be a business solution and can scale well.
>
> So far the only good articles I have found are:
> http://wiki.rubyonrails.com/rails/pages/Framework+Performance
> http://www.alrond.com/en/2007/jan/25/performance-test-of-6-leading-frameworks/
>
> Does anyone know of any other posts about this topic? or if you run a
> big Django website and would care to share your Traffic Load and Server
> Setup with me that would be awesome.
>
> Jimmy
>
> >
>

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



Re: Issue with database Postgresql :(

2007-05-08 Thread Joseph Heck

Using django syncdb is fine - just make sure the database itself is
set up with utf-8 encoding. I used that very command just prior to
running "django-admin.py syncdb"

You might check the archives of this group for similiar topics - I
recall seeing discussion on this previously, and I think they had some
good pointers on "how to tell" and "what to do when it wasn't".

-joe

On 5/8/07, Gerard M <[EMAIL PROTECTED]> wrote:
>
> Well I did not create the table myself on postgreSQL, I used django
> manage.py syncdb and that created my database from my models, and I
> have to build it like that because thats the way I access to the
> tables too, so I need to find a way to alter them or to set a
> collation or to change the "client_encoding" but I have no idea :
> ( thanks for your kind help.
>
>
> >
>

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



Re: Issue with database Postgresql :(

2007-05-08 Thread Joseph Heck

You need to deal with whatever encoding the file is in. But you're
also running out of my area of knowledge in regards to text encodings.

-joe

On 5/8/07, Gerard M <[EMAIL PROTECTED]> wrote:
>
> Thanks for all your help guys, but I'm facing another little thing
> here, if I'm getting the word from a file (this means I'm not typing
> the word directly into the code), for example:
>
> for line in textf:
>
> tempwords = line.split(None)
>
> for c in range(len(tempwords)):
>
> if c == 0:
>
> st = tempwords[c]
>
> where st is the word I'm getting from the file, how do I tell python
> that my variable st has a unicode string, I cant type st =
> u'tempwords[c]' because that would be the unicode representation of
> the string between the quotes, is there any other way to do this?
>
> thank you
>
>
> >
>

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



Re: problems with spawning new subprocesses with development server

2007-05-08 Thread Joseph Heck

Sounds cool to me. If you come up with a solution thats lightweight,
I'd be very interested to know what you used and what it took to set
up.

-joe

On 5/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Ok, in your case I would (and actually am) rather use some kind of
> batching system (torque in my case).
> But the problem is that I would very much have a version of the
> system, when only one machine is available that would do all the work
> on the background with perhaps some lower priority. And it seems
> really strange that it's not a trivial task just to spawn a child
> process and continue the parent. I have a feeling that it is still
> perfectly doable.
>
> Ilja
>
> On May 8, 8:01 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> > For a light (i.e. short) duration process that you want results from
> > to return to the user, it's fairly straightforward. Here's some code
> > we're using to report our current code revision in an admin dashboard:
> >
> > def get_code_revision():
> > import os
> > x = os.popen("/usr/bin/svnversion /u/django/webcode")
> > versionstring = x.readline()
> > x.close()
> > return versionstring.strip()
> >
> > For spawning a longer running background process (as you mention
> > towards the end), this really isn't an appropriate mechanism. Instead
> > look for something where you can pass a "do this" message to another
> > mechanism that will do the work in the background. In our case, we
> > have a number of what we've terms "out of band" processing, and we use
> > simple tokens in the database as a quick and dirty message system. So
> > the view method will insert a row in the database, and a background
> > process will periodically poll the database for any rows to process.
> > It's not suitable to really high bandwidth messaging needs, but it
> > works nicely for us.
> >
> > Alternately, you can come up with some mechanism that is more "event
> > like" and asynchronous.
> >
> > -joe
> >
> > On 5/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> > > I've spent quite a lot of time trying to simply spawn a new process
> > > (by spawn I mean os.P_NOWAIT). The problem is that I cannot manage to
> > > get django not to halt after the execution of the process spawning
> > > command (the idea is that in views I want to start a background
> > > process that is quite time intense).
> >
> > > I've tried os.spawnl and subprocces.Popen, neither work. Or I'm just
> > > too n00b in Python and Django to understand how they should be
> > > handled. Perhaps anybody could help me? Pleease?
> >
> > > Thanks,
> > > Ilja
>
>
> >
>

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



Re: Issue with database Postgresql :(

2007-05-08 Thread Joseph Heck

You'd want to write that as

w = u'ataché'

to make sure python knew you were pushing out a unicode string, but an
ASCII string.

-joe

On 5/8/07, Gerard M <[EMAIL PROTECTED]> wrote:
>
> Thanks for your help Rafael, but I got into another trouble trying to
> encode my string like this;
> I have the unicode string in a variable lets say w = ataché, how can I
> tell python/django that the string "w" is a unicode string and how can
> I make the encoding, because If I type
> w.encode('utf-8'), in my views file I get this error:
>
> "UnicodeDecodeError: 'ascii' codec can't decode byte at position"
>
> thanks for your help.
>
>
> >
>

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



Re: Using Django Models outside of Django

2007-05-08 Thread Joseph Heck

Generally outside and prior to any thread initiation should be fine.

-joe

On 5/8/07, johnny <[EMAIL PROTECTED]> wrote:
>
> Since I have my code in threaded manner, do I have to put the
> following code inside threaded function or outside?
>
> from os import environ
> environ['DJANGO_SETTINGS_MODULE'] = 'settings'
>
> from settings import *
>
>
> >
>

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



Re: Issue with database Postgresql :(

2007-05-08 Thread Joseph Heck

when you created your database, did you set the encoding to UTF-8?

When we set up our database, we used:
createdb -E='utf-8' -Upostuser databasename

I'm not familiar enough to Postgres to know if you can convert the
encoding of a database after it's been created.

-joe

On 5/8/07, Gerard M <[EMAIL PROTECTED]> wrote:
>
> Hello dear django community, I'm having a bad time with an issue that
> I haven't been able to solve with my database, the problem is this:
> Whenever I try to save a word containing "special" characters in it
> (for example áéíóú) I get the following django error:
> "invalid byte sequence for encoding "UTF8": 0xe92020 HINT: This error
> can also happen if the byte sequence does not match the encoding
> expected by the server, which is controlled by "client_encoding"."
> I know that I need to set something to my database/table but I dont
> know where or how to achieve this, when I type" show;" at the
> postgresql shell it tells me that my database is UTF-8 encoding.
>
> I solved a problem like this in MySQL with the following commands:
>
> alter database  character set utf8 collate utf8_general_ci;
> alter table  convert to character set utf8 collate
> utf8_general_ci;
>
> I dont know if something like this exists in postgresql, or if there
> is something else I can do or I should be doing, thanks for your help,
> and your time for reading this post.
>
>
> >
>

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



Re: problems with spawning new subprocesses with development server

2007-05-08 Thread Joseph Heck

For a light (i.e. short) duration process that you want results from
to return to the user, it's fairly straightforward. Here's some code
we're using to report our current code revision in an admin dashboard:

def get_code_revision():
import os
x = os.popen("/usr/bin/svnversion /u/django/webcode")
versionstring = x.readline()
x.close()
return versionstring.strip()

For spawning a longer running background process (as you mention
towards the end), this really isn't an appropriate mechanism. Instead
look for something where you can pass a "do this" message to another
mechanism that will do the work in the background. In our case, we
have a number of what we've terms "out of band" processing, and we use
simple tokens in the database as a quick and dirty message system. So
the view method will insert a row in the database, and a background
process will periodically poll the database for any rows to process.
It's not suitable to really high bandwidth messaging needs, but it
works nicely for us.

Alternately, you can come up with some mechanism that is more "event
like" and asynchronous.

-joe



On 5/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I've spent quite a lot of time trying to simply spawn a new process
> (by spawn I mean os.P_NOWAIT). The problem is that I cannot manage to
> get django not to halt after the execution of the process spawning
> command (the idea is that in views I want to start a background
> process that is quite time intense).
>
> I've tried os.spawnl and subprocces.Popen, neither work. Or I'm just
> too n00b in Python and Django to understand how they should be
> handled. Perhaps anybody could help me? Pleease?
>
>
> Thanks,
> Ilja
>
>
> >
>

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



Re: How do you get at a RadioFieldRenderer object from a template? (newforms)

2007-05-07 Thread Joseph Heck

Interesting solution Bill! Thanks for sharing! I'll see if I can't
make that mechanism work for me...

Malcolm's response was also great in detail, and now I think I need to
digest some and see how I can use it, and if there's a good generic
solution for me.

-joe

On 5/7/07, Bill Fenner <[EMAIL PROTECTED]> wrote:
>
> I did this with an accessor function in the form class:
>
> class NonWgStep1(forms.Form):
> add_edit = forms.ChoiceField(choices=(
> ('add', 'Add a new entry'),
> ('edit', 'Modify an existing entry'),
> ('delete', 'Delete an existing entry'),
> ), widget=forms.RadioSelect)
> def add_edit_fields(self):
> field = self['add_edit']
> return field.as_widget(field.field.widget)
>
> Then in the template, I can use form.add_edit_fields.0, etc.
>
> I am using this in the (probably not uncommon) case of having other
> form elements that go with each radio button (e.g., "modify" has a
> ChoiceField of things to modify next to it).
>
>   Bill
>
> >
>

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



Re: is this a template bug?

2007-05-07 Thread Joseph Heck

My first thought is "what's in {{ item.inleiding }}". If it included
the , then it would be displayed when you rendered that down.

Do something like:


{{ item.inleiding|escape }}


to isolate that element and see what "pops out".

On 5/7/07, Enquest <[EMAIL PROTECTED]> wrote:
>
> Consider the following code
>
>   9 {% for item in news %}
> 10 
> 11 {{ item.titel }}
> 12 
> 13 {{ item.inleiding }}  href="/in-de-pers/{{ item.slug }}/">  lees meer
> 14 
> 15 
> 16 {% endfor %}
>
>
>
> The template result in the browser is:
>
> 
> testf
> 
> jfklsdjkfsfjsjfksklfdsfsdfsdfssfsfsdfs
>  › lees meer
> 
>
> The "lees meer" a href is printed outside the  tags... How can
> this be... Clearly the code places it inside the  yet "a href" is
> outside...
> The text is "jklsjkfjksl" is made with tinymce for each enter it places
>  but even then there should be a  tag on the end.
>
> If I however replace the inner  with  then this problem does
> not occur.
>
> What could be the cause of this problem.
>
> thanks,
> Enquest
>
>
>
> >
>

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



Re: Translation of class names

2007-05-07 Thread Joseph Heck
Do you want your site to be mixed language, or always in Russian?

Assuming you want the first, there's good instructions at
http://www.djangoproject.com/documentation/i18n/.

Make sure you have the middleware included and running, and then take
advantage of the url/view setup to explicitly change the language -
it's detailed near the bottom of those instructions.

Finally, a reasonable debugging step is to look at the "request"
object when it's processing through your views and see what it's
reporting as the language that it is using.

On 5/7/07, Konstantin Pavlovsky <[EMAIL PROTECTED]> wrote:
>
> up!
> nobody used i18n things?
>
>
> On 3 май, 16:05, Konstantin Pavlovsky <[EMAIL PROTECTED]>
> wrote:
> > hi all
> >
> > I am working with administrative interface. and want to make it
> > "speak" russian
> > if it possible to translate names of Classes using i18n things?
> >
> > ive translated field lables with lazy gettext
> >
> > [code]
> > manager = models.ForeignKey(User,verbose_name=_("Manager"))
> > ordertext = models.TextField(_("Order contents"))
> > order_date = models.DateTimeField(_("Order date"))
> > client_name = models.CharField(_("Client"),maxlength=255)
> > order_state = models.ForeignKey(OrderStates,verbose_name=_("Order
> > state"))
> > [/code]
> >
> > i see them in russian.it works
> > now i want modules to be called in russian.
> > i added
> > [code]
> > class Meta:
> > verbose_name = _('Order')
> > verbose_name_plural = _('Orders')
> > [/code]
> >
> > Now a have module called Oders in index page of administrative
> > interface
> > I have ran make-messages , then putted nessesary frazes for Order and
> > Orders (which appeared after i added those 2 lines above) and ran
> > compile messages, but still no russian words appeared. i still have
> > Orders instead of translation. And again - Descriptions for fields are
> > working fine.
> > i have this import above all
> > [code]
> > from django.utils.translation import gettext_lazy as _
> > [/code]
> >
> > I need some advice here:) thanx
> > P.S.
> > I have svn trunk from 26 of april this year.

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



Re: Need some help with Amazon S3

2007-05-07 Thread Joseph Heck

No idea about question #2 - it was my impression that S3 was a
stateless mechanism and didn't support the concept of streaming, but I
haven't read all that much about it, so I could easily be wrong.

#1 is probably best resolved by taking advantage of the S3 REST
interface and plugging that in to your code as desired. There's
nothing to my knowledge that uses S3 as a straight database backend
mechanism for the Django models - so anything you do there will likely
be custom code adding on as you specifically need it.

I don't know if I'd push that into a model myself -  maybe an instance
method that retreived the values you needed as desired?  Depending on
your needs, just doing some light custom code that can be invoked from
any view and makes agressive use of caching to pull down the values
you want is probably how'd I would initially try to tackle it. If you
allowed updating of that image through your site, then you could also
take advantage of that interface to invalidate the local cache of any
images and push in your newly updated pieces.

-joe

On 5/6/07, Sam Purtill <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am doing two things with Amazon S3:
>
> 1) Storing images/thumbnails for user profile pictures. Uploading 1
> picture and resizing it to 4 different sizes so I can grab those
> easily on different pages.
>
> 2) Allowing users to upload documents.
>
> I have two questions about doing this
>
> 1) What is the most logical way to set up your data models so I can
> retrieve the data from the S3 service as fast as possible?
>
> 2) How do I open a stream to the S3 service when a user is signed in?
> I want to be able to have a connection with the service that doesn't
> close until the user closes his/her browser if possible. If there is
> another way, such as opening a connection each page, that would be
> fine. Whichever is fastest.
>
> Thanks in advance,
>
> Sam
>
>
> >
>

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



Re: CSS

2007-05-07 Thread Joseph Heck

The same way you'd include CSS in any general HTML file, there's
nothing magic happening there with Django.

We use both:



in the header, and:





- whatever makes the most sense for you, have at. We take advantage of
{{ media_url }} in ours to point to our static media server, but you
can also hardcode in whatever makes sense for you.

-joe

On 5/6/07, umesu <[EMAIL PROTECTED]> wrote:
> How to include CSS file with template

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



Re: How to render newforms dynamically created fields?

2007-05-06 Thread Joseph Heck

Thanks Malcolm.

Actually - I didn't know the answer until long after I'd posted it.
And I really appreciate you providing some guidance. I'm going to post
up some slight mods to the current documentation files to try and help
folks following on the same path - the usage from the templates seems
obvious once you know it, but a real pain to figure out before that.

-joe

On 5/6/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> Hey Joe,
>
> On Sun, 2007-05-06 at 21:13 -0700, Joseph Heck wrote:
> > Actually, my example is sort of specific. I got the above working, but
> > ran into the next stumbling block with with a radioSelectField setup.
>
> So I answered the question you asked, although you knew the answer
> anyway. You have bread, you have butter and now you want jam as well??
> Jeez... some people are hard to please. :-)
>
> > I posted a separate question about it, since it wasn't really about
> > this thread. But to recap - once I get a BoundField that's the result
> > of a ChoiceField and a RadioSelect widget, I don't seem to be able to
> > get into the guts of that component.
>
> Yeah, I saw that thread. I'll respond there when I have a chance to look
> at it in order to keep related posts within a single thread.
>
> Regards,
> Malcolm
>
>
>
> >
>

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



Re: How to render newforms dynamically created fields?

2007-05-06 Thread Joseph Heck

Missed that final link:

http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L643

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



Re: How to render newforms dynamically created fields?

2007-05-06 Thread Joseph Heck

Actually, my example is sort of specific. I got the above working, but
ran into the next stumbling block with with a radioSelectField setup.
I posted a separate question about it, since it wasn't really about
this thread. But to recap - once I get a BoundField that's the result
of a ChoiceField and a RadioSelect widget, I don't seem to be able to
get into the guts of that component.

Printing it results in the standard:





sort of setup. What I'd like to be able to do is get ahold of each of
those ... components separately. It looks from the regression
tests that I should be able to somewhere use blah.field_list to get a
list of these pieces, much like the older forms setup. I haven't
figured out the path to use to get there though.
{{form.choice.field_list}} doesn't return anything iterable in the
template.

The regression test I was using as the basis to try and dive in here is:

http://code.djangoproject.com/browser/django/trunk/tests/regressionte...




On 5/6/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> On Sat, 2007-05-05 at 23:13 -0700, Joseph Heck wrote:
> > A site I frequently work with has the forms mostly laid out using 
> > and CSS to style it up all nicely. The newforms doesn't have a as_dl
> > method, and my designer is pitching a bit of fit that we can't give
> > him the pieces/parts of the form to lay out with a more complex setup.
> >
> > When I looked into it, I saw that some patches to generate "as_dl"
> > methods on newforms had been turned down. (Fine, we can add that too a
> > subclass and work around it). I think I'm missing something about how
> > I can hand the layout control to the designer though - telling them to
> > just deal with what {{ form.as_ul }} about got my teeth kicked in.
> >
> > Is it expected that with any newforms form object you'll be able to
> > reference it in the template with something like:
> >
> > {% for field in form %}
> >   {{ field.label }} {{ field }}
> > {% endfor %}
>
> Yes, that should always work.
>
> The key classes to look at in the source are newforms.forms.BoundField
> (which is what you are really working with as "field" in the above
> sample) and newforms.fields.Field, which is what BoundField wraps up.
> Both have fairly useful docstrings in the classes. I guess the various
> newforms.widgets.* and newforms.extras.widgets.* classes are of
> interest, too.
>
> >
> > And does anyone have some examples where the newforms are worked up to
> > any extent in templates? I need to learn what we can do, and I'm
> > having a hard time finding many references to using newforms from
> > inside of templates.
>
> I don't (what with having all the artistic talent of a clay brick and
> all), but once you've worked out your little fragment above, what are
> the bits that are still providing difficulties? I appreciate that some
> people prefer working from examples, rather than theory, so that may be
> the motivation behind your question. However, if there are some parts
> that are particularly tricky to work out from looking at a couple of
> classes in the source, please point them out.
>
> Regards,
> Malcolm
>
>
> >
>

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



Re: Mac OS X + Django; how do I invoke the fcgi?

2007-05-06 Thread Joseph Heck

It is, if you are using the stock MacOS X server setup. Two versions
of python will definitely get things a bit messed up.

Your best bet is to check your PATH and see which one comes first.
When you run the development server on port 8000, which python is it
using? For consistency, if nothing else, you should be using the same
version of python for both development and running the project under
fastcgi

-joe

On 5/6/07, Mark Phillips <[EMAIL PROTECTED]> wrote:
>
> On May 5, 2007, at 11:04 PM, Joseph Heck wrote:
>
> > Post what you have as your PYTHONPATH and the urls.py that you're
> > having trouble with, we'll nail it down.
>
> Thank you for the assistance, Joe.
>
> "myapp" is the django project.
>
> ['/usr/local/myapp',
> '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
> packages/Django-0.95.1-py2.4.egg',
> '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
> packages/setuptools-0.6c5-py2.4.egg',
> '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
> packages/flup-0.5.dev_r2311-py2.4.egg',
> '/Library/Frameworks/Python.framework/Versions/2.4/lib/python24.zip',
> '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4',
> '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/plat-
> darwin',
> '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/plat-
> mac',
> '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/plat-
> mac/lib-scriptpackages',
> '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/lib-
> tk',
> '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/lib-
> dynload',
> '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
> packages']
>
> I posted another today, "django.loc/admin is not found". In I
> describe a circumstance that makes me wonder if the fast cgi is
> invoking python 2.3 instead of 2.4.
>
>   - Mark
>
> >
>

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



  1   2   3   >