Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Best practices with Django?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
gordon pendleton  
View profile  
 More options Oct 20 2011, 4:35 pm
From: gordon pendleton <wgordo...@gmail.com>
Date: Thu, 20 Oct 2011 16:35:05 -0400
Local: Thurs, Oct 20 2011 4:35 pm
Subject: Best practices with Django?

Hi,

I am finally getting around to toying with pyjamas for the first time.  I
have never used GWT which this is based on either.  I really like the django
framework so I am going to use it as the pyjamas backend.

Before you read this whole long mail, feel free to point me to the docs if I
have missed something.  I've read through the GWT documentation and
everything I could find on pyjamas, but this is my first few hours with
pyjamas so I am completely new to this.

So on that topic, are there quirks I should know about for using Django as
the backend?  I've worked through the basic GWT stockwatcher intro app with
the help of pyjamas-django-pure-win<http://www.derekschaefer.net/2011/02/08/pyjamas-django-pure-win/>.
What I am looking for now is tips on the best way to setup the integration.

I am trying to figure out the best way to setup the urls.py file.  From what
I have seen with the demos, the pyjamas app expects StockWatcher.html,
StockWatcher.ie6.cache.html, StockWatcher.XYZ.cache.html, etc to be
available from the same directory url.  Is this a requirement, or just a
simplification for the demo?  It seems to me that the main html file,
StockWatcher.html, would be considered my django template file which would
be processed by django template engine to fit the application in with the
site style.  This template file would also provide fallback for users
without javascript.  I gather that the rest of the html files are loaded by
the javascript code and I would not bother those, only serve them as static
files.  How do I tell the pyjamas app where to find those files so that I
can serve them as static files and not through django?

For example, I typically use a static file manager to handle all of my media
files (django-mediagenerator<https://bitbucket.org/wkornewald/django-mediagenerator/>is
my favorite so far) which would typically handle cache busting, url
retrieval, etc...  Is there an easy way to hook into the url providers to
query mediagenerator for the url to reach StockWatcher.nocache.html,
StockWatcher.ie6.cache.html, or any of the other static files?

It would get very tedious to do this by hand each time the code has to be
recompiled, so I am guessing it is possible.  Also, I just read through the
backends for mediagenerator and it seems to already have one for pyjs.
Neat.  I don't know how it works yet because it doesn't seem to be
documented.  I'll have to see if I can get it to work.

Thanks,
Gordon


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Kenneth Casson Leighton  
View profile  
 More options Oct 20 2011, 4:44 pm
From: Luke Kenneth Casson Leighton <luke.leigh...@gmail.com>
Date: Thu, 20 Oct 2011 21:44:43 +0100
Local: Thurs, Oct 20 2011 4:44 pm
Subject: Re: Best practices with Django?

 yes i've done that before.

> This template file would also provide fallback for users
> without javascript.  I gather that the rest of the html files are loaded by
> the javascript code and I would not bother those, only serve them as static
> files.

 correct.

> How do I tell the pyjamas app where to find those files so that I
> can serve them as static files and not through django?

 you need to get more involved with how django operates.

> For example, I typically use a static file manager to handle all of my media
> files (django-mediagenerator is my favorite so far) which would typically
> handle cache busting, url retrieval, etc...  Is there an easy way to hook
> into the url providers to query mediagenerator for the url to reach
> StockWatcher.nocache.html, StockWatcher.ie6.cache.html, or any of the other
> static files?

 the urls system works on pattern-matching.  so you can do one
specific line for the file you intend to serve via django templates,
then the rest fall through to "static".

 take a look at djangoweb and djangopages examples. .... oi!  who
bloody moved the django web examples into misc!!  grrr

 ok, yes, take a look at examples/misc for the various django examples
there, ok?

 l.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Waldemar Kornewald  
View profile  
 More options Oct 20 2011, 4:45 pm
From: Waldemar Kornewald <wkornew...@gmail.com>
Date: Thu, 20 Oct 2011 22:45:46 +0200
Local: Thurs, Oct 20 2011 4:45 pm
Subject: Re: Best practices with Django?
Hi Gordon,

On Thu, Oct 20, 2011 at 10:35 PM, gordon pendleton <wgordo...@gmail.com> wrote:
> For example, I typically use a static file manager to handle all of my media
> files (django-mediagenerator is my favorite so far) which would typically
> handle cache busting, url retrieval, etc...  Is there an easy way to hook
> into the url providers to query mediagenerator for the url to reach
> StockWatcher.nocache.html, StockWatcher.ie6.cache.html, or any of the other
> static files?

> It would get very tedious to do this by hand each time the code has to be
> recompiled, so I am guessing it is possible.  Also, I just read through the
> backends for mediagenerator and it seems to already have one for pyjs.
> Neat.  I don't know how it works yet because it doesn't seem to be
> documented.  I'll have to see if I can get it to work.

It actually is documented in a series of tutorials:
http://www.allbuttonspressed.com/projects/django-mediagenerator#tutor...

The only difference is that mediageneator only supports the pyjs
compiler, not the pyjamas framework. You can combine pyjs with jQuery
or any other framework if you want. That's the solution we use at our
company.

If you want to use pyjamas I'm afraid you won't be able to use
mediagenerator for the JavaScript part (but I'd still be happy if you
continue to use it for CSS/Sass/etc. ;). Alternatively, you might try
to integrate the pyjamas build system into mediagenerator by
implementing a custom filter (maybe extending the existing pyjs
filter).

Bye,
Waldemar Kornewald

--
Django on App Engine, MongoDB, ...? Browser-side Python? It's open-source:
http://www.allbuttonspressed.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gordon pendleton  
View profile  
 More options Oct 20 2011, 4:51 pm
From: gordon pendleton <wgordo...@gmail.com>
Date: Thu, 20 Oct 2011 16:51:47 -0400
Local: Thurs, Oct 20 2011 4:51 pm
Subject: Re: Best practices with Django?

On Thu, Oct 20, 2011 at 4:44 PM, Luke Kenneth Casson Leighton <

I will check them out.  Thanks

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gordon pendleton  
View profile  
 More options Oct 20 2011, 5:00 pm
From: gordon pendleton <wgordo...@gmail.com>
Date: Thu, 20 Oct 2011 17:00:58 -0400
Local: Thurs, Oct 20 2011 5:00 pm
Subject: Re: Best practices with Django?

On Thu, Oct 20, 2011 at 4:45 PM, Waldemar Kornewald <wkornew...@gmail.com>wrote:

Hey Waldemar,

Fancy seeing you here hah.  Once I get a feel for pyjamas I will probably
work on some sort of integration with mediagenerator if I will use it
frequently.

Thanks,
Gordon


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gordon pendleton  
View profile  
 More options Oct 20 2011, 5:31 pm
From: gordon pendleton <wgordo...@gmail.com>
Date: Thu, 20 Oct 2011 17:31:22 -0400
Local: Thurs, Oct 20 2011 5:31 pm
Subject: Re: Best practices with Django?

On Thu, Oct 20, 2011 at 4:44 PM, Luke Kenneth Casson Leighton <

luke.leigh...@gmail.com> wrote:
> > ok, yes, take a look at examples/misc for the various django examples
> >there, ok?

Those were very helpful. The djangowanted and djangoweb are what I was
looking for.  I just needed that basic set up.  I feel silly for missing the
misc folder.

Thanks again,
Gordon


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Juergen Schackmann  
View profile  
 More options Oct 20 2011, 5:32 pm
From: Juergen Schackmann <juergen.schackm...@googlemail.com>
Date: Thu, 20 Oct 2011 23:32:48 +0200
Local: Thurs, Oct 20 2011 5:32 pm
Subject: Re: Best practices with Django?

Hi Gordon,
I have played a little bit with pyjs and django, so hopefully can answer
some of your questions, if you could make them more specific.

My general setup was:
1. Create your pyjs app and compile it, i.e. generate the html page and the
js files usually in the output directory.
2. Serve the results from 1 as static media (either via the django
staticfiles app or mediagenerator, both do the job)
3. If need should be (which usually is the case), create a json rpc
interface in django (there is a good example in the pyjs examples).

I also tried a deeper integration between django and pyjs, but realized that
with my knowledge, this would be quite tought ...

Happy to answer any further questions
Regards,
Juergen

2011/10/20 gordon pendleton <wgordo...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gordon pendleton  
View profile  
 More options Oct 20 2011, 5:55 pm
From: gordon pendleton <wgordo...@gmail.com>
Date: Thu, 20 Oct 2011 17:55:59 -0400
Local: Thurs, Oct 20 2011 5:55 pm
Subject: Re: Best practices with Django?

On Thu, Oct 20, 2011 at 5:32 PM, Juergen Schackmann <

Juergen,

Thanks for the response.  The examples Luke pointed me to that I had missed
have given me a good starting point.  If I run into any more gotchas I will
definitely be more specific.  I just need to fool around with pyjamas for
awhile before I ask any more silly questions.

Gordon


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »