Re: New Relic with Django

2012-01-03 Thread Brian Bouterse
Make sure you look at the pricing.  A local startup was very pleased with
what new relic's capabilities with Django, but then they looked at the
price ... wow.

On Tue, Jan 3, 2012 at 4:39 AM, Abhaya Thapa <abhaya.th...@sproutify.com>wrote:

> Hi,
> I am trying to get stated with new relic on my django app. I am new to
> new relic. Can you please guide me on steps to get started in
> developer mode and how to use it in live server.
> I did try to find tutorials on this, but it looks like I could not
> find a good one.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Question on cleaning ModelForms

2011-10-17 Thread Brian Bouterse
I've done it before using a post save signal, although I had lat,lng = NULL
in the schema so that differs from your request here.  After saving, I would
issue an update.  I forget why I didn't use a pre-save signal.

Aside from signals, you may also be able to use a model field default with a
callable to set the lat/lng of the FarmersMarket object.  It's an idea I
haven't tested, so I'm not positive it will work.

You could write some geocoding middleware that sets request.POST data in
some way as it passes through.  I don't really like this solution since it
is kind of "magical."

Brian

On Mon, Oct 17, 2011 at 3:30 PM, Jeff Heard <jefferson.r.he...@gmail.com>wrote:

> class FarmersMarket(ModelForm):
>   class Meta:
>  model = models.FarmersMarket
>  exclude = ('location',)
>
>   def clean(self):
>  place, (lat, lng) = _g.geocode(self.cleaned_data['address'])
>  self.cleaned_data['location'] = Point(lng,lat)
>  return self.cleaned_data
>
> 
>
> Here's my code minus the exception handling.  Now what I *want* to
> have happen is that the models.FarmersMarket.location field on the
> model is set sometime shortly after the form is submitted by the user,
> by way of geocoding the data, rather than having them tediously enter
> a POINT wkt string in the textarea field.  So my idea was to put a
> call to geopy.Google.geocode in FarmersMarket.self.clean.  I can
> confirm clean() is getting called, but for some reason, the 'location'
> field isn't being set in the model.  I get a whine from Django that
> the location field cannot be NULL (which is true, it can't).
>
> Can anyone tell me how I'm supposed to be doing this? I want them to
> enter an address on the form, not a latitude/longitude pair.
>
> -- Jeff
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Thread-safeness of templates

2011-10-05 Thread Brian Bouterse
To add to your example.  Default arguments are parsed once by the
interpreter, not each time the program is run.  Most folks don't desire side
effects like this.  One way to avoid it is to only use immutable
types<http://docs.python.org/reference/datamodel.html>in python as
keyword arguments (True, False, None, numbers, strings,
tuples).

Brian

On Tue, Oct 4, 2011 at 7:23 PM, Martin J. Laubach <goo...@emsi.priv.at>wrote:

>   Are you sure your context is thread-safe, ie. it's rebuilt from scratch
> every time you render an email and not re-used, stored in a global variable,
> class variable, whatever? Your problem description very much sounds like
> someone is fiddling with the context while the template is rendering.
>
>   A popular way to generate such a problem would be to use a literal dict
> as default parameter, something like:
>
> def my_render_email(recipient, context={}):
> context['email'] = recipient
> body = render_to_string('template.**html', context)
> ...
>
>   That is absolutely positively guaranteed to blow up in your face when you
> least expect it.
>
> mjl
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/mW012mKt7pwJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Display superscript or subscript in template site

2011-10-04 Thread Brian Bouterse
Even though it is off topic from Django, I would recommend taking some time
to learn about unicode
<http://docs.python.org/howto/unicode.html>superscript and subscript
symbols.

Brian

On Tue, Oct 4, 2011 at 12:11 PM, Khuong Lien <t3.khuon...@gmail.com> wrote:

> Hi All,
>
>
> I want to display superscript or subscript to template site by using
> django .But i don't know how to do it.
>
> Please help ..
> Many thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: DjangoCon US 2011 Videos

2011-09-21 Thread Brian Bouterse
Me 2.  I was at the conference but missed one or two key sessions that I
wanted to see.

Brian

On Wed, Sep 21, 2011 at 9:09 AM, Slafs <slaf...@gmail.com> wrote:

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



-- 
Brian Bouterse
ITng Services

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



Re: Problems during webcast (Using django for 40mil+ rows) - sorry!!!

2011-08-29 Thread Brian Bouterse
I really enjoyed what I was able to hear during the morning session.  I
ended up dropping out because of video problems, so I'm excited to see the
recorded video when it is available.  Thanks very much for putting this
together.

Thanks!
Brian

On Mon, Aug 29, 2011 at 5:41 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hey all,
>
> Much more successful this time round :) Webcast has been fully recorded,
> and will be uploaded to youtube in the next week or so.
>
> Thank you again to everyone who took the time to take part in this webcast,
> and if anyone has any feedback/criticisms, please feel free to list it here.
>
> Cal
>
>
> On Mon, Aug 29, 2011 at 9:06 PM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Webcast about to begin in 2 minutes.
>>
>>
>> On Mon, Aug 29, 2011 at 4:57 PM, Cal Leeming [Simplicity Media Ltd] <
>> cal.leem...@simplicitymedialtd.co.uk> wrote:
>>
>>> Hi all,
>>>
>>> I have just been informed after the webcast that many of you were
>>> experiencing issues being able to see the screen. It turns out that only a
>>> few of you were able to see/hear the webcast. And, for those attending, the
>>> slide show software had crashed and corrupted one of the most important
>>> slides :X
>>>
>>> I've found the issue which caused this, and I've made sure it doesn't
>>> happen during the later time slot at 9pm.
>>>
>>> Once again, I can only extend my apologies on this, and will ensure there
>>> are no issues later. I'm also going make sure every attendee is not
>>> experiencing problems BEFORE starting the webcast.
>>>
>>> For those that wish to re-attend, you can do so by using the following
>>> links
>>>
>>> For Windows based users ONLY:
>>> https://www3.gotomeeting.com/register/699162790
>>>
>>> For Linux based users ONLY:
>>> Host Key: 426916
>>> Meeting Number: 702 136 716
>>> Meeting URL:
>>> https://ukfreetrial.webex.com/ukfreetrial/j.php?ED=185534402=503673467=MiMyMQ%3D%3D
>>>
>>> IRC:
>>> irc.freenode.net/#simplicitymedialtd
>>>
>>> Sorry again.
>>>
>>> Cal
>>>
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: [geo-django] Best way to capture geo-coordinate of an anonymous user?

2011-08-25 Thread Brian Bouterse
This is off topic, but I did this yesterday; here is a link that should help
you along.

http://code.google.com/apis/maps/documentation/javascript/basics.html#DetectingUserLocation

Brian

On Thu, Aug 25, 2011 at 2:06 PM, Ricardo L. Dani <ricardod...@gmail.com>wrote:

> Hello everyone,
>
> Anyone knows how to capture a geo-coordinate of an anonymous user
> after his insert your address in an input? Using a google api?
>
> Thanks so much
>
> --
> Ricardo Lapa Dani
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Defunct Processes on Server

2011-08-12 Thread Brian Bouterse
You should look into projects called celery and django-celery instead of
cron.

On Friday, August 12, 2011, Thomas Orozco <g.orozco.tho...@gmail.com> wrote:
> You could avoid starting the child process in your view.
>
> If it's a long running process I would actually advocate doing so.
> This might be due to limited understanding on my part, but what happens
when Apache wants to kill its child process because MaxRequests was reached?
>
> If you don't need the job done ASAP, you could for example have a
directory where you store 'job files' and have a Cron script look at them.
You could obviously store this in a database too.
>
> Your script could then wait on the processes to collect the returncodes
and avoid this defunct process phenomenom.
>
> This is of course just a suggestion, although I'm pretty sure it would
work, I wouldn't say that it's the one and only way of doing what you want.
>
> Le 12 août 2011 13:19, "SixDegrees" <paulcarli...@comcast.net> a écrit :
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com <
django-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

-- 
Brian Bouterse
ITng Services

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



Re: Displaying results in Template in a Table ? What is the proper way ?Any app?

2011-08-10 Thread Brian Bouterse
I know it's not Django specific, but when I need a table for my Django
projects, I use jQuery Datatable <http://www.datatables.net/>.  It rocks!

Brian

On Wed, Aug 10, 2011 at 5:26 PM, Adam Zedan <zedan...@gmail.com> wrote:

> Or in other words  a good datagrid to use with Djano...What do u
> people suggest or use??
>
> On Aug 11, 1:52 am, Adam Zedan <zedan...@gmail.com> wrote:
> > Hi i wanted to know what do most people here do when they need to show
> > results in a template which just needs to be displayed in Table.
> > For example displaying data from a db etc in a template. I did try an app
> > called django_tables2 but it just seems really simple with respect to
> > presentation.
> > I tried loading the CSS version 'paleblue' of that app but it doesnt work
> ?
> > if someone has already tried that please do let me know ?? What do people
> do
> > in case they need to display data,allow rearrangement of data etc.Are
> there
> > any other apps...looking forward to hearing from you folks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: spam in response to posting to this list

2011-08-10 Thread Brian Bouterse
+1 to your suggestion of folks not overusing +1

On Wed, Aug 10, 2011 at 5:51 PM, Michal Petrucha <michal.petru...@ksp.sk>wrote:

> On Thu, Aug 11, 2011 at 12:14:37AM +0300, Praveen Krishna R wrote:
> > *+1
> > *
> > On Wed, Aug 10, 2011 at 7:32 PM, Kayode Odeyemi <drey...@gmail.com>
> wrote:
> >
> > > I have been getting this too.
>
> Please, people, be at least a little bit reasonable. Let's not make
> this another completely pointless "+1, me too" thread with no
> information at all. I bet most of the people posting to this mailing
> list are getting that spam and it really does not help at all if we
> all just start posting "+1" mails.
>
> Michal
>



-- 
Brian Bouterse
ITng Services

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



Re: Include Django form in PHP based website

2011-07-27 Thread Brian Bouterse
Where I work, we mix django into PHP sites often since most of our customers
already have PHP web sites, but want to pay us to extend them with new
functionality.  I do this by setting up a django project on another
apache/uwsgi/nginx virtual host which routes specific parts of the
application to Django and away from PHP.  You can do all of this with a
single domain, and on a single machine.  This way the requests never even
are sent to the PHP app for certain sections of the URL space.  Thus you can
replace sections of a PHP app with Django functionality.  You will need to
recreate the look and feel on the django side though.  Sometimes that can be
a pain to get perfect and it leads to a look-and-feel consistency
maintainence problem over time.  One way to avoid that pain is to have the
PHP site include blocks of functionality from the django application through
something like an iframe.  This minimizes the look and feel consistence
since most every page is loaded from PHP.

Brian

On Wed, Jul 27, 2011 at 9:34 AM, brian <brian.down...@yakkadesign.com>wrote:

> I'm learning Django and was hoping to get some advice on an
> application I want to try.
>
> I'm trying to create a Django form that is included in a php based
> website.
>
> I'm working on a php based website that has a 'contact us' form that
> was created with http://wufoo.com/.  In the php website there is a
> little code to include the wufoo form.  The form is created in wufoo
> and they manage the e-mails and storing the data.
>
> I want to replace the wufoo form with my Django form.  My plan was to
> host the Django form on a new domain.  My reason behind wanting to use
> Django is so that when the contact is submitted I can store the info
> in a database, send an e-mail, and write the data to another program.
> I don't care about wufoo's automatic form building; My plan is to hand
> write the form code.
>
> I bought the book 'The Definitive Guide to Django: Web Development
> Done Right' and I've read about half of it.  It seems creating the
> form is really easy but I'm not sure the best way to include that form
> in the php website.
>
> Do you have any suggestions about creating a Django form that will be
> included in a php website?  In the php website, I'd prefer not to use
> javascript.
>
> Brian
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-10 Thread Brian Bouterse
+1 for this write up.

Not that your write up suggests this, but I am cautious to turn folks away
from django-users because they ask a python only question.  From a venn
diagram perspective the django community is a subset of the python
community.  Using Django to teach folks more about Python is a win for
everyone (django, python, open source, ...).  My personal heuristic on what
is off topic on django-users for python specific questions is this:  if the
question is python only, if it is ultimately going to be used in a django
project, then I consider that on topic.

Brian


On Sun, Jul 10, 2011 at 9:45 AM, Venkatraman S <venka...@gmail.com> wrote:

> +1 from me.
> (but i see some in IRC who do not know python but start learning it along
> with Django - so probably we need not be too strict about this clause?)
>
> -V
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Some thoughts on a package/stack compile system for easy distribution of webapps..

2011-07-08 Thread Brian Bouterse
I'm going to try to get a pypy installation built from source that has
nginx/gunicorn/django.  I will share back what I can come up with. If anyone
else is doing similar things share back your findings please.

I don't use shed skin, but I believe pypy is much more mature.  As evident
from the large donation from the python software foundation at pycon this
past spring, pypy is poised to become *the* interpreter, if speed is your
goal.  The python software foundation wants to support the work of pypy and
their donation was the only one given at pycon 2011.  CPython will continue
to serve as the reference python interpreter.

I was talking with the pypy authors at pycon this past spring and they
anecdotally that django and pypy are being used in production on some sites.
 The folks in the pypy community could probably comment more on this than I
could.

Brian

On Fri, Jul 8, 2011 at 11:03 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

>
>
> On Fri, Jul 8, 2011 at 3:53 PM, Venkatraman S <venka...@gmail.com> wrote:
>
>> Cal,
>>
>> Quiet frankly, it looks to me that if you are spending some effort on this
>> - better start with django on pypy.
>> And then probably we can move to 'one-binary' idea.
>
>
> I much prefer the idea of a true single binary (the way facebook approach
> it) with everything statically compiled in, over the concept of a self
> extracting chroot, as the latter does sound quite messy.
>
> However, I'd need to find out if nginx/uwsgi/pypy/django would play
> together nicely.. so I'm going to spend some hours getting my hands dirty
> and seeing what works..- besides, it's a good opportunity to brush up on my
> C :)
>
>
>>
>>
>> -V
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Some thoughts on a package/stack compile system for easy distribution of webapps..

2011-07-08 Thread Brian Bouterse
I've been thinking about this for a day or two now, and here are some
thoughts:

One option to possibly compile python to C++ is shed
skin<http://code.google.com/p/shedskin/>,
to translate python code into a C binary.  Note that the compiled C code is
statically compiled which produces a C instruction stream that is static
(independant of the actual control flow).  I haven't run shed skin myself,
and there are language restrictions shed skin requires that would need to be
looked into since I'm not familiar with django's comatibility with shed
skin.

Note that the statically built C code might be less efficient than a Just In
Time compiled counterpart.  I have used pypy <http://pypy.org/> before which
makes python code run fast <http://speed.pypy.org/> and run my own speed
tests versus python code run through CPython, and pypy significantly (over
double typically) outperforms the same code run through CPython.  What you
would get with pypy would not be a single, pre-compiled binary, but the
speed ups of running django (and potentially nginx and gunicorn, etc)
through a pypy interpreter could potentially outperform a statically built
one.  After all the PHP to C translation speedup that facebook claims is
just over a 50% increase (anecdotally told in the video), pypy already does
that for me versus the CPython.  I have also heard of folks using pypy in
production serving django sites, so I think Django is ready for this.

I think also value the bundling of the web server, static content, and
application together is the value so that you don't have to manage the
stack. Requiring it to be a *single* binary is nice, but I don't think buys
you much really.  After all you could always just tar up the entire project
and deliver it that way.

What still needs to be figured out is how to get pypy reading the nginx and
gunicorn C code natively and then switching over and using JIT compilation
on the python code from the gunicorn->django entry point.

I would love to hear what others think about this type of thinking.

Best,
Brian

On Fri, Jul 8, 2011 at 5:55 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Also, one of the things you mentioned (about security updates of the
> chroot) is something i have been pondering today. Although a single compile
> will mean recompile everytime a security announce is released, this is
> unavoidable.
>
> This is my idea for handling security announcements:
>
> The single binary will have support for monitoring various sources for
> indications as to whether or not there is a security announcement for one or
> more of its internal componants. Within the configuration, the user can set
> an email address which these alerts are sent to. To avoid any single person
> being the weak link, we'll make it monitor not only the official project
> announce, but also remote security repos, to give it hints as to whether or
> not there is a security release for any specific component.
>
> The above idea will need some tweaking ofc, or maybe someone else could
> think of a better way to do this..?
>
> This also makes me think about build control. I guess each project would
> end up having a build file for future rebuilds, would it be wise to
> integrate this into the binary, as a backup incase the original is lost??
>
> So many thoughts..
>
> Cal
> On 8 Jul 2011 10:47, "Cal Leeming [Simplicity Media Ltd]" <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
> > Hi Bjarni,
> >
> > Thanks for your input. As pointed out earlier in the thread, the end goal
> is
> > to provide a single binary that is entirely host independant, contains
> the
> > chroot/stack needed by the webapp etc.
> >
> > You really need to watch the facebook video link i included earlier in
> the
> > thread to understand what we're trying to achieve.
> >
> > Im drawing up the design principles today, which should give you a better
> > idea.. but in a nutshell, imagine a single binary which would run
> entirely
> > from memory, be completely host independant, contain everything the
> webapp
> > needed (stack/chroot/deps etc), and have a nice ncurses interface to
> > configure this all from (with features like automatic memory usage
> > calculation / configuration - something which is overlooked oh so many
> > times)
> > On 8 Jul 2011 08:53, "Bjarni Rúnar Einarsson" <b...@pagekite.net> wrote:
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://

Re: anybody using PhoneGap with Django

2011-07-08 Thread Brian Bouterse
I would be interested to hear this as well...

On Fri, Jul 8, 2011 at 12:44 AM, John Fabiani <jo...@jfcomputer.com> wrote:

> On Thursday, July 07, 2011 08:48:51 pm Andy McKay wrote:
> > On 2011-07-07, at 2:22 PM, John Fabiani wrote:
> > > I'm wondering if anyone has had any success with PhoneGap and Django?
> >
> > Yes.
> > --
> >   Andy McKay
> >   a...@clearwind.ca
> >   twitter: @andymckay
>
> LOL - I guess I could have asked a better question.  Can I assume you have
> had
> success with Django and PhoneGap?  If so would you take the time to explain
> in
> a general your experience with PhoneGap.  I have been told that the
> combination is very slow - although I don't see any reason that it would
> be.
> I was also told that debugging was very difficult.
>
> Johnf
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Some thoughts on a package/stack compile system for easy distribution of webapps..

2011-07-06 Thread Brian Bouterse
I write a lot of automation on RHEL / CentOS systems and would like to see
the built process to look at potentially porting it.  Let me know how I can
follow the development.

Brian

On Wed, Jul 6, 2011 at 3:29 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> On Wed, Jul 6, 2011 at 8:15 PM, Shawn Milochik <sh...@milochik.com> wrote:
> > It definitely sounds interesting. I'd like to hear more about it as it
> > develops. The only quibble I'd add is to not limit it to Ubuntu. I use
> > and love Ubuntu, but I suspect that a lot of people who would want the
> > ability to obfuscate code and deploy easily to client servers would be
> > using RHEL or CentOS.
>
> I totally agree that it should be available on as many platforms as
> possible (i.e. RHEL / CentOS / FreeBSD etc). However, as I am 99% a
> Debian guy, it may be that one the code has reached beta stage,
> someone with more experience in those OS's might be better placed to
> add support for those platforms. I imagine the actual code base would
> change very little, and would be more along the lines of creating
> packages, pre-built binaries etc.
>
> To begin with, I'll probably make it compile everything from source
> (nginx / uwsgi / python etc), as some people won't be happy about
> having pre-built binaries (once it's matured slightly, maybe give the
> user an option in the CLI to choose between pre-compiled and compile
> from source)
>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Some thoughts on a package/stack compile system for easy distribution of webapps..

2011-07-06 Thread Brian Bouterse
What is "the Facebook video" you speak of?  I didn't see it.

On Wed, Jul 6, 2011 at 3:03 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hi all,
>
> After seeing the Facebook video about how their development team
> compiles everything into a single binary for easy distribution between
> thousands of servers, I totally fell in love with the idea. Although
> their approach is to compile PHP into C, the same principle applies.
>
> The end result will be a single binary which will contain your webapp
> + static resources + web server + application server, easily
> deployable to many servers, and reduced time spent in managing the
> stack (YMMV). Although I'm only going to be focusing on our needs to
> begin with, there's no reason this concept couldn't be extended in the
> future to include PHP, 32bit, other OS's etc.
>
> Some features I'm thinking of:
>
> * CLI based menu to build compile package (ncurses based). Easy to
> use. Incorporates all features available in nginx/uwsgi. Comes with
> 'basic' config mode (the bare minimal questions asked - for beginners
> - which makes it almost impossible to build a broken package) and
> 'advanced' mode which lets you change everything (with more risk ofc).
> * Support for nginx + uwsgi + python2.6 + python2.7 + debian 64bit.
> * Expose some sort of API which lets you query all aspects of services
> running within the package (like nginx stats).
> * Enable ability for nginx/uwsgi/python to log out to a syslog server
> of some kind)
> * Ability to obfuscate py code using various techniques.
> * Maybe a test-run feature to test your package.
> * Maybe some sort of MemoryError detection and reporting of such events.
>
> I'm probably going to make something like this for companies own
> internal use, but wanted to see if anyone else had an interest in
> seeing this go open source.
>
> Cal
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



ListView.get_context_data Exception

2011-07-01 Thread Brian Bouterse
I implemented a silly thing that ended up getting reworked because I
couldn't make Django work in the way my (silly) design wanted it to.  Here
was the situation:

1.  I wrote a class based (Django 1.3) view named
HomepageView<http://pastebin.com/mrK30VTB>that inherited from ListView
2.  I defined a post method for HomepageView which would save a form that
was posted to it.
3.  Inside the post, if the form validates, I redirect the user, which works
well
4.  Inside the post, if the form is not valid, I try to put the bound form
(with validation errors) into the context and then render the page like
normal

I receive this traceback <http://pastebin.com/GEp2LSdY>.  Which is telling
me that when ListView.get_context_data is called it can't find the object
named 'object_list'.

I don't know why this is occurring.  The path of execution calls
ListView.get_context_data twice, yet when it is called from within my post
function it fails strangely.  I know what I'm doing is kind-of strange, but
it should work right?

Enlighten me...

Thanks,
Brian

-- 
Brian Bouterse
ITng Services

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



Re: How to use the django-users mailing list properly and doing your homework..

2011-07-01 Thread Brian Bouterse
Just because dpaste breaks integrity of django-users doesn't mean that
e-mail is the "right" forum.  E-mail doesn't preserve code formatting or
syntax highlighting which is legitimately annoying.  Also lots of coders
still use text based e-mail (I don't but others do) so html syntaxing won't
always work either.  pastebin.com does have the option to retain snippets
forever as an alternative to dpaste.com which deleted them eventually.

Brian

On Fri, Jul 1, 2011 at 5:58 AM, Russell Keith-Magee <russ...@keith-magee.com
> wrote:

> On Friday, July 1, 2011, Herman Schistad <herman.schis...@gmail.com>
> wrote:
> > What about including something about e.g. http://dpaste.com for snippets
> etc.
> > I know I hate to read more than 10 lines of code in my email reader,
> > without syntax highlighting or correct indentation.
>
> Actually, there is a really good reason not to use dpaste (or a
> similar alternative) - it breaks the integrity of the Django-users
> archive. If dpaste ever goes away, or expires old pastes, then a
> valuable resource is lost. If we cant say "search the archives for an
> answer", then one of the big reasons for having a mailing list in the
> first place is lost.
>
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Brian Bouterse
+1 for making it viewable after the fact

On Wed, Jun 22, 2011 at 11:55 AM, creecode <creec...@gmail.com> wrote:

> Hello SleepyCal,
>
>
> On Wednesday, June 22, 2011 6:15:48 AM UTC-7, SleepyCal wrote:
>
> If you're interested, please reply on-list so others can see.
>
>
> +1
>
> Also if the webcast could be stored for later viewing that would be grand.
>
> Toodle-loo..
> creecode
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/SZabiWnq_S0J.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Easiest way to limit email warnings?

2011-06-19 Thread Brian Bouterse
+1 for django-sentry.  I use it on even the smallest sites and it works
great there too.

Brian

On Sun, Jun 19, 2011 at 9:17 AM, graeme <graeme.piete...@gmail.com> wrote:

> What is the simplest way of preventing the flood of emails that
> results from a site wide error? I do not want to end up with 10,000
> emails because the database was down for an extended period.
>
> I do not want to turn it off with ADMINS = () because it is useful for
> reporting one-off errors.
>
> I cannot limit at the mail server because the site is on shared
> hosting.
>
> Django Sentry seems to be able to email an error only the first time
> it is seen, but it seems overkill for a very simple site - its bigger
> than the apps that run the site combined and it introduces an external
> dependency on a site that has only has one (other than Django and the
> database driver that is!), and even that is non-critical.
>
> Are there any other options?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Email Accounts

2011-06-10 Thread Brian Bouterse
This conversation is off topic, and should not be facilitated through the
Django users mailing list.  There are sites setup for these kinds of
things<http://www.freelancer.com/>
.

Brian

On Fri, Jun 10, 2011 at 11:09 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hey Lillian,
>
> I've noticed a few emails on the list from you.. Could you possibly explain
> a little bit about the situation you are currently in, and what it is you
> are looking for? I might be able to offer some assistance, depending on what
> the problem is.
>
> Cal
>
>
> On Fri, Jun 10, 2011 at 2:40 PM, lillian <lillian.cauldw...@gmail.com>wrote:
>
>> Thanks for the recommendation.
>>
>> Any IT guys out there?
>>
>> Also, is it difficult to set up email accounts with Django or do I
>> require an IT guy for that as well?
>>
>> Need to set up some accounts and could use a little 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Question about using imports within functions/methods

2011-06-02 Thread Brian Bouterse
Yes relative imports are explicitly discouraged in PEP
8<http://www.python.org/dev/peps/pep-0008/>.
 Look for the imports section.

I do not recommend importing at runtime which is what you are doing when you
put imports inside function/methods.  There are performance problems when
calling imports repeatedly.  One possible method is to use a lazy import
paradigm described at the end of this section on import
overhead<http://wiki.python.org/moin/PythonSpeed/PerformanceTips#Import_Statement_Overhead>
.

The only reason I think it is ok to do imports inside function/method code
is if you don't know what you need to import until runtime, but in those
cases you wouldn't use the standard "import foo" syntax, since you would
need to dynamically choose what to import.

Another reason folks hide imports inside function/method code is to solve
circular import issues.  This is a consistently unproductive solution and
will create problems over time through hidden import dependencies that
aren't discovered until runtime.  circular imports can almost always be
resolved through some code and package reorganization.  I like this
article<http://effbot.org/zone/import-confusion.htm>on how import
works in python.

Brian



On Thu, Jun 2, 2011 at 10:39 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hey guys,
>
> This is more of a python question, than a Django specific one, but it's
> been bugging me for years now lol.
>
> I'm trying to figure out if it is better to do imports at the top of the
> file, or within the function/methods themselves.
>
> I guess the questions I'm asking are:
>
>- Is there any (serious) performance issues by doing imports every time
>the function/method is called
>- Is there a preferred style / guideline when it comes to imports?
>(maybe a PEP somewhere?)
>- Are relative imports discouraged? (from .. import package)
>
> Obviously, the answers would depend on different scenarios, so I'm looking
> for a discussion really, rather than a set in stone answer.
>
> Example 1:
> import os
> def test():
>print os.uname()
> def test2():
>print os.uname()
> test()
> test2()
>
> Example 2:
> import os
> class test:
>def test(self):
>print os.uname()
>
>
> Example 2:
> class test:
>def test(self):
>import os
>print os.uname()
>def test2(self):
>import os
>print os.uname()
>
> t = test()
> t.test()
> t.test2()
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Looking for Class Base Views intro (not Generic Class Base Views!)

2011-05-27 Thread Brian Bouterse
One reason its hard to pull the concept of Class Based views and Generic
views apart is because they actually go together.  Consider the following:

1.  Class based views typically use the
as_view()<https://github.com/django/django/blob/master/django/views/generic/base.py#L31>class
method as its entry point, which is typically provided through
inheriting from
django.views.generic.base.View<https://github.com/django/django/blob/master/django/views/generic/base.py#L12>
2.  Not inheriting from django.views.generic.base.View would require you to
implement the Class Based Views behavior and interfaces just like Django
already has, which is silly when you can just subclass the generic 'View'
function.
3.  So class based views tend to always inherit from some generic django
view ... django.views.generic.base.View at the very least.

Hope this is helpful,
Brian

On Thu, May 26, 2011 at 7:39 PM, Mateusz Harasymczuk <mate...@harasymczuk.pl
> wrote:

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



-- 
Brian Bouterse
ITng Services

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



Re: Overridden Admin Template Not Recognized

2011-05-27 Thread Brian Bouterse
You'll need make sure that "django.template.loaders.filesystem.Loader" is
enabled in your TEMPLATE LOADERS to use the app in the way you want.  Also,
you'll need to place your app BEFORE the 'django.contrib.admin' application
in the INSTALLED_APPS list.

Hope this helps,
Brian

On Thu, May 26, 2011 at 6:17 PM, Lee <lhughe...@gmail.com> wrote:

> I'm trying to override the TabularInline template following the
> instructions in
> https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates
> .
> I copied the tabular.html file to myproject/templates/admin/myapp and
> made changes to it, but they have no effect. I double-checked
> TEMPLATE_DIRS in settings.py and it includes the myproject/templates
> directory.
>
> Thanks for any help or ideas.
>
> Lee
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Parsing an XML feed using ElementTree

2011-05-24 Thread Brian Bouterse
We all have our opinions.  Either way this conversation is OT from Django.

On Tue, May 24, 2011 at 4:07 PM, Masklinn <maskl...@masklinn.net> wrote:

> On 2011-05-24, at 21:57 , Brian Bouterse wrote:
> > +1 for xpath
> >
> > I also like using
> > xml.dom.minidom<http://docs.python.org/library/xml.dom.minidom.html
> >since
> > it is so simple and straightforward.
> >
> I'm sorry, but I whole-heartedly disagree with this. ElementTree is orders
> of magnitude simpler and more straightforward than the unending pain of
> working with the DOM interface.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Parsing an XML feed using ElementTree

2011-05-24 Thread Brian Bouterse
+1 for xpath

I also like using
xml.dom.minidom<http://docs.python.org/library/xml.dom.minidom.html>since
it is so simple and straightforward.

If you XML is poorly formed go with beautiful
soup<http://www.crummy.com/software/BeautifulSoup/>
.

Brian


2011/5/24 Тимур Зарипов <q210@gmail.com>

> I'd really reallly suggest you to use lxml library <http://lxml.de/> for
> xml parsing -- it has xpath in it.
>
> On Tue, May 24, 2011 at 2:13 PM, Sithembewena Lloyd Dube <
> zebr...@gmail.com> wrote:
>
>> Hi Everyone,
>>
>> I am trying to parse an XML feed and display the text of each child node
>> without any success. My code in the python shell is as follows:
>>
>> >>>import urllib
>> >>>from xml.etree import ElementTree as ET
>>
>> >>>content = urllib.urlopen('
>> http://xml.matchbook.com/xmlfeed/feed?sport-id==TEST==Po
>> ')
>> >>>xml_content = ET.parse(content)
>>
>> I then check the xml_content object as follows:
>>
>> >>>xml_content
>> 
>>
>> And now, to iterate through its child nodes and print out the text of each
>> node:
>>
>> >>>for node in xml_content.getiterator('contest'):
>> ...name = node.attrib.get('text')
>> ...print name
>> ...
>> >>>
>>
>> Nothing is printed, even though the document does have 'contest' tags with
>> text in them. If I try to count the contest tags and increment an integer
>> (to see that the document is traversed) I get the same result - the int
>> remains at 0.
>>
>> >>> i = 0
>> >>> for node in xml_content.getiterator('contest'):
>> ... i += 1
>> ...
>> >>> i
>> 0
>>
>> What am I getting wrong? Any hints would be appreciated.
>>
>> --
>> Regards,
>> Sithembewena Lloyd Dube
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Experiences with virtualenv + Django?

2011-05-24 Thread Brian Bouterse
Python is embedded so deeply into operating systems these days that not
using virtualenv is a bad idea.  Here is what happened to me once:

1.  I went to pip intall a python package without virtualenv
2.  The installation failed leaving my python system raising an interpreter
error when going to run anything python
3.  Everything on the system started breaking (yum, bash were the most
noticible).
4.  I really tried to recover the box by repairing python  installing a
newer version of python  removing and reinstalling
5.  Could not recover the linux system; it ended up being faster to rebuild
it.

Don't be like me and break your system by not using virtualenv.

Brian

On Tue, May 24, 2011 at 9:42 AM, Shawn Milochik <sh...@milochik.com> wrote:

> 1. You can compile Python 2.6 (or 2.7) in your home directory and use that
> to create your virtualenvs.
>
> 2. I do 100% of my Python work with virtualenv, and would never do
> otherwise.
>
> 3. It is not a nightmare AT ALL, and is wonderful.
>
> 4. With pip install, pip freeze, and pip install -r it's super-easy to
> replicate a virtualenv.
>
> Like you, I use Cent OS with Python 2.4 installed, but all of our apps run
> under Python 2.7.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Example uses of Celery

2011-05-23 Thread Brian Bouterse
Celery is great for doing work asynchronously.  In web contexts asynchronous
work is useful since doing heavy lifting while the user is waiting on your
response doesn't lead to high perceived performance.

In non-web contexts, it is useful for submitting work into "the system" and
having workers churn through it task, after task.  This solves many of the
annoying (and unproductive) patterns developers who need to across systems
to talk with each other.  Instead of submitting the call to the other web
service directly, you give it to the broker, who delivers it to the workers
for you.  This keeps programmers from having to worry about overrunning the
other worker with requests or situations where the other service is
unreliable or experiences an outage.  If the third party service did go down
and the workers die for any reason the broker will continue to deliver the
messages once the workers come online.  Thus, Celery is a great way to
increase reliability while making things simpler for the programmer.  These
are high level observations...

Celery can seem Django specific because early on there was a dependency on
Django (even if you weren't using Django).  There is also really excellent
integration with celery through the django-celery project.

Brian


On Mon, May 23, 2011 at 9:49 PM, br <robert...@gmail.com> wrote:

> I understand a lot of production systems use celery and/or cron to
> automate task queues and/or scheduling.  I am just getting involved in
> a startup and will be the go-to guy for tech stuff and am interested
> in what types of tasks people use Celery (or a celery-like platform)
> for so that when similar types of things come up in my company, I'll
> think of it first.I've read through the manuals a bit, but its
> mostly technical and implementations.  I'd like some examples to
> analogize to and then I can apply the code  when stuff comes up.I
> realize Celery isn't a django-specific tool, but it seems to go hand
> and hand a lot of times and we are building our platform in django.
>
> Thanks,
>
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: How do you organize your deployment enviroment

2011-05-23 Thread Brian Bouterse
I use fabric and chef together.  Usually fabric bootstraps my chef
environment, and then chef takes over.  I also don't use cron anymore, but
instead use celery <http://celeryproject.org/>.

Best,
Brian

On Mon, May 23, 2011 at 7:50 AM, DK <cypre...@gmail.com> wrote:

> What is your optimal filesystem folder scheme?
>
> I've used to keep everything in one directory (project-enviroment, that was
> itself a virtualenv directory) and then put everything there, but now I am
> finding hard to manage this as it became a little mess. Now I think about
> something like:
>
> /
>home/
>project_user/
>  env/(<- virtual env goes here, no custom things, set up
> with pip requiremnts )
>  some_project/  ( <- this is project directory easily keeping
> up to date with some versioning system)
>  runmanager/ ( <- collection of generic scripts for
> running django projects etc,  versioned )
>  runtime/  (<- here goes all runtime stuff, like run, logs,
> conf, this should be preconfigured by invoking a specific command from
> runmanager, this cannot be versioned, these are installation specific files)
>
>
> any better idea/practices?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Is there an HTML editor that's Django-aware

2011-05-20 Thread Brian Bouterse
+1 for vim

On Fri, May 20, 2011 at 6:51 AM, Tom Evans <tevans...@googlemail.com> wrote:

> On Fri, May 20, 2011 at 10:54 AM, BobX <blueb...@gmail.com> wrote:
> > Pretty obvious question, but is there any recommended HTML editor that
> > won't munch the Django template codes? I was using Amaya to form my
> > pages, but after a couple of what-the-heck moments, I discovered that
> > it sporadically "eats" the template codes - ones in table definitions
> > being particularly vulnerable.
> >
> > Notepad2 is very usable - but unfortunately that's just syntax
> > highlighting the raw HTML codes. So at the moment I'm generating the
> > templates with Amaya and then switching to Notepad2 once the template
> > codes are added.
> >
> > I've also got SeaMonkey but haven't had a chance to try it yet.
> > Platforms I've got available are Linux or Windows.
> >
> > Thanks. Bob.
> >
>
> vim foo.html "+set ft=htmldjango"
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: New Django Profiling application

2011-05-13 Thread Brian Bouterse
I don't mean to suggest django-sentry provides the functionality discuss
earlier.  It doesn't.  I point to django-sentry to illustrate the quality of
projects done at Disqus.  I consider django-sentry a very high quality
Django application.

I was told by dcramer that they at Disqus have an app that does very similar
functionality to the functionality discussed.

Hope that clears up any confusion.

Brian

On Fri, May 13, 2011 at 10:20 AM, Xavier Ordoquy <xordo...@linovia.com>wrote:

> > On May 13, 9:34 pm, Brian Bouterse <bmbou...@gmail.com> wrote:
> >> Go for it!
> >>
> >> I know the disqus team (told by dcramer at djangocon 2010) has a great
> >> profiling app, you should talk with them about this.  The disqus folks
> said
> >> they were in the process of packaging it up to release similar to the
> high
> >> quality work they did on
> >> django-sentry<https://github.com/dcramer/django-sentry>.
> >>  You're idea sounds great and needed, I just want to encourage you to
> make
> >> sure you're adding to the community, not re-inventing existing
> solutions.
> >>
> >> Best,
> >> Brian
>
> I'm not sure django-sentry is a profiling application.
> It helps tracking issues but does not give anything like django debug
> toolbar does.
> This being said, David seems to push a lot of efforts on the latest.
>
> Regards,
> Xavier.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: New Django Profiling application

2011-05-13 Thread Brian Bouterse
Go for it!

I know the disqus team (told by dcramer at djangocon 2010) has a great
profiling app, you should talk with them about this.  The disqus folks said
they were in the process of packaging it up to release similar to the high
quality work they did on
django-sentry<https://github.com/dcramer/django-sentry>.
 You're idea sounds great and needed, I just want to encourage you to make
sure you're adding to the community, not re-inventing existing solutions.

Best,
Brian

On Thu, May 12, 2011 at 11:44 PM, Adrien LEMAIRE <
adrien.lema...@aquasys.co.jp> wrote:

> Hello dear django users,
>
> I'm currently finishing my master in Computer Science, doing django
> development in my internship. I chose Instrumentation as the main subject
> for my dissertation, so I'm studying every aspect of instrumentation on web
> development.
>
> I'll start soon a new django application which I'll host on 
> Github<https://github.com/Fandekasp>. This
> app will allow a developer to get a quick and good idea on which push slowed
> the project, and inside this profiling result, which view or sql request can
> have caused this problem.
>
> *Goals:*
>
>- Automatize profiling (sql + view execution time)
>- keep history of profiling results based on git push (commits can be
>broken and intensely used, when a git push should have all its tests
>passing: I think is a good value to keep in history).
>- render a graphviz image of the database
>- render a KCacheGrid readable image for each profile
>- Integrate a new page in the django admin to display all these
>stuff nicely
>- Fabric script which will replace a "git push" by verifying the tests,
>then performing all the previous tasks and updating the git repository
>before pushing.
>
>
> *Dependencies :*
>
>- django-extensions
>- fabric
>- django-coverage ?
>
>
> *Name :*
>
> I'm thinking about a good name for this app. None of the following are in
> the pip repositories: django-profiler, django-profiling,
> django-auto-profiling, django-profile-history, django-admin-profiler.
> What are your suggestions ?
>
>
>
>
> If you have questions or advises about this project, I'd love to read
> them.
> Also, I'd like to know how many of you guys would be interested by this
> app.
>
>
> Thank you very much
> Best regards
>
>
> *PS : *My company Aquasys <http://www.aquasys.co.jp> is seeking an
> experienced Django developer. The project will use Agile development
> methodologies, incorporate a REST architecture, and include the following
> technologies: Django, jQuery, HTML5, Google APIs. Please contact 
> george.mengelberg
> at aquasys.co.jp if you're interested.
>
> --
> Adrien Lemaire
> *Software Engineer*, Aquasys
> adrien.lema...@aquasys.co.jp
> office: +81.098.989.1118
> www.aquasys.co.jp
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Brian Bouterse
There is no "best choice" in licensing, just right for the right situation.
 I like the simplicity of the apache 2.0
license<http://www.apache.org/licenses/LICENSE-2.0.html>which is
mainly BSD in spirit plus attribution.

While GPL is more pure "open source" ideologically.  Businesses tend to back
away from using GPL based software because they can't repackage it and
distribute it without the source, which is a non-starter for most
businesses.  For my own projects, I would rather be less ideological so that
businesses are more interested in using it rather than grinding
a philosophical ax at the expense of my own software project's usage.

Another perspective is that in some situations it might not matter one
little bit what license you choose.  Very few licenses guard against this
licensing gotcha:   If the source is on the internet, I can download,
modify, and mash up your code to create some type of service based website.
 Since I never actually distribute the code to the customer, I just sell a
service online all of the attribution, and the what is open stays open
arguments go out the window.  Here I can take something open, modify it in
an awesome way, and since I never distribute it I never have to share my
derivative changes thereby preventing the GPL project from benefitting from
my extensions.  That is a pretty easy way to sidestep any of these licenses.

Brian



On Fri, May 13, 2011 at 7:58 AM, Alistair Grant <akgrant0...@gmail.com>wrote:

>  It will partly depend on who you would like to be able to use your code.
>
> The corporate mandate at my previous employer, a very large software
> company, was "No GPL".  LGPL was tolerated, but not encouraged.  The reason
> for the mandate was that GPL required the user to also make their code
> available, which is not what this software company wanted.  This was a few
> years ago, so the situation may have changed, but I'd expect it hasn't.
>
> Cheers,
> Alistair
>
>
> On 13/05/11 13:34, Thomas Weholt wrote:
>
> I've released three django-related packages the last few months, all
> under the GPL license. Recently somebody asked me about my license
> choice; "Why not BSD, the same as django?". My reason for choosing GPL
> is based on the fact that I'm a strong supporter of free software as
> defined by FSF and GPL is the de facto standard license for that. But
> the question got me thinking and I wonder what kind of problems I
> might run into using the GPL, and not the BSD license.
>
> Do people really care? Should I care? I think so. What do you people
> think; How to choose a license and why?
>
>
>   --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Encrpting urls to hide PKs

2011-05-09 Thread Brian Bouterse
In the name of not trusting any data coming from the client, one way that
IBM uses often is called
continuations<http://en.wikipedia.org/wiki/Continuations>.
 Basically you keep all data on the server, and only give the client an
identifier of that data.  This typically enforces a server-side state
machine that ensures what a user can and can't do with the application from
a given state.

This is not exactly what is being discussed here, but it is near it in
topic, so I thought I would mention it.

Brian

On Mon, May 9, 2011 at 8:59 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> To be honest, I'd be careful when using this approach.
>
> If you are intending on hiding the PKs, as a way to stop people hitting PKs
> they shouldn't be able to hit, then this means your security model is flawed
> from the ground up.
>
> However, if you are doing it to stop PKs from being leaked, then this is
> fine.
>
> Remember the number 1 rule in security.. NEVER TRUST THE CLIENT!!!
>
> On Mon, May 9, 2011 at 1:24 PM, ALJ <astley.lejas...@gmail.com> wrote:
>
>> I have a form that I use to collect contact information from
>> unregistered users. When they submit the form I want to redirect to a
>> confirmation page (as the Django documentation suggests). However,
>> instead of a generic page, I wanted to include the information that
>> they have submitted and the contact details of the person for their
>> area. I was also thinking that I could include the current status of
>> their enquiry. Therefore they could perhaps use the same link to come
>> back to check the status of their query.
>>
>> Given that, is there a best practice pattern for handling this
>> situation? I have a quick demo where the URL is:
>>
>> http://www.mydomain.com/contact/confirmation/1234
>>
>> ... where '1234' is the pk for the query. Obviously I would want to
>> encrypt the pk in this case, otherwise someone could just use the pk
>> to trawl through the database.
>>
>> Are there any default ways of encrypting django urls?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Best practice for async task in django?

2011-05-06 Thread Brian Bouterse
AMQP is not too heavy weight for me.  +1 for Celery and RabbitMQ.

Brian

2011/5/6 λq <lamb...@gmail.com>

> Thanks guys.
>
> Is AMQP a bit too heavy weight?
>
> Besides celery, are there any realworld in-production usage of
> Django+ZeroMQ?
>
> Is django-ztask stable?
>
> On Fri, May 6, 2011 at 8:44 PM, Shawn Milochik <sh...@milochik.com> wrote:
> > I throw in my +1 for Celery and/or django-celery, plus Rabbit MQ.
> >
> > However, if you want to try something else that's growing in popularity,
> > check out ZeroMQ.
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: stop repetition in template

2011-05-04 Thread Brian Bouterse
I like your second solution a lot better than mine.  I've never seen {%
ifchanged %} used properly before.

Brian

On Wed, May 4, 2011 at 1:19 PM, Javier Guerra Giraldez
wrote:

> On Wed, May 4, 2011 at 11:42 AM, pankaj sharma
>  wrote:
> > in template..
> >
> >   {% for college in list %}
> >{{college.city}}
> >   {% endfor %}
> >
> > in views.py
> >
> > def list(request):
> >college_list=College.objects.all()
> >return render_to_response(
> >'college/list.html',
> >{'list':college_list}
> >)
> >
> >
> >
> > so suppose i have two colleges in one city so it is showing the city
> > name twice  .. so how do i stop repetition..
>
> two different solutions, depending on what do you want:
>
> A) if you only need the cities from a given college queryset, in the
> view do something like:
>
>  render_to_response(
>   'college/list.html',
>{'cities_list':City.objects.filter(college_set__in = college_list)}
>   )
>
> B) if you want a list of colleges, separated by city, and only show
> the city once for each group of colleges:
>
> in the view:
>
>   return render_to_response(
>   'college/list.html',
>{'list':college_list.order_by('city')}
>   )
>
> in the template:
>
>  {% for college in list %}
>  {% ifchanged %}{{college.city}}{% endifchanged %}
>   {{college.name}}
>  {% endfor %}
>
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: stop repetition in template

2011-05-04 Thread Brian Bouterse
I would handle this at the views layer.  Right now your queryset of
college_list is a list of colleges containing cities.  In your view code I
would re-organize it to be a list of cities that contain colleges.  Then you
can iterate through cities and get colleges.  You can build this data
structure dynamically in the view code without explicitly pre-defining it as
a class or model.

Hope this helps.

Brian

On Wed, May 4, 2011 at 12:42 PM, pankaj sharma
<new.pankajsha...@gmail.com>wrote:

> hello friends,
>  i have database of colleges.
> i want to show all cities
>
> so what is did is..
> in template..
>
>   {% for college in list %}
>{{college.city}}
>   {% endfor %}
>
> in views.py
>
> def list(request):
>college_list=College.objects.all()
>return render_to_response(
>'college/list.html',
>{'list':college_list}
>)
>
>
>
> so suppose i have two colleges in one city so it is showing the city
> name twice  .. so how do i stop repetition..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Multiple SQLITE databases vs one BIG PostgreSQL database

2011-05-04 Thread Brian Bouterse
You're probably right about using Postgres.  Postgres is rock solid,
scalable, and easy to use.

I've recently had a need to create a bridge between PostgreSQL and SQlite.
 Primarily because I use SQlite in my dev environments, but use PostgreSQL
in production.  I have been planning to write something to allow all data to
be moved back and forth.  It sounds like you have a data sync service.  Any
thoughts on open sourcing that code?  Anyone else know of a project that
already does this?

Thanks,
Brian

On Wed, May 4, 2011 at 9:02 AM, David Goehrig <d...@nexttolast.com> wrote:

> I'd recommend going the PostgreSQL route.  I have a number of apps that use
> the architecture where Postgres is running in a federated multi-master setup
> with client side SQLite db used as local cache. Building a data sync service
> between the two using django to ship models via a RESTishAPI degerates into
> a trivial task.
>
> For one large deployment with tens of millions of documents with tens of
> millions of users we have no problems on a handfull of commodity servers.
>
> -=-=- d...@nexttolast.com -=-=-
>
> On May 4, 2011, at 6:32 AM, VoodooH <radu.hasan2...@gmail.com> wrote:
>
> > Hello guys,
> >
> > We currently have a desktop software that uses a sqlite embedded
> > database. We are now gonna develop the online version for our software
> > and we need your opinion on these matters :
> >
> > 1. We were thinking of giving our users the option to switch between
> > the online and offline version of the software by simply moving the
> > sqlite database between the two applications. This would save us a lot
> > of dev time for now, but we are afraid that we will have scalability
> > issues later. There will be around 10 000 users at least, so at least
> > 10 000 sqlite independent databases. The other option of course is a
> > very big PostgreSQL database. There will be millions, if not tens of
> > millions of records in this BIG database.
> >
> > Which version do you recommend between the two ? Should we go for the
> > fast development sqlite version or build a database from scratch and
> > make some import/export tools between the two apps ?
> >
> > 2. If we were to go for the big database version, which one yould you
> > recommend between PostgreSQL, MySQL and ORACLE ?
> >
> > 3. Any ideas on how it would be best to implement a sync tool between
> > the desktop and the SaaS if we go for the PostgreSQL version ?
> >
> > Thank you very much !
> >
> > Regards,
> >  Radu
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Multiple SQLITE databases vs one BIG PostgreSQL database

2011-05-04 Thread Brian Bouterse
SQlite has issues with efficiently serving multiple database connections
simultaneously.  It is still ACID compliant, but the performance can crawl
with multiple users.  I think this has to do with the locking being
filesystem based.  That being said it sounds like your db's would all be
used by independent clients so this probably isn't an issue for you.  If you
need to in the future relate data that is isolated in individual sqlite
databases then it would have been better to have things in one place.  To
recap, IMHO, if you have a portability requirement, a single user at a time
per db, and no need to relate data in between these small independent
databases then go with SQlite.

If you decide to go with a big db, go with Postgres.  It's the best in the
business for the money and complexity.  I have used mysql a lot before too,
and I do not recommend it.  Oracle is complicated and closed.

Best,
Brian

On Wed, May 4, 2011 at 6:32 AM, VoodooH <radu.hasan2...@gmail.com> wrote:

> Hello guys,
>
> We currently have a desktop software that uses a sqlite embedded
> database. We are now gonna develop the online version for our software
> and we need your opinion on these matters :
>
> 1. We were thinking of giving our users the option to switch between
> the online and offline version of the software by simply moving the
> sqlite database between the two applications. This would save us a lot
> of dev time for now, but we are afraid that we will have scalability
> issues later. There will be around 10 000 users at least, so at least
> 10 000 sqlite independent databases. The other option of course is a
> very big PostgreSQL database. There will be millions, if not tens of
> millions of records in this BIG database.
>
> Which version do you recommend between the two ? Should we go for the
> fast development sqlite version or build a database from scratch and
> make some import/export tools between the two apps ?
>
> 2. If we were to go for the big database version, which one yould you
> recommend between PostgreSQL, MySQL and ORACLE ?
>
> 3. Any ideas on how it would be best to implement a sync tool between
> the desktop and the SaaS if we go for the PostgreSQL version ?
>
> Thank you very much !
>
> Regards,
>  Radu
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: ANN: DSE v2.0.0-Beta - DSE uses 1.8% of the time compared to the Django ORM updating 100.000 records.

2011-05-03 Thread Brian Bouterse
I will definitely be using this next time.  Nice post.

Brian

On Tue, May 3, 2011 at 5:50 PM, Thomas Weholt <thomas.weh...@gmail.com>wrote:

> Hi,
>
> Just posted a new blog about more realistic performance of DSE against
> a real database. Head over to http://weholt.blogspot.com/ to read it.
>
> Thanks for your feedback!
>
> Regards,
> Thomas
>
> On Tue, May 3, 2011 at 1:55 PM, Brian Bouterse <bmbou...@gmail.com> wrote:
> > This would have been so useful on my last project.  14.4 Million records
> > took a couple of days with a single thread using the ORM.  This would
> have
> > really sped things up.
> > Brian
> >
> > On Tue, May 3, 2011 at 7:50 AM, Thomas Weholt <thomas.weh...@gmail.com>
> > wrote:
> >>
> >> Inserting, updating or deleting lots of records using the Django ORM?
> >> Want better performance? Check out DSE!
> >>
> >> It's free, released under the GPL licence. More information about the
> >> possible performance gain can be seen here:
> >>
> >>
> http://weholt.blogspot.com/2011/05/dse-uses-18-of-time-compared-to-django.html
> >>
> >> DSE at pypi:
> >> http://pypi.python.org/pypi/dse/
> >>
> >> Source at bitbucket.org:
> >> https://bitbucket.org/weholt/dse2
> >>
> >> Thanks for your attention.
> >>
> >> --
> >> Mvh/Best regards,
> >> Thomas Weholt
> >> http://www.weholt.org
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django users" group.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/django-users?hl=en.
> >>
> >
> >
> >
> > --
> > Brian Bouterse
> > ITng Services
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
>
>
>
> --
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: ANN: DSE v2.0.0-Beta - DSE uses 1.8% of the time compared to the Django ORM updating 100.000 records.

2011-05-03 Thread Brian Bouterse
This would have been so useful on my last project.  14.4 Million records
took a couple of days with a single thread using the ORM.  This would have
really sped things up.

Brian

On Tue, May 3, 2011 at 7:50 AM, Thomas Weholt <thomas.weh...@gmail.com>wrote:

> Inserting, updating or deleting lots of records using the Django ORM?
> Want better performance? Check out DSE!
>
> It's free, released under the GPL licence. More information about the
> possible performance gain can be seen here:
>
> http://weholt.blogspot.com/2011/05/dse-uses-18-of-time-compared-to-django.html
>
> DSE at pypi:
> http://pypi.python.org/pypi/dse/
>
> Source at bitbucket.org:
> https://bitbucket.org/weholt/dse2
>
> Thanks for your attention.
>
> --
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Extremely Frustrated

2011-04-28 Thread Brian Bouterse
Also while in vim, you can show all symbols in the file directly as symbols.
 This makes tabs versus spaces trivial to identify.  To enter this mode use
the following command in vim.

:set list

and to exit this mode use

:set nolist

See the documentation
here<http://vimdoc.sourceforge.net/htmldoc/options.html#'list'>
.

Brian


On Thu, Apr 28, 2011 at 4:50 AM, Tom Evans <tevans...@googlemail.com> wrote:

> On Thu, Apr 28, 2011 at 8:47 AM, Kenneth Gonsalves
> <law...@thenilgiris.com> wrote:
> > On Thu, 2011-04-28 at 00:27 -0700, Derek wrote:
> >> A good IDE will convert tabs to spaces for you save you hours of
> >> frustration!
> >
> > tab-nanny is also your friend
>
> Or in vim:
> :set expandtab shiftwidth=4 tabstop=4 | retab
>
> Short form:
> :se et sw=4 ts=4 | ret
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Using Q objects vs explicit filters

2011-04-13 Thread Brian Bouterse
Could you include the output to highlight the differences?

Brian

On Wed, Apr 13, 2011 at 9:32 AM, Gianluca Sforna <gia...@gmail.com> wrote:

> In writing a complex filter for an application, I've found a different
> behavior between a filter like:
> Model.objects.exclude(filter1, filter2)
>
> and one like:
> Model.objects.exclude(Q(filter1), Q(filter2))
>
> where filter1 and filter2 are both field lookups on related models; in
> particular only the second syntax yields the desired result set. Are
> the above forms supposed to produce comparable queryset?
>
> Thanks in advance
>
> G.
>
>
> --
> Gianluca Sforna
>
> http://morefedora.blogspot.com
> http://identi.ca/giallu - http://twitter.com/giallu
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Creating REST APIs in Django...advice

2011-04-12 Thread Brian Bouterse
This is an interesting approach I had not thought of before.  Thanks!

Agreed, CRUD is not the same as REST.

Brian

On Tue, Apr 12, 2011 at 10:51 AM, sebastien piquemal <seb...@gmail.com>wrote:

> Well ... http://django-rest-framework.org  allows you to override the
> method by adding a post parameter. So in your form, you just add a
> hidden input
>
> 
>
> or
>
> 
>
> and django-rest-framework will pipe your POST request into the "put"
> handler or "delete" handler. Of course name="_method" can be
> configured (I mean that you can use another parameter name). That's a
> quite elegant way to overcome the limitation you are talking about
> (even though CRUD and REST are not exactly the same things).
>
> I am not sure that piston is still actively maintained ...
>
> On Apr 12, 3:57 pm, Brian Bouterse <bmbou...@gmail.com> wrote:
> > I've been reading through the documentation for piston and
> > django-rest-framework.org and they both look like great projects.  Could
> > anyone with experience working with either of these applications (or
> their
> > authors themselves) provide some compare and contrasting of the
> > features/usability/etc.
> >
> > Also, as a general REST-ism, the HTML
> > form<http://www.w3schools.com/tags/att_form_method.asp>tag doesn't
> > allow for HTTP methods besides GET and POST.  As such we
> > typically write a full REST API (GET, PUT, POST, DELETE), and then end up
> > doing the following to "make it work" for HTML/browser settings.
> >
> > CREATE - POST to /resource/
> > READ - GET to /resource/
> > UPDATE - POST to /resource/
> > DELETE - POST to /resource/delete
> >
> > The really non-restful part of the "make it work for browsers" hack is
> > adding the verb delete into the URL.  I couldn't think of a better way.
> >  This is a common pattern I end up implementing a lot, and it would be
> cool
> > if a rest framework let me accomplish this in an easier way.
> >
> > Brian
> >
> > On Tue, Apr 12, 2011 at 6:23 AM, Tom Christie <christie@gmail.com
> >wrote:
> >
> >
> >
> > > I've been working on this with some folks:
> >
> > >http://django-rest-framework.org
> >
> > > Released 0.1 a few weeks ago, and it's coming along *really* nicely.
> It's
> > > under v active development ATM. The auto-generated API browser is
> > > particularly cool. Really would advise anyone taking a look at building
> web
> > > APIs in python to take a look at 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
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
> >
> > --
> > Brian Bouterse
> > ITng Services
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Creating REST APIs in Django...advice

2011-04-12 Thread Brian Bouterse
I've been reading through the documentation for piston and
django-rest-framework.org and they both look like great projects.  Could
anyone with experience working with either of these applications (or their
authors themselves) provide some compare and contrasting of the
features/usability/etc.

Also, as a general REST-ism, the HTML
form<http://www.w3schools.com/tags/att_form_method.asp>tag doesn't
allow for HTTP methods besides GET and POST.  As such we
typically write a full REST API (GET, PUT, POST, DELETE), and then end up
doing the following to "make it work" for HTML/browser settings.

CREATE - POST to /resource/
READ - GET to /resource/
UPDATE - POST to /resource/
DELETE - POST to /resource/delete

The really non-restful part of the "make it work for browsers" hack is
adding the verb delete into the URL.  I couldn't think of a better way.
 This is a common pattern I end up implementing a lot, and it would be cool
if a rest framework let me accomplish this in an easier way.

Brian

On Tue, Apr 12, 2011 at 6:23 AM, Tom Christie <christie@gmail.com>wrote:

> I've been working on this with some folks:
>
> http://django-rest-framework.org
>
> Released 0.1 a few weeks ago, and it's coming along *really* nicely. It's
> under v active development ATM. The auto-generated API browser is
> particularly cool. Really would advise anyone taking a look at building web
> APIs in python to take a look at 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Django app for data management and visualization

2011-04-10 Thread Brian Bouterse
I'm a fan of using flot <http://code.google.com/p/flot/> for visualization.
 I've used the Google Charts and it works well too.

Brian


On Sun, Apr 10, 2011 at 2:07 AM, ucnt...@gmail.com <ucnt...@gmail.com>wrote:

>
>
> On Apr 8, 12:22 am, Chris Matthews <ch...@bbd.co.za> wrote:
> > Hi Marwan,
> >
> > Another option that I'll investigate is Google Chart Tools / Image Charts
> (aka Chart API) seehttp://code.google.com/apis/chart/
> > Regards
> > Chris
> >
>
> Be sure to go for the "Visualization API" over the basic image based
> charts if you have significant amount of data.  I've been using this
> of late and pretty well enjoying it. I'm currently considering
> exporting to Google's spreadsheet from which you can IIRC export to
> various formats. Perhaps you could upload the data for export to
> Google Docs, then export over an API. Not sure if they expose
> exporting to xls over an API yet.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Rewriting Java UI for Django?

2011-03-25 Thread Brian Bouterse
Alarm bells usually go off for me when I am required to purchase a license
for code I have written.  Maybe I'm just an open source kinda guy, but if
I'm going to write code, I should be free to run it without paying a license
fee.  Flex is a life choice ... I won't be making it.

Brian

On Fri, Mar 25, 2011 at 11:09 AM, Sells, Fred
wrote:

>  I also have made the conversion from Java/Swing/Webapp(jnlp) to Django,
> but I used Flex (a.k.a. Flash)  for my UI because I’ve got a rich client
> background and did not want to deal with Browser inconsistencies.  I’m happy
> with that choice.  I use a very simple django template to render a very
> consistent XML which Flex accepts.  This allowed me to initially develop my
> UI using XML text files which allowed me to show results very quickly.
>
>
>
> You can get a free 60 day developer license from Adobe, which should be
> enough to complete most of the task and then get management to buy a
> licensee (~$500 depending on ???)  Adobe used to sell a very pricey backend
> which you don’t need with django.
>
>
>
> If you decide to go this route, I can help you with the initial startup
> issues.   If so, post back here with Flex + Django as the subject.  If it
> gets too involved we can move off the django list, but others might be
> interested.
>
>
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *David Kovar
> *Sent:* Thursday, March 24, 2011 12:56 PM
> *To:* django-users@googlegroups.com
> *Subject:* Re: Rewriting Java UI for Django?
>
>
>
> Patrick,
>
>
>
> Thank you for the insight. Thankfully, I'm trying to port rather than wrap
> so while I've got a learning curve ahead of me, it isn't a horrible one.
>
>
>
> -David
>
>
>
> On Mar 24, 2011, at 11:40 AM, Patrick McDonnell wrote:
>
>
>
>  David - I'm not sure I follow exactly what you're asking.
>
>
>
> If you're trying to basically port a Java/Swing application to Django:
> Django is a web application framework.  Python with the Django libraries are
> used on the back end, and HTML is used on the front end (technically it is
> possible to use something other than an HTML front end, but that woud be
> very unusual).  So, in answer to your question, HTML/JavaScript/CSS/etc are
> used to develop your UI.  Django does offer some utilities to make your job
> easier (see the docs for forms and templates), but the majority of the UI
> design must be done by hand.
>
>
>
> Also note that Django does automatically generate an admin UI for all of
> your database models.  By default, its a pretty simple CRUD interface, but
> you can modify it a bit, see the docs.
>
>
>
> If, however, you're asking how to "wrap" an existing Java/Swing application
> inside of Django... That would be much more complicated, and probably not a
> very good idea.
>
>
>
> HTH
>
>
>
>
> On Thu, Mar 24, 2011 at 10:13 AM, David Kovar  wrote:
>
> Greetings,
>
> I'm fairly experienced with Python for backend, non UI/UX tasks but am very
> new to trying to do any UI work other than command lines. This'll come off
> as a very newbie question, and it is.
>
> I need to take an existing Java/Swing UI and wrap it inside of Django to
> provide authentication, customer support, etc. I've got a pretty good handle
> on most of this, except for:
>
>What is the best Python approach to writing a web UI that includes
> dropdown menus, radio buttons, etc?
>
> It may be that Django will do this for me, but I've not figured out how to
> do so yet.
>
> Thanks
>
> -David
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> 

Re: Django app and Amazon AWS (beginner)

2011-03-09 Thread Brian Bouterse
I recommend running your runserver inside
screen<http://www.manpagez.com/man/1/screen/>and leaving it detached
when you are logged out.

Brian

On Wed, Mar 9, 2011 at 9:50 PM, Huy Ton That <huyslo...@gmail.com> wrote:

> Well, if you are just doing a development test, as it seems below foregoing
> apache, you can do
>
> sudo nohup python manage.py runserver 0.0.0.0:8000
>
> It will keep on running after you close the terminal.
>
> -H
>
>
> On Wed, Mar 9, 2011 at 9:46 PM, nai <chng.nai...@gmail.com> wrote:
>
>> Hi guys,
>>
>> I've been lurking on the forums and groups for a while now but I've
>> recently ran into some problems I couldn't figure out whilst learning
>> to code.
>>
>> Basically, I have a simple working webapp on my local machine. I've
>> signed up for the free Amazon tier and have been messing around with
>> it since. So my question is, once I run
>>
>> python manage.py runserver ec2-122-248-194-176.ap-
>> southeast-1.compute.amazonaws.com:8000 &
>>
>> Everytime I close my terminal the site goes down even though I added
>> the '&' to run it as a background task.
>>
>> Is there a better way of doing this? Are there any resources/books
>> that shows you how to deploy on Amazon? Why isn't there a heroku for
>> Django?
>>
>> Ok, that became a 3 part question :)
>>
>> Thanks.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: PLEASE HELP ME IN ADDING A CATEGORY IN THE ADMIN SITE

2011-03-08 Thread Brian Bouterse
please don't shout

On Tue, Mar 8, 2011 at 12:34 AM, pankaj sharma
<new.pankajsha...@gmail.com>wrote:

> same as categories i have to add affiliation to every college.
> so i added
>
> class Affiliation(models.Model):
>title = models.CharField(max_length=100)
>
>def __unicode__(self):
>return self.title
>
> to models.py
>
>
> and  added one more field to class of colleges
>
> class College(models.Model):
>   name = models.CharField(max_length=250)
>   category = models.ForeignKey(Category)
>   city = models.ForeignKey(City)
>   affiliation = models.ForeignKey(Affiliation)### i added
> this line to college class in models .py
>
> now i changed my admin.py to this:
>
>
>
> from django.contrib import admin
> from college.models import *
>
> class CollegeAdmin(admin.ModelAdmin):
>list_display = ('name','category', 'city', 'affiliation')
>list_filter = ['category', 'city']
>search_fields = ['name', 'city']
>
>
> class CityAdmin(admin.ModelAdmin):
>list_display = ('title', 'state')
>list_filter = ['state']
>search_fields = ['title',]
>
> admin.site.register(College, CollegeAdmin)
> admin.site.register(City, CityAdmin)
> admin.site.register(State)
> admin.site.register(Category)
> admin.site.register(Affiliation)
>
>
>  but when i use syncdb command it shows no fixtures found
>
> and when i click on college in admin site  then it show me error like
> this
>
>
> OperationalError at /admin/college/college/
> (1054, "Unknown column 'college_college.affiliation_id' in 'field
> list'")
>
>
>
>
> now what to do? do i have to edit some more codes?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: celery tasks and circular imports

2011-03-07 Thread Brian Bouterse
I too "protect" code from being interpreted at import time by putting import
statements directly in the tasks that need them.  I don't think there is
anything wrong with this approach the from a Python perspective other than
possibly these:

* imports are parsed at runtime and thus an import occurs for each time the
code is run<=== performance problem
* import errors aren't discovered until runtime

I too am looking for a better way to do this.

Brian

On Mon, Mar 7, 2011 at 8:25 AM, Shawn Milochik <sh...@milochik.com> wrote:

> If there's a "correct" way to do this I'd love to hear it also.
>
> At present I do the model imports in tasks.py within the task that
> requires the model. This is because in my models.py I import tasks
> from tasks.py.
>
> Shawn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: sqlite path

2011-02-28 Thread Brian Bouterse
onnection.introspection.table_names()
> >   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> > __init__.py", line 498, in table_names
> > return self.get_table_list(cursor)
> >   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> > sqlite3/introspection.py", line 51, in get_table_list
> > ORDER BY name""")
> >   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> > util.py", line 15, in execute
> > return self.cursor.execute(sql, params)
> >   File "/usr/local/lib/python2.7/site-packages/django/db/backends/
> > sqlite3/base.py", line 200, in execute
> > return Database.Cursor.execute(self, query, params)
> > django.db.utils.DatabaseError: disk I/O error
> >
> > thanks for any ideas,
> > --Tim
>
> More info. This isn't a django issue after all. I just tried a simple
> select * using the sqlite shell and got a disk io error. If I move the
> database to my home directory, the select works, so there's something
> weird going on with the mounted disk where my django app lives (a
> netapp device).
>
> sorry for the noise,
> --Tim
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Python/Django AMQP?

2011-02-24 Thread Brian Bouterse
+1 for Celery and django-celery.  I use them also.

On Thu, Feb 24, 2011 at 9:07 AM, Shawn Milochik <sh...@milochik.com> wrote:

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


-- 
Brian Bouterse
ITng Services

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



Re: App engine serving static files?

2011-02-16 Thread Brian Bouterse
I've never used it, but I always wanted to use
DryDrop<http://drydrop.binaryage.com/>to push all my static media over
to GAE.

Brian

On Wed, Feb 16, 2011 at 2:44 AM, Praveen Krishna R <
rpraveenkris...@gmail.com> wrote:

> *Hey Guys,*
> *
> *
> *Does Anyone has experience, serving static content with google app
> engine?*
> *Does it make a big difference, than serving it with nginx on the same
> server as django?*
> *I currently use a shared hosting, and was just thinking to move the
> static content to GAE*
> *I would like to know your thoughts on this*
> *
> *
> --
> Thanks and Regards,
> *Praveen Krishna R*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Django Mutlisite Setup

2011-02-13 Thread Brian Bouterse
virtualenv is great and I use it religiously.  I do want to point out though
that while virtualenv does solve package isolation for
multiple, independent django projects, care needs to be taken for security.
 If this care isn't taken, for example, should a single site's security
be compromised, essentially all of your sites could be compromised.  This
isn't the thread for an in depth discussion of this topic, but I did want to
raise some attention towards the needs for simple secure single-server,
multi-site Django deployments.

Brian

On Sun, Feb 13, 2011 at 11:10 PM, Eric Chamberlain  wrote:

>
> On Feb 13, 2011, at 7:08 PM, Jason Drane wrote:
>
> > Forgive me if this question  offends you more advanced users. I am
> > begun down the road of learning Django. I am curious if it is possible
> > to place Django in the root of my server and reference it to each of
> > multiple sites in development, similar to php, python, etc.
>
>
> We run multiple sites on our servers, but we don't have them all share the
> django installation.  We use virtualenv and each django project has its own
> environment.  It makes it much easier to upgrade the projects when they are
> not all relying on the same installation.
>
> To simplify the web server configuration, we do have all the projects at
> the same django version level share the admin media.  We serve that from
> Amazon S3.
>
> --
> Eric Chamberlain, Founder
> RF.com - http://RF.com/
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django + GWT

2011-02-13 Thread Brian Bouterse
We've built several GWT integrated Django applications where I work.  My #1
tip would be to spend a lot of time in the Chrome developer tools.
 Secondly, use GWT as a front-end only since the Java integration is
designed to create server side servlets to pair with the client side-UI GWT
code.  You'll be using Django for the backend and we've gotten that working
great in several projects.  Basically use the front-end sections of GWT
only.  Lastly, I would make sure you have a really good reason to use GWT
over jQuery.

Personally the cross browser compatibility argument that GWT provides isn't
enough of an argument.  The best argument in favor of using GWT would be
project size.  Because of the complexity curve of GWT very large project
(multi-man, multi-month) projects would benefit from the rigor and code
organization required when you use GWT.
Here<https://github.com/bmbouter/Opus>is a django+GWT project we
implemented; maybe it will show some examples for
you.

Brian

On Sat, Feb 12, 2011 at 4:19 PM, Roman <rwi...@gmail.com> wrote:

> Is there a relatively painless way to integrate Django server side and
> GWT front-end? I'm new to Django (one simple project a year ago) and
> I've some experience with GWT. Anyone done it before and has a few
> tips where to start?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Looking for IDE + FTP

2011-02-08 Thread Brian Bouterse
+1 for not editing code and uploading it.

I recommend vim or gVim

Brian

On Tue, Feb 8, 2011 at 4:57 PM, Austin Govella <austin.gove...@gmail.com>wrote:

> I use Textmate ($55?) for editing. Great color coding for html, ruby,
> php, javascript, css, and python. :-)
>
> I use Terminal (free) for Subversion and Git (version control). I'd
> highly recommend Git. It is easier to use and les of a hassle than
> Subversion.
>
> I use Cyberduck (free) for FTP and Mac's Finder (free) for browsing
> directories.
>
> It's not much of a difficulty to edit and save a file in my editor,
> switch to the finder window and then drag the changed file onto
> Cyberduck where it uploads it.
>
> The Git workflow is the same, except I switch to the Terminal instead
> of finder and type in a Git command instead of dragging a file to
> Cyberduck.
>
>
>
> Don't let all the version control peeps get you down. I edit files for
> live sites directly on the server all the time. Dangerous? Can be.
> Sure, but it really depends on what kind of site you're working on.
>
> I think a better bridge between your current process and version
> control is to have two versions of your sites hosted on your server:
> one for testing/staging, and the other one for production. You can
> make your edits and FTP them to your testing server, and if everything
> works, you can FTP the changes to the production server.
>
> Gets you the "testing before breaking" without having to learn a
> version control system.
>
>
>
> --
> Austin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Redirecting to personal pages.

2011-02-04 Thread Brian Bouterse
Did you read the link in documentation?  In case you missed it [1].

Brian

[1]   http://docs.djangoproject.com/en/dev/topics/auth/

On Fri, Feb 4, 2011 at 8:51 AM, balu <vab...@gmail.com> wrote:

> How "next" parameter works?
>
> On Feb 4, 3:04 pm, Andres Lucena <andresluc...@gmail.com> wrote:
> > On Fri, Feb 4, 2011 at 10:59 AM, balu <vab...@gmail.com> wrote:
> > > Hi all :)
> >
> > > I'm trying to create a website application using django's built in
> > > authenticaiton app. I had customized the login, logout, signup...
> > > template. But how to customize personal page which will be redirected
> > > after login confirmation. Which will be just how we redirected to our
> > > inbox after autheticated in gmail.
> >
> > Jeje, just talking about that in another thread ;)
> >
> > You should look the "next" parameter in the login form:
> >
> > http://docs.djangoproject.com/en/dev/topics/auth/
> >
> > Or if it will always be the same page, maybe what you're looking for
> > is the LOGIN_REDIRECT_URL setting parameter:
> >
> > http://docs.djangoproject.com/en/dev/ref/settings/#std:setting-LOGIN_...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Restrict access to the whole application

2011-01-26 Thread Brian Bouterse
Maybe this will clear things up, but if not, write back.  In my example an
"application" is a resource inside of a django project, not a django project
itself.  Your description of 'use_appname' is correct.  An app for me is a
model and so I have setup a post_save
signal<http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.post_save>on
that model so that when the model is created the post save signal
ensures
the permission is created.

The permission is then checked when a user goes to use an application using
standard django permission checking.  You could use this same scheme to
limit access to installed django application I could imagine.

Brian

On Wed, Jan 26, 2011 at 9:39 AM, tobik <tobiaspoto...@gmail.com> wrote:

> Thank you for your answer. It is to much information for me and I am
> not sure whether I understand it correctly :)
>
> So basically you create for each application a corresponding
> permission which looks something like 'use_appname'. If the user wants
> to access 'appname' application, he has to have 'use_appname'
> permission. And when these permissions are being created? When
> starting a new application? (./manage.py startapp appname) And Django
> just knows that permission named use_appname belongs to 'appname'?
> It's a part of core? Sorry for my dumb question, I just don't know
> much yet about how does Django work under the hood.
>
> Btw I found also this <http://onecreativeblog.com/post/59051248/django-
> login-required-middleware> which could also solve my problem. It
> wouldn't be difficult to modify the code in order to add support for
> groups.
>
> On 26 led, 14:39, Brian Bouterse <bmbou...@gmail.com> wrote:
> > I've used a post_save signal to create a per-object permission such as
> 'use
> > application X'  This permission is checked at application use time.
> > Here<https://github.com/bmbouter/vdi/blob/master/signals.py>is the
> > code I wrote to do, I think, exactly what you want.  It is part of a
> > django
> > based connection broker <https://github.com/bmbouter/vdi> that manages
> cloud
> > virtual machines to provide applications to users.
> >
> > Best,
> > Brian
> >
> >
> >
> > On Wed, Jan 26, 2011 at 2:11 AM, tobik <tobiaspoto...@gmail.com> wrote:
> > > My first question is whether it is possible to restrict access to the
> > > whole application from one place. I could write @login_required over
> > > every function but is there a better way?
> >
> > > My second question is whether it is possible to use user groups for
> > > restricting applications. I want for example that only users in group
> > > 'teachers' could access the 'teaching' application. I know that groups
> > > are meant for something else but it would spare me a lot of time.
> >
> > > I've just started with Django so be patient with 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
> > > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> <django-users%2bunsubscr...@googlegroups.com<django-users%252bunsubscr...@googlegroups.com>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
> >
> > --
> > Brian Bouterse
> > ITng Services
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Restrict access to the whole application

2011-01-26 Thread Brian Bouterse
I've used a post_save signal to create a per-object permission such as 'use
application X'  This permission is checked at application use time.
Here<https://github.com/bmbouter/vdi/blob/master/signals.py>is the
code I wrote to do, I think, exactly what you want.  It is part of a
django
based connection broker <https://github.com/bmbouter/vdi> that manages cloud
virtual machines to provide applications to users.

Best,
Brian

On Wed, Jan 26, 2011 at 2:11 AM, tobik <tobiaspoto...@gmail.com> wrote:

> My first question is whether it is possible to restrict access to the
> whole application from one place. I could write @login_required over
> every function but is there a better way?
>
> My second question is whether it is possible to use user groups for
> restricting applications. I want for example that only users in group
> 'teachers' could access the 'teaching' application. I know that groups
> are meant for something else but it would spare me a lot of time.
>
> I've just started with Django so be patient with 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
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Django dev server issue

2011-01-04 Thread Brian Bouterse
It sounds like it wasn't able to be reproduced with pdb.  I think that
should be looked into further.

Brian

On Tue, Jan 4, 2011 at 6:57 AM, daniels <daniels0...@gmail.com> wrote:

> Ok, so i used pdb and did a line by line pass, but i didn't get anything.
> All data seems to be normal. I even edited socket.py and did a print on
> data
> to see what's going on and everything seems normal.. :( so i'm left with
> no idea
> I guess i'll have to get used with this hangs.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Django dev server issue

2011-01-03 Thread Brian Bouterse
Have you tried using pdb to debug the call as it arrives?  You could step
through the code, line by line that way to see what is hanging.

My 2 cents,
Brian

On Mon, Jan 3, 2011 at 4:26 PM, daniels  wrote:

> I just tested with sock Python 2.6.6 from the link you gave me and
> also tried with Python 2.7
> and I'm still having this issue. It is really weird. Like i said 3 out
> of 5 page refresh the browser hangs,
> and if i press stop button i get the same exception trowed.
>
> :(
>
> On Jan 3, 9:36 pm, "W. Craig Trader"  wrote:
> > I'm currently developing on Windows 7 (64-bit) with stock Python 2.6.6
> > (32-bit) and Django 1.2.3, and having no problems when running the Django
> > development server from the command line.
> >
> > I'd recommend using the normal Python (
> http://www.python.org/download/releases/2.6.6/) instead of ActivePython
> and
> > see if that improves things.
> >
> > - Craig -
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Jan 3, 2011 at 14:09, daniels  wrote:
> > > Hi,
> > > Unfortunately i did not found the case, and i'm getting it pretty
> > > often, about 3 out of 5 times i refresh the page.
> > > If i leave it loading and i don't stop it it stays like that for about
> > > 30-40 seconds and then the page loads.
> > > I just don't understand what is causing this.
> > > I've restarted the server like 10 time or more from the first time i
> > > got this and i'm still getting it every time i run it.
> >
> > > My Python version is : ActivePython 2.6.6.17 (ActiveState Software
> > > Inc.) based on
> > > Python 2.6.6 (r266:84292, Nov 24 2010, 09:16:51) [MSC v.1500 32 bit
> > > (Intel)] on
> > > win32
> >
> > > and Django: (1, 2, 3, 'final', 0)
> >
> > > I did a lot of dev on Windows 7 before but i never had this issue. So
> > > my thoughts are that this is either
> > > related to this Django version or Python version.
> >
> > > On Jan 3, 5:43 pm, Tiago Almeida  wrote:
> > > > Hi,
> >
> > > > Your files seem fine, I believe.
> > > > Have you found the cause? What version of python and django are you
> > > > using? I also have this issue but it is not often enough for me to
> > > > worry too much. Killing the server and restarting it solves it for
> > > > me..
> >
> > > > BR,
> > > > 
> >
> > > > On 3 Jan, 08:00, daniels  wrote:
> >
> > > > > Here are the relevant files:
> >
> > > > > myproject/urls.py
> > > > > --
> > > > > from django.conf.urls.defaults import *
> > > > > from django.conf import settings
> >
> > > > > # Uncomment the next two lines to enable the admin:
> > > > > # from django.contrib import admin
> > > > > # admin.autodiscover()
> >
> > > > > urlpatterns = patterns('',
> > > > > (r'^$', include('myproject.apps.acasa.urls')),
> >
> > > > > # Dev only
> > > > > (r'^media/(?P.*)$', 'django.views.static.serve',
> > > > > {'document_root': settings.MEDIA_ROOT}),
> >
> > > > > # Uncomment the admin/doc line below to enable admin
> > > > > documentation:
> > > > > # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
> >
> > > > > # Uncomment the next line to enable the admin:
> > > > > # (r'^admin/', include(admin.site.urls)),
> > > > > )
> >
> > > > > myproject/apps/acasa/urls.py
> > > > > ---
> > > > > from django.conf.urls.defaults import *
> >
> > > > > urlpatterns = patterns('myproject.apps.acasa.views',
> > > > > (r'^$', 'index'),
> > > > > )
> >
> > > > > myproject/apps/acasa/views.py
> > > > > -
> > > > > from django.template  import RequestContext
> > > > > from django.shortcuts import render_to_response
> >
> > > > > def index(request):
> > > > > return render_to_response('acasa/default.html',
> > > > > context_instance=RequestContext(request))
> >
> > > > > myproject/templates/base.html
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Myproject - {% block title %}{% endblock %}
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > >  > > > > media="all" />
> > > > > 

Re: Replace URLResolver?

2010-12-28 Thread Brian Bouterse
I don't know why the URL dispatcher doesn't support subdomains.

If I were to guess though, it would be that supporting subdomains and
virtual hosts is typically the responsibility of the web server.  I think
Django didn't want to enable folks to do in python what apache and nginx
already do so well (and in a more optimized way).

my 2 cents,
Brian

On Tue, Dec 28, 2010 at 6:43 AM, Martin <martins...@gmail.com> wrote:

> Hi.
>
> I would like to use subdomains in my URL-dispatch. Thats not supported
> by Django.
>
> Is it possible to replace Django URLResolver with my own? Must this be
> done as a Middleware class?
>
> (Why is Django URL resolver not implemented as a Middleware class?)
>
> Input appreciated.
>
> Thanks.
>
> /Martin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: __init__.py file executed twice ?

2010-12-14 Thread Brian Bouterse
Why do things get started twice in django sometimes?  I see the framework
being started twice here.  Also if you overload the __init__(self): of
models, that too gets called twice.  I've never understood this, but the
singleton pattern seems to provide a nice workaround.

Brian

On Mon, Dec 13, 2010 at 5:19 PM, Mike Dewhirst <mi...@dewhirst.com.au>wrote:

> On Dec 13, 10:57 am, martvefun <martve...@gmail.com> wrote:
> > On 10-12-10 11:09, Mike Dewhirst wrote:
> > > On 10/12/2010 7:43pm, martvefun wrote:
> > >> On 09-12-10 01:37, Mike Dewhirst wrote:
> > >>> It seems like a good place to put it. Maybe you can test to see if
> the
> > >>> threads have been started already?
>
> 
>
> > Thank you, it works if I have to call in the same files (like s1 =
> > singleton() ; s2 = singleton() ) but here I still have two calls
> >
> > class singleton(object):
> >  """ designed by Oren Tirosh and Jeff Pitman """
> >  def __new__(self, *args, **kwargs):
> >  print "call singleton"
> >  if not '_singleton' in self.__dict__:
> > print "first time created"
> > slate = object.__new__(self)
> > slate.state = {
> > 'threads':True,
> > # add other state things as required
> > }
> > self._singleton = slate
> >  return self._singleton
> >
> > singleton()
> > print "Server is now runing"
> >
> > gives me :
> > $ python manage.py runserver
> > call singleton
> > first time created
> > Server is now runing
> > call singleton
> > first time created
> > Server is now runing
> > Validating models...
> > 0 errors found
>
> I just tested it myself and while it definitely works - meaning it
> does return exactly the same object each time - manage.py runserver
> apparently starts the framework twice. Hence you see it twice. I
> noticed that when you edit a file and the dev server automatically
> restarts, the singleton gets recreated but only once as expected.
>
> Here is some research by Graham Dumpleton earlier this year and which
> explains the process in detail ...
>
> http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
>
> If you decide to use a singleton to monitor state you might have to
> look for somewhere safe to start it.
>
> >
> > And anyway I just realised another problem : I'll need to have access to
> > the objects I created from views.
>
> I think it would work from anywhere you can call the code but you need
> to test it.
>
> Mike
>
> > The idea is to send a message to the thread when a certain action is
> > done (like user registration, validate choices...) but to do that I need
> > an access to this object (I cannot create another one because of
> > concurrency safety)
> >
> > Any idea ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: umlaut

2010-11-29 Thread Brian Bouterse
Yes I think a template filter is the right approach.  You could always
define a custom template
tag<http://docs.djangoproject.com/en/dev/howto/custom-template-tags/>.
 I've had to do this before to display currency information multinationally
before.

Brian

On Mon, Nov 29, 2010 at 8:20 AM, Thomas Rega <tho...@googlemail.com> wrote:

> Hi,
>
> is there a recommended way to deal with German 'umlauts' (like ü.ö.etc.)
>
> I was lookingfor some kind of template filter but without success :(
>
> The data is stored as utf-8 format. What I am looking for is an
> automatic transformation into ',  etc.
>
> Is such a template filter the right approach?
>
> Is there a recommended way to do that?
>
> many thanks in advance
>
> TR
>
> --
> --- http://thoreg.org/ ---
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Hosting multiple projects

2010-11-23 Thread Brian Bouterse
We use Opus <https://github.com/bmbouter/opus> to do our django deployments.
 It creates a secure version of the setup described in this thread (with
apache not nginx), and even takes care of deploying the databases also (if
you don't mind postgres).

my 2 cents,
Brian

On Tue, Nov 23, 2010 at 6:14 AM, Graham Dumpleton <
graham.dumple...@gmail.com> wrote:

>
>
> On Nov 23, 8:18 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
> > On Nov 22, 9:42 pm, Todd Wilson <twil...@csufresno.edu> wrote:
> >
> >
> >
> >
> >
> > > I teach a course in which I have students developing unrelated Django
> > > projects on servers of their own choice.  As we near the end of the
> > > semester, I would like to set up a single server where I can host all
> > > of these student projects together.  I will obviously create a new
> > > user, as well as a new mysql account and database, on this server for
> > > each project, and ask the student teams to upload their project files
> > > into the home directories of these accounts.  But what else will I
> > > have to do to make this work?
> >
> > > I suppose I'll have to install the union of all the python libraries
> > > used by the individual projects, but each project will have its own
> > > settings and "local" URL structure, and I'm not sure how all of this
> > > should be coordinated, or what changes I'll have to ask the teams to
> > > make to their own projects to allow this coordination.  (The server is
> > > Apache/mod_wsgi.)
> >
> > > Any recommendations?
> >
> > You might want to take inspiration from the way Webfaction, one of the
> > main Django hosters, do it. They have a central Apache for each
> > server, but they then also have separate Apache instances for each
> > Django user. The main Apache proxies to the individual user instances.
> > Then the users can configure and restart their own Apaches as
> > necessary, without disturbing everyone else on the server.
> > Additionally, the central instance takes care of serving static
> > assets.
>
> They actually use nginx as front end these days and not Apache.
>
> Graham
>
> > As regards libraries, I would encourage you to get your students to
> > use virtualenv. They can then create a requirements.txt file, which
> > encapsulates all the external libraries they need, and you can install
> > everything for each user with a single command.
> > --
> > DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Forking a background process on request

2010-11-04 Thread Brian Bouterse
I would look into django-celery <https://github.com/ask/django-celery> to do
asynchronous tasks.  It can also be executed as a webhooks style, see
here<http://ask.github.com/celery/userguide/remote-tasks.html>
.

Brian

On Thu, Nov 4, 2010 at 3:31 AM, Elver Loho <elver.l...@gmail.com> wrote:

> Hi,
>
> I am working on a web app that creates reports that may take up to a
> minute to generate. (Or longer under heavy loads.) Ideally I would
> like something like this to happen:
>
> 1. User presses a button on the website. Javascript sends a begin-
> report-creation message to the server.
> 2. Report creation begins on the server in a separate process and the
> called view function returns "ok".
> 3. A bit of Javascript checks every ten seconds if the report is done.
> 4. If the report is done, another bit of Javascript loads it into the
> website for display.
>
> My question is - what is the best way of forking a separate process in
> step 2 to start the actual background report generation while also
> returning an "ok" message to the calling Javascript? Or do I even need
> a separate process? What sort of concurrency issues do I need to worry
> about?
>
> Reports are currently generated once every hour by a cron-launched
> Python script. This is working splendidly.
>
> Best,
> Elver
> P.S: Django is awesome! I've only been using it for a couple of days,
> but I gotta say, I've never been so productive with any other
> framework of any kind.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: using strings as fieldnames to save model

2010-11-03 Thread Brian Bouterse
** is part of python the python
grammar<http://docs.python.org/release/2.5.2/ref/grammar.txt>.
 See 
this<http://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-python/>for
more info on how to use * and ** in python

Brian

On Wed, Nov 3, 2010 at 1:52 PM, Thomas M <tome2...@googlemail.com> wrote:

> Ok, thanks.
>
> I'll try it tomorrow.
>
> What is the meaning of the **?
>
> Thanks, Thomas
>
> On 3 Nov., 17:53, Daniel Roseman <dan...@roseman.org.uk> wrote:
> > On Nov 3, 4:17 pm, Thomas M <tome2...@googlemail.com> wrote:
> >
> > > Hi,
> >
> > > I have to save a model with dynamic fieldnames. So the field
> > > identifiers are strings.
> >
> > > Example:
> > > foo  = Genre("genre_id"=2,"name"="ente")
> > > foo.save()
> >
> > > This creates an error. Is it somehow possible to do this with the
> > > model instance?
> > > Or do I have to use custom SQL?
> >
> > > Thanks, Thomas
> >
> > This is invalid Python. You can't use strings as parameter names.
> >
> > What you can do is use a dictionary:
> >
> > values = {genre_id": 2, "name": "ente"}
> > foo = Genre(**values)
> > --
> > DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: write a filter for latex that escapes some chars

2010-10-29 Thread Brian Bouterse
We have done this before and used something like the code below.  This
sample is pretty basic.

   def fixchar(string,char):

#fixes chars for latex

if char == '<':

newchar = '$<$'

elif char == '>':

newchar = '$>$'

elif char == '~':

newchar = '\\~{}'

else:

newchar = '\\' + char

string = string.replace(char,newchar)

return string

On Fri, Oct 29, 2010 at 9:03 AM, SlafS <slaf...@gmail.com> wrote:

> Hi there!
>
> I'm trying to write a filter that can be used inside of a template
> that is used for generating latex files.
>
> The filter should replace the '|' char with '\'. Simple:
>
> @register.filter("verb_safe")
> def verb_safe(val):
>return str(val).replace('|', '\|')
>
> is outputting me '\\|'
>
> I'm littlle confused about that.
>
> Please help
>
> Regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



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

2010-10-26 Thread Brian Bouterse
I can't encourage it *enough*.  This was writen hastily, thanks for the
close read.

Brian

On Tue, Oct 26, 2010 at 1:01 AM, Kenneth Gonsalves <law...@au-kbc.org>wrote:

> On Mon, 2010-10-25 at 16:06 -0400, Brian Bouterse wrote:
> > I really can't encourage the use of Hudson <http://hudson-ci.org/> (or
> > something like it).
>
> 'cant encourage'? or 'can encourage'?
> --
> regards
> Kenneth Gonsalves
> Senior Associate
> NRC-FOSS at AU-KBC
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



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

2010-10-25 Thread Brian Bouterse
I really can't encourage the use of Hudson <http://hudson-ci.org/> (or
something like it).  It's a great tool to plug scripts into, and gives you
added features if configured properly such as running test cases
automatically, giving code coverage reports,
pylint<http://pypi.python.org/pypi/pylint>reports, and if your build
"succeeds" can even roll out your successful
build to the staging servers.

I like to tie our VCS using git-hooks to kick off automated builds of Hudson
with each commit.

In turn, your staging servers could run some smoke tests and then do a
script based automated roll-out using fabric as suggested.  +1 for fabric

+1 on the use of South

Chaining all of these tools together bring together one powerful development
pipeline, but even using them all independently is still very powerful (and
the first step).

my 2 cents,
Brian

On Mon, Oct 25, 2010 at 2:04 PM, Jumpfroggy <rocketmonk...@gmail.com> wrote:

> This is such a great thread!  I'd love to see a wiki page detailing
> some good setup ideas.  It's such a leap forward from the nuts & bolts
> of "How do I install django" and "How do I run a complex query" to
> this... "How do I use django more effectively, end to end?"
>
> I agree - most of these tips will be generic to project dev &
> deployment, but it seems there are a few django specific ones.
>
> My thoughts...
>
> - Use VCS.  First step.  I use SVN, but others are probably better.
> Even if you're a solo dev, even for small projects, it's worth it.
>
> - Definitely have local, test, and prod servers.  Local is where the
> development happens (on your machine).  Testing is where you can test
> the latest commits.  Ideally you'd have continuous integration as
> well, which would also run on the latest revision.  Prod is the live
> site.  If you're a single dev on a small project, you can get away
> with local & prod.
>
> - +1 on using "settings.py" and "local_settings.py".  The problem with
> keeping local settings files in the VCS is when you have multiple
> servers with different settings.  You could store each file as
> local_settings_test_server.py and so on.  Then you could have
> something like "settings_server_name.py" that's not in VCS, and it
> only has:
>
>SERVER_NAME = 'prod'
>
> And in your settings.py:
>
>import * from settings_server_name
>
>if SERVER_NAME == 'prod':
>import * from settings_prod_server
>elif SERVER_NAME == 'test':
>...
>etc
>
> That way almost everything is in VCS, and you only have one file to
> write for each server.
>
> - Try to develop & test on servers similar to your PROD server.  It
> stinks to develop and test, then realize you had python X and PROD
> server is python X - 0.1, which means some features/libraries aren't
> available (or syntax is wrong).
>
> - Use "south" for database changes!  It takes just a bit to get used
> to, but will make database changes (both schema and data) so much
> easier to keep track of.  This is basically what Kenneth Gonsalves
> described, but in reliable/convenient/automated form.  It's amazing.
> Go south!  Use south!  (don't think about dmigrations.  It does not
> exist.)
>
> - Use some kind of deployment script.  I wrote my own and it's simple
> and awesome.  You can also use something like fabric, which seems
> complicated but is very useful.  Add things like "svn update force" to
> update a repsitory, "touch *.wsgi" to reload the app, "python
> manage.py migrate" to update any DB changes (using south), etc.
> Anything you'd do on the server, create scripts for.  Even stuff like
> "copy PROD DB to TEST server", so you have real data to play with.
>
> That's what I can think of at the moment.  It'd be nice to have a
> "best practices" page on the django site, since a lot of these
> suggestions will be repeated for most users.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Security

2010-10-25 Thread Brian Bouterse
Thanks for the info!

Brian

On Mon, Oct 25, 2010 at 8:44 AM, Tom Evans <tevans...@googlemail.com> wrote:

> On Mon, Oct 25, 2010 at 1:17 PM, Brian Bouterse <bmbou...@gmail.com>
> wrote:
> > I'm not an expert in security, but here is how I would answer the
> question.
> >  The CSRF approach that Django 1.2 implements would prevent *most* of
> these
> > problems since the attack wouldn't be able to POST new data to the site
> by
> > stealing the cookie alone.  IBM applies CSRF tags to each step the user
> > interacts with on the entire site, in a technique known as continuations.
> >  These techniques only prevent *most* attacks though, the session can
> still
> > be hijacked just with a reduced window of opportunity.
> > I say *most* because if you can snoop on the HTTP traffic, you
> theoretically
> > could capture the in-plain-text CSRF token the server handed the user
> once
> > they were generated one (from being on a user account to reset my
> password
> > page).  An attacker could form a valid POST using the CSRF just captured
> and
> > I think it would work.
> > Not even validating that the IP is the same for each CSRF would solve the
> > problem either considering these two users are probably going to be in a
> > coffeeshop, behind a NAT.
> > One possible solution would be to have some kind of hardware attestation
> or
> > browser attestation and tie session info to that.  If anyone has any
> > thoughts on how this could be done, please let me know.
> > Brian
> > On Mon, Oct 25, 2010 at 6:47 AM, cootetom <coote...@gmail.com> wrote:
>
> It's actually orthogonal to CSRF. CSRF protects you from a 3rd party
> web site maliciously enticing a user to initiate data changing
> requests to your site. It does nothing to protect a user from having
> their cookies jacked by a 3rd party user, and then stopping that user
> from maliciously using the credentials inferred from those cookies.
>
> That this is even news is surprising - it's hardly a new attack
> vector. The only new thing about it is it being hooked up to a web
> browser and showing live feeds of what is happening, which has
> probably opened the eyes of people who didn't think about it before.
> It's like saying 'Oh wow, you can see in plain text peoples emails on
> unsecured wifi networks' - well, durr, its a plain text protocol, and
> the whole 'unsecured nework' bit should probably give it away...
>
> If you don't want this to happen, then force the use of SSL throughout
> your site, and don't hand out session cookies over HTTP.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Security

2010-10-25 Thread Brian Bouterse
I'm not an expert in security, but here is how I would answer the question.
 The CSRF approach that Django 1.2 implements would prevent *most* of these
problems since the attack wouldn't be able to POST new data to the site by
stealing the cookie alone.  IBM applies CSRF tags to each step the user
interacts with on the entire site, in a technique known as
continuations<http://www.ibm.com/developerworks/library/j-contin.html>.
 These techniques only prevent *most* attacks though, the session can still
be hijacked just with a reduced window of opportunity.

I say *most* because if you can snoop on the HTTP traffic, you theoretically
could capture the in-plain-text CSRF token the server handed the user once
they were generated one (from being on a user account to reset my password
page).  An attacker could form a valid POST using the CSRF just captured and
I think it would work.

Not even validating that the IP is the same for each CSRF would solve the
problem either considering these two users are probably going to be in a
coffeeshop, behind a NAT.

One possible solution would be to have some kind of hardware attestation or
browser attestation and tie session info to that.  If anyone has any
thoughts on how this could be done, please let me know.

Brian

On Mon, Oct 25, 2010 at 6:47 AM, cootetom <coote...@gmail.com> wrote:

> Hi, a firefox extension was recently released to grab session ID
> cookies from a private network for the popular sites like facebook etc
> You can read about it here http://goo.gl/x4Z1
>
> I was wondering how Django sits with this type of attack. I know there
> are the CSRF tokens, do they prevent this though? I thought they were
> just for form posts?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: how can i wsdl file in my django

2010-10-25 Thread Brian Bouterse
yes

Maybe next time put a little more effort into writing your response and
you'll get a better answer.

On Mon, Oct 25, 2010 at 6:58 AM, sami nathan  wrote:

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

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



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

2010-10-22 Thread Brian Bouterse
There are whole books devoted to this topic, which is more of an industry
best practices question than a django question.  Personally I like
this 
book<http://www.amazon.com/Continuous-Integration-Improving-Software-Reducing/dp/0321336380>on
continuous integration.  If not that one try googling for "continuous
integration"

Brian

On Fri, Oct 22, 2010 at 11:02 AM, Ken <ken.kyhu...@gmail.com> wrote:

> *I've Googled, but have not found any really organized and layman-
> friendly overview, which is why I came here*
>
> I know how to get python/django working on my computer (PC or Mac) and
> have developed simple test apps using django's built-in dev server and
> a mysql back-end. So I can get things to work and don't need help on
> installing stuff.
>
> But as a coding hobbyist, I don't know how to set up a pro workflow. I
> don't know best practices on how to setup and maintain a dev and
> production environment, how to efficiently publish to production, how
> to integrate all that into a version control system (i.e., git),
> basically anything that a pro coder at a startup would take for
> granted as "the way to do things".
>
> I understand there are many different ways and products to use to
> setup a great workflow for developing in django, but would like to
> hear how you or your startup team (or corporate dev group) does it.
> Specifics would be amazing, as I need a little hand holding, i.e.
> please cover anything and everything that I should know in order to
> develop efficiently, robustly, and eventually collaboratively.
>
> Basically, please explain it in a way that a layman can follow the
> steps and setup a workflow without pulling his hair out. =P
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Hosting many small Django websites

2010-10-15 Thread Brian Bouterse
One of the challenges of going the GAE route is that you need to modify your
application slightly to work with their version of models.  Also, you can't
ever run this code off of GAE, so it's kind of a lock-in in that respect.
 That being said it does work very well.

Brian

On Thu, Oct 14, 2010 at 11:09 PM, Venkatraman S <venka...@gmail.com> wrote:

>
> On Fri, Oct 15, 2010 at 2:15 AM, Diederik van der Boor 
> <vdb...@gmail.com>wrote:
>
>>
>> I'm curious about using Django for many small web sites. Does this
>> require each site to run in a separate wsgi daemon process? If so, how
>> is it possible to keep memory usage shared?
>>
>
> Not exactly sure when you have to manage the linux box, but if you have to
> manage many small sites, i would recommend GAE.
> Best for deploying and managing(non sysad work) them without any hassles.
>
> -V-
> http://twitter.com/venkasub
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: Hosting many small Django websites

2010-10-14 Thread Brian Bouterse
We host many of our django sites using a django deployer we wrote called
Opus <http://github.com/bmbouter/opus>.  Opus uses a separate wsgi daemon
process for each site.  Each wsgi process also runs a separate user, so
linux would prevent the memory from being shared.  In our case though we
want to run code from many different sources and if they all ran as the same
user, then one django project could monkey patch another one which creates
all kinds of interesting security issues.

Brian

On Thu, Oct 14, 2010 at 4:45 PM, Diederik van der Boor <vdb...@gmail.com>wrote:

> Hi,
>
> I'm curious about using Django for many small web sites. Does this
> require each site to run in a separate wsgi daemon process? If so, how
> is it possible to keep memory usage shared?
>
> Thanks in advance,
>
> Diederik
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: What is the best way to implement time-based / cronjob actions in a Django app?

2010-10-13 Thread Brian Bouterse
arate process running on the same
> machine as your application.
> > B. The Celery daemon uses the same config info (probably the same
> config file) as your application.
> > C. The Celery daemon polls the broker regularly, looking for tasks.
> > D. When the daemon retrieves a task, it runs it, using the code in
> your application's "tasks" files.
> >
> > Basic working example:
> >
> > 1. You have a function in your tasks.py called update_user. It
> accepts an integer as its only argument, which should be the primary key of
> a user in your User table. It is decorated by the Celery decorator "task."
> >
> > @task
> > def update_user(pk):
> >
> > #trivial sample function
> > user = User.objects.get(pk = pk)
> > user.last_login = datetime.now()
> > user.save()
> >
> > 2. Your application imports your update_user function from your
> tasks file. One of your views calls it like this:  update_user.delay(
> request.user.pk).
> > Note that the delay() method is of the Celery task decorator.
> > This call to update_user.delay() returns a UUID which you may
> store for later retrieval of the results.
> >
> > 3. Celery passes a serialized version of this function call to
> the broker. Something like a plain-text "update_user(123)."
> >
> > 4. The Celery daemon, in its continual polling process, is handed
> a message containing something like 'update_user(123).' It is aware of the
> update_user function because it has been configured to use the task files in
> your application, so it calls your update_user function with the argument
> 123. At this point your code runs. The celery daemon records the result
> using whatever method specified in your Celery config file. This could be in
> MongoDB, passed back to the broker, or several others. Optionally, if the
> code execution fails, Celery may e-mail you.
> >
> >5. (Optional) Your application uses the UUID it received in step 2
> at a later time to ascertain the status of the job. If the result was stored
> with the broker, then it may only be retrieved once; it is considered just a
> plain-old plain-text "message" to the broker, and after being passed on it
> is no longer stored. If the result was stored in a database (such as
> PostgreSQL or MongoDB), then you can request it repeatedly.
> >
> > I hope this helps, and that others will correct me where I'm blatantly
> wrong. I have intentionally simplified some things so that the basic flow is
> more understandable; much more complex setups are possible, especially ones
> which allow multiple servers to run Celery daemons (and individual servers
> to run multiple daemons). For example, you may have one server handle
> communication tasks (such as sending e-mail and SMS messages), while another
> server handles processing of images. It may be beneficial to do one on your
> application server (where your Django app lives), while doing the more
> resource-intensive stuff (such as transcoding video uploads) on another
> machine.
> >
> > Shawn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: What is the best way to implement time-based / cronjob actions in a Django app?

2010-10-13 Thread Brian Bouterse
I would be willing to give an overview.  Basically you should:

1) yum or apt-get install rabbitMQ
2) make sure the service is started.
3) Set up your broker by running these 3
commands<http://ask.github.com/celery/getting-started/broker-installation.html#setting-up-rabbitmq>
.
4)  pip install django-celery
5)  follow steps 1-4 on this
page<http://celeryq.org/docs/django-celery/getting-started/first-steps-with-django.html#configuring-your-django-project-to-use-celery>to
get your django project to be celery aware
6)  Run at least 1 celery worker like
this<http://celeryq.org/docs/django-celery/getting-started/first-steps-with-django.html#running-the-celery-worker-server>
7)  Define and execute a task.  try
these<http://celeryq.org/docs/django-celery/getting-started/first-steps-with-django.html#defining-and-executing-tasks>
.

Best,
Brian


On Wed, Oct 13, 2010 at 4:11 PM, ringemup <ringe...@gmail.com> wrote:

>
> > It's surprisingly easy to get set up with nothing more than the
> tutorial/into for django-celery. If anyone has problems with it I'd be happy
> to try to assist.
>
> Thanks, I might take you up on that.
>
> > Although getting everything working is fairly easy, in my opinion the
> docs aren't too clear on how the big picture really works for first-timers.
>
> Yeah, that's a big reason I never tried to use it.  Would you be
> willing to share a high-level overview with us?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: What is the best way to implement time-based / cronjob actions in a Django app?

2010-10-13 Thread Brian Bouterse
I have found cron to be a poor solution for this although it is tempting
since it is so easy and will get you started right away.  What I observe
happens is, basically someone puts the cron job in crontab, and then a lot
of time passes, and folks forget which machine in the cluster is actually in
charge of the cron job.  Eventually that machine gets rebuilt or
re-deployed, and then folks wonder why stuff mysteriously stops working.
 This has happened at least 3 times over the years at different places I
have worked at.  (I'm a site reliability engineer).

Cron is a fine solution, but it's such a single-point solution that it is
fragile over time because folks forget about it, and it has a single point
of failure.  my 2 cents.

Brian

2010/10/13 Ethan Poole <et...@lowter.us>

> Another technique, that I feel should be pointed out, is a custom
> django-admin command:
> http://docs.djangoproject.com/en/dev/howto/custom-management-commands/.
> If you are going to use a crontab to run a Python script, this is by
> far the easiest way to do it.
>
> On 13 Okt, 10:53, ringemup <ringe...@gmail.com> wrote:
> > You can also use this technique[1] to create a python script that you
> > can call from your crontab.  Basically, you can call anything in
> > Django from any Python script as long as you set the
> > DJANGO_SETTINGS_MODULE environment variable first and have Django,
> > your project, and your apps on your path.
> >
> > [1]http://www.nerdydork.com/django-cron-on-webfaction.html
> >
> > On Oct 13, 10:47 am, Jo <reduxion...@me.com> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > On 13 ?.?. 2010, at 18:50, Jonathan Barratt wrote:
> >
> > > > On 13 ?.?. 2010, at 18:38, Mattias Linnap wrote:
> >
> > > >> Hi Django users,
> >
> > > >> I'm building an application with Django, and I need some database
> > > >> changes to occur at certain times in the future - independently of
> any
> > > >> web request. Things like cleaning up expired sessions, deleting
> > > >> expired user actions, etc.
> >
> > > >> What is the best way to implement those?
> >
> > > Having now checked it out for use in my own project, the '"Celery"
> suggestion that's been made to you definitely sounds like the most 'correct'
> way to implement this. Thanks Tom and Brian!
> >
> > > It is, however, as Tom admitted, rather complex. I had another idea
> that I figured was worth throwing out there for your consideration as it's a
> lot easier and faster to implement, though correspondingly not nearly as
> flexible or powerful: just use the *nix command "at." When someone reserves
> an item just execute something along the lines of: (os.popen.) popen('echo
> "COMMAND "'  + PARAMETERS + ' | at now + 2 hours'
> >
> > > This is nowhere near as robust or efficient as I'm sure Celery is, but
> it's so much simpler and quicker that I thought it worth mentioning in case
> you don't have the time to get Celery going right away and need something to
> use for demo\testing purposes in the meantime...
> >
> > > Just a thought,
> > > Jonathan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: HTTP load testing tools?

2010-10-13 Thread Brian Bouterse
I have used Tsung <http://tsung.erlang-projects.org/> before, and liked it.
 It's written in erlang so it's natively distributed which means with a
cluster of machines you can generate a LOT of traffic.  ;-)

Brian

On Wed, Oct 13, 2010 at 4:17 AM, Chris Withers <ch...@simplistix.co.uk>wrote:

> Hey all,
>
> I hope this is still on topic, but what tool sets do people around here use
> for doing load testing of Django projects?
>
> cheers,
>
> Chris
>
> --
> Simplistix - Content Management, Batch Processing & Python Consulting
>   - http://www.simplistix.co.uk
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: What is the best way to implement time-based / cronjob actions in a Django app?

2010-10-13 Thread Brian Bouterse
You really should take a look at
django-celery<http://celeryq.org/docs/django-celery/getting-started/first-steps-with-django.html>.
 It is the right tool for this job IMHO.

Brian

On Wed, Oct 13, 2010 at 7:38 AM, Mattias Linnap <matt...@linnap.com> wrote:

> Hi Django users,
>
> I'm building an application with Django, and I need some database
> changes to occur at certain times in the future - independently of any
> web request. Things like cleaning up expired sessions, deleting
> expired user actions, etc.
>
> What is the best way to implement those?
> 1) Make a special view, like /cron/, that performs all the scheduled
> actions, and use an external script to poll it over HTTP regularly.
> Cons: there might be a request timeout in the web server, so only a
> small number of very fast actions are possible.
> 2) Use standard linux cron, and write a script that calls ./manage.py
> with custom commands. Cons: is it a good idea to use manage.py
> commands in production?
> 3) Try to avoid any time-based database changes, and rewrite the app
> so that data objects know if they are "too old". Cons: makes the rest
> of the app more complex.
> 4) Something else?
>
> If a bit of background might be useful, I'm building an online sales
> app where users can reserve products for up to 2 hours. When the 2
> hours is over, the product is marked as available again. It would be
> possible to compute the availability of each product based on the list
> of reservations instead of caching it at the object, but this would
> require looking through all reservations and sales ever made to know
> the current state of a product.
>
> Thanks for any advice,
>
> Mattias
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Django structure and git as VCS

2010-10-07 Thread Brian Bouterse
Maybe not an exact answer to your question, but we do something kind of
similar to what you are describing.  Basically, we have app authors (both
frontend and backend) work with their app in their own repo and publish them
into this repository <https://apps.opus.ncsu.edu/>.  Then we use
Opus<http://github.com/bmbouter/opus>to deploy them onto our servers
since it is connected to the app repository
where their apps are published Opus provides a self service deployment
interface.  You can even test your deployments on our sandbox
servers<https://sandbox.opus.ncsu.edu/>
.

Brian

On Thu, Oct 7, 2010 at 8:25 AM, Piotr Zalewa <zal...@gmail.com> wrote:

>  Hi,
>
> I'm working on defining the structure of an application
> It will have quite a few apps, with few of them opensourced.
>
> I was thinking how to make it easier for people involved into the project.
> In essence front-end developer should work on one repository only -
> that's also goes quite nicely with app portability and would also help
> if an idea about whitelabelling the project could come to someone's mind.
> Other apps will be installed via pip under the virtual environment and
> will be a separate repositories in git.
> Back-end devs then will work each one on the application back-end and on
> the front-end application, to provide some changes to the functionality.
>
> Basically:
> project - one repository
> front-end app - one repository
> apps - a repository for each one.
>
> I'd like to implement a slightly modified V.Dressen's model of the
> workflow - in draft explained here:
> https://wiki.mozilla.org/Labs/Jetpack/FlightDeck/Code_Workflow on each
> of the repositories
>
> Do you think it's best structure?
> And, quite important, will it not look like a mess for an "average"
> developer?
>
> Piotr
>
> --
> blog  http://piotr.zalewa.info
> jobs  http://builder.mozillalabs.com, http://jsfiddle.net
> twit  http://twitter.com/zalun
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: django graphs

2010-10-06 Thread Brian Bouterse
I've used the 
google-chartwrapper<http://code.google.com/p/google-chartwrapper/>with
some success, maybe they have a chart type that would work for you.
It
has support for the Django template language seen
here<http://code.google.com/p/google-chartwrapper/wiki/TemplatingLanguages>
.

Best,
Brian

On Wed, Oct 6, 2010 at 9:42 AM, ashy <ashwinmo...@gmail.com> wrote:

> Thanks guys!!
>
> I am basically looking for a dynamic line graph, where in the points
> on the x axis and the points on the graph are clickable. Also, I want
> it to be integrated with the django app I am working.
>
> thanks
>ashy
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Relationship between multiple sites & projects, apps

2010-09-23 Thread Brian Bouterse
We've got 4 domain names which all comprise a single website.  We went with
the second option where each domain is its own django project with a single
app in it.  We liked this option for two reasons.

1)  We wanted apache virtual hosts to be handling the decision about which
entry point to use instead of directing all traffic to a single django
project and letting the python (which we believe to be less performance
optimized than the apache method).  This was a performance decision.

2)  We also wanted the ability to flexibly grow the infrastructure backing
different domains.  Basically it is easier for us to handle traffic to
different areas of our site since we can always break out more servers to
handle different virtual hosts.  If it was all one django project I don't
think you could allocate infrastructure this granularly.

my 2 cents, but I'd love to hear what others think about these things

Brian

On Thu, Sep 23, 2010 at 5:00 AM, Benedict Verheyen <
benedict.verhe...@gmail.com> wrote:

> Hi,
>
>
> it's not exactly clear to me how the sites, projects and apps need to be
> structured.
>
> For instance, if you have 2 sites both with a domain name, how would you
> structure
> this in Django?
> The Django project could be called "mysites" or whatever name.
> In the admin site, you would then have 2 sites. So far so good.
> But how would you represent the sites?
> Do you make an application per site as each site could do something
> specific.
> Then you end up with this structure.
> Is this how it is meant to be?
> -- mysites (project)
> -- site 1 (app)
> -- site 2 (app)
>
> The only downside might be if both sites have loads of users, they are all
> displayed in the same list
> in the admin interface.
> Also, if you couple this with django-registration, it might not be that
> simple to let a user register
> for site 1 as well as site 2. I have no practical experience with
> django-registration but it seems
> like something i would use in the future.
>
> Or is it better to split the sites over 2 projects, so you have a project
> per site?
> -- site 1 (project)
> -- site 1 (app)
> -- site 2 (project)
> -- site 2 (app)
>
>
> Thanks for any insights,
> Regards,
> Benedict
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: urls.py best practices

2010-09-22 Thread Brian Bouterse
Have you looked at
REST<http://en.wikipedia.org/wiki/Representational_State_Transfer>
style
URI's?  With REST the action (aka verb) is never contained in the URL and is
instead enumerated by the HTTP method type (ie: GET, PUT, POST, DELETE).
 This produces a much cleaner, more useful, more straightforward URI.  It
would look more like:

Method Type:URI
GET 
PUT 
POST   
DELETE   

There are also some challenges when implementing REST too, but I just wanted
you to be aware of it.

Brian

On Wed, Sep 22, 2010 at 7:20 AM, jayfee <josh.sa...@gmail.com> wrote:

> so i'm using django to do some "CRUD" type stuff, but i'm avoiding
> using the generic create_update methods because i've found my
> relationships and data types don't always fit neatly enough to work.
> anyway, the piece that i'm trying to tackle now is getting a clean
> routing system going. here's how i'd like it to work:
>
> urls are formated like:
>
> //
>
> id is optional. examples:
>
> /person/create : create a new person
> /place/update/2: update an existing person with id 2
> /thing/delete/2: delete an existing person with id 2
>
> i wonder if there are any examples floating around that talk about
> this pattern and cleans ways to implement it as far as the routing
> portion goes.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: REST XML + HTML API suggestions

2010-09-21 Thread Brian Bouterse
I typically check the content type and have the response match the content
type of the incoming request.  I also typically have this be the only
decision that lives within views.py, and in turn calls out to code in other
modules to handle xml and/or html presentation respectively.  Also, I would
recommend using an xml processing/generating library.

Brian

On Tue, Sep 21, 2010 at 1:39 AM, Brendon <brendon.j.co...@gmail.com> wrote:

> Hi all,
>
> I want to use DJango to implement an XML based RESTful API and a
> website together using DJango. I am wondering if anyone here is aware
> of any tutorials on ways of achieving this in DJango without
> duplicating too much code?
>
>
> Basically what I want to achieve is to use the same core logic for
> both the website and the API and just have different presentation
> layers for the two systems. I have not seen any tutorials or the like
> on doing this sort of thing and was wondering if people here have
> suggestions on best approaches or tutorials that might show good ways
> to structure this.
>
> The idea is that all interaction using the API uses XML. The POST data
> sent to the server and responses from the server are all using an XML
> schema that we have designed for our application. All interaction with
> the website is the same but uses normal web forms etc for the
> interface of the presentation layer.
>
> Example API:
> * GET   : https://mywebsite/api/rooms/ : List available rooms, returns
> XML with a list of Room ID's
> * POST : https://mywebsite/api/room/  : Create a new room, raw POST
> data is XML with the parameters required to create a room, on success
> returns a Room ID
> * GET   : https://mywebsite/api/room// : Retrieves details
> about an existing room
> * POST : https://mywebsite/api/room// : Modifies details for
> an existing room
> * DELETE : https://mywebsite/api/room// : Delete a room
>
> Now, on the website side of things I want to do exactly the same but
> as part of a a nice HTML site (with menus for navigation, nice graphs
> to display relevant data etc).
>
> Example Web:
> * GET   : https://mywebsite/web/rooms/ : Displays a page with a list
> of links to available Rooms.
> * GET   : https://mywebsite/web/room/   : Displays a page with a form
> requesting input of all necessary data to create a new room.
> * POST : https://mywebsite/web/room/   : Create a new room. POST data
> comes from form displayed previously (on error redisplays form). On
> success redirects the user to the details page for that room.
> * GET   : https://mywebsite/web/room// : Displays details
> about an existing room and provides it in a form that can be used to
> change the data with a POST
> * POST : https://mywebsite/web/room// : Modifies details for
> an existing room
> * DELETE : https://mywebsite/web/room// : Delete a room
>
>
> Thanks,
> Brendon.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Launching Background Processes from a View

2010-09-16 Thread Brian Bouterse
Yes, python multiprocessing can spawn background threads.  Just spawn the
thread and don't join() it.  You could also call things linux things like
nohup through the python process module.

On Thu, Sep 16, 2010 at 10:11 AM, Heath <he...@brownbarn.com> wrote:

> My eventual solution was to just rework the way my watcher scripts
> execute. I now use celery and rabbitMQ, and let pyInotify send a new
> job to any available worker. For my application, 20 or so workers is
> fine and this can scale as needed.
>
> I'm still looking for a definitive answer on whether  the built-in
> process
> modules cannot launch and detach a process in the background, (ala
> "nohup   &" ) and return control to the view.
>
> Thanks for the responses.
>
> -h
>
>
>
>
> On Sep 6, 12:05 pm, kmpm <pe...@birchroad.net> wrote:
> > I have been using Celery some and from what I got I thought the
> > concurrency/workers in the config controlled how many processes that
> > would be at maximum started from the worker that checks the queue but
> > I could be wrong. Another twist on the celery thing is that you could
> > actually have several machines looking at the same config+queue and
> > spreading the load among them and if the queue grows to big you could
> > start up even more servers/machines dealing with the increased load
> > until things cool down again.
> > This is a blog entry I found talking about some of the advantages of
> > Celery.
> http://ericholscher.com/blog/2010/jun/23/large-problems-django-mostly...
> >
> > /kmpm
> >
> > On Sep 6, 7:20 pm, Heath <he...@brownbarn.com> wrote:
> >
> > > Thanks! yes,
> >
> > > os.system() will launch the process and return control, but then I'd
> > > have to write a utility to get the PID and other data about the
> > > process.
> >
> > > I guess I'm looking for a definitive answer that the built-in process
> > > modules cannot launch a process in thebackground.
> >
> > > Here are my findings:
> >
> > > subprocess.Popen and multiprocessing offer properties and methods
> > > ideal for my task, but won't return to the view until the process
> > > ends.
> > > Daemonizing these will allow the calling script (django, in this case)
> > > to quit, but still won't return from the view.
> >
> > > celery/gettoq/rabbitMQ allows for the creation of a queue, but you
> > > must specify a predefined (as far as I know) number of workers in the
> > > config. This is great for processor-intensive tasks that may only run
> > > for a short period of time, as the worker pool stays the same size,
> > > and processes new requests when there is a worker available. But, in
> > > my case, the processes are not doing much until there is folder
> > > activity, and I need to add worker instances dynamically.
> >
> > > I feel like I'm just missing something..Launchingsystem processes
> > > must be a common idiom for a web app, no?
> >
> > > I do appreciate the response,
> >
> > > -heath carlisle
> >
> > > On Sep 6, 12:25 am, Aljoša Mohorović <aljosa.mohoro...@gmail.com>
> > > wrote:
> >
> > > > On Mon, Sep 6, 2010 at 7:19 AM, Heath <he...@brownbarn.com> wrote:
> > > > > What I require seems simple, just run the requested process in the
> > > > >background. The terminal equivalent would be:
> >
> > > > > "nohup   &" and return control to the view.
> >
> > > > > Any ideas on how to achieve this?
> >
> > > > if this already works in a shell is there some reason why
> > > > "os.system('cmd')" or something similar doesn't work for you?
> >
> > > > Aljosa Mohorovic
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



Re: Overridden Model __init__ being called twice

2010-09-09 Thread Brian Bouterse
The first request is the actual request and its stack
trace<http://pastebin.com/t3v2jVHK> shows
the work being kicked off by the request handler.  The second request stack
trace <http://pastebin.com/iS2aVWY5> is actually coming from a the use of
the inlines functionality in the OrderOpportunityAdmin class.

I know I could do some stack inspection using the inspect
module<http://docs.python.org/library/inspect.html>,
but in the past using inspect has gotten me into trouble so I try to avoid
it.  *Anyone have any thoughts on how I can have my __init__ tell the
difference between the two times it is loaded besides using inspect*?  Also,
why doesn't the formset formation use the already instantiated model object?

Brian

On Thu, Sep 9, 2010 at 3:42 PM, akaariai <akaar...@gmail.com> wrote:

> On 9 syys, 20:06, bmbouter <bmbou...@gmail.com> wrote:
> > I have a model defined named OrderOpportunity where I have overridden
> > __init__(self).  I have included the relevant parts of the Model below
> > as an example.  What I want to understand is why the overridden
> > __init__ is being called twice for the creation of a single
> > OrderOpportunity DB record.
> >
> > In models.py:
> > class OrderOpportunity(models.Model):
> > def __init__(self):
> > models.Model.__init__(self)
> > print 'foo'
> >
> > In admin.py:
> > class OrderOpportunityAdmin(admin.ModelAdmin):
> > inlines = (ProductForSaleAdmin,)
> >
> > I enter the admin interface and go to add an OrderOpportunity.  Prior
> > to saving the OrderOpportunity instance, I see the following output
> > from python manage.py runserver:
> >
> > Development server is running athttp://127.0.0.1:8080/
> > Quit the server with CONTROL-C.
> > foo
> > foo
> > [09/Sep/2010 09:33:50] "GET /admin/bulk_buying_club/orderopportunity/
> > add/ HTTP/1.1" 200 9164
> > [09/Sep/2010 09:33:50] "GET /admin/jsi18n/ HTTP/1.1" 200 1761
> >
> > I see foo printed twice which seems strange to me.  Can someone
> > provide some insight into two questions I have.  1)  Why is __init__
> > being called twice?  2)  Why is jsi18n is also being called when I
> > only load the page once?
>
> I can answer the jsi18n part: This is to do with loading translations
> for the javascript used in Admin. That is, this is loaded because
> there is  in
> the loaded page somewhere.
>
> Why the model is initialized twice? Try: import pdb; pdb.set_trace()
> in the __init__ and you will see why that happens.
>
>  - Anssi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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