Re: drawing diagrams in django?

2009-01-10 Thread Malcolm Tredinnick

On Sat, 2009-01-10 at 12:58 -0800, Jeff Hammerbacher wrote:
> Hey Alistair,
> 
> For static image generation, I've used pygraphviz
> (http://networkx.lanl.gov/pygraphviz/), a Python interface to AT's
> graphviz library.

pydot is another Python library for working with Graphviz. Whichever one
you might prefer (and I found them to be fairly similar, although I've
probably used pydot a little more just because an old client used it),
it's certainly a good approach for things like flowchart processes,
since they are pretty easily expressible as graphs.

Somebody else in the thread mentioned SVG, which is also a possibility.
You'll have more control over the fine details of the results, at the
cost of having to do more work to actually produce things. SVG being a
low-level drawing API, Graphviz's dot language being a higher-level API
for specifying graph-like structures. Probably the nicest svg bindings
these days are the rsvg ones (Python bindings for the C-library
librsvg). They use cairo as the output library, which gives very nice
results.

If it was me, I'd start by looking at the graphviz approach, since it
fits the problem description most naturally.

Regards,
Malcolm



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



Re: Model Updates. use save() or signals

2009-01-10 Thread Malcolm Tredinnick

On Sat, 2009-01-10 at 22:26 -0800, juice wrote:
> I am having trouble with setting up a pre_save signal. I want to be
> able to set a location in a model instance, but only have 1 entry at
> any time. I thought about just overriding the save, and adding an
> update something like:
> 
> def save(sefl):
>oa = Article.objects.filter(location=self.location)
>oa = oa[0]
>oa = oa(location=0)
>oa.save()
>super.save()
> 
> Something so that it will find the old object with that location, set
> it to 0, then continue with the new updated one. This is having
> problems on the queryset operations.

Define "problems". It did nothing? It raised an exception? Your computer
caught on fire? It will use understand what the underlying issue is.

One thing that does jump out is you'll almost certainly need to handle
the oa == self case, since that will infinitely loop, by the looks of it
(once you fix the various syntax errors in the above).

> I then figured it may run into a loop of saving the same model, so i
> was going to use signals but ran into the same issue that it would
> still need to be in the save function.

Are you talking about the infinite loop problem here? I don't understand
this paragraph.

Regards,
Malcolm


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



Re: Form object has no attribute 'save' ( form.is_bound returns true )

2009-01-10 Thread Malcolm Tredinnick

On Sat, 2009-01-10 at 21:38 -0800, Dmitri13 wrote:
> Hi Guys,
> I am unable to save to table TEST_QST   ,it returns error  QstForm
> object has no attribute 'save'
> I have confirmed that
> form.is_bound returns true
> form.is_valid returns true
> I have included my code in this post
[...]
> # Create the form class.
> class QstForm(forms.Form):
>qst_id = forms.CharField(max_length=8,widget=forms.HiddenInput)
>test_id = forms.CharField(widget=forms.HiddenInput)
>test_cat_id =forms.CharField(widget=forms.HiddenInput)
>qst =   forms.CharField
> (max_length='200',widget=forms.Textarea ,label='')
>status = forms.CharField(widget=forms.HiddenInput)
>active = forms.BooleanField(widget=forms.HiddenInput)

There's nothing too mysterious going on here. QstForm is a subclass of
forms.Form. The Form class doesn't have a save() method, since saving
doesn't make sense. What would it save to? ModelForms have a save
method, since they're proxying for the underlying model and you can save
a model.

For a normal Form, after validating, it's up to you to decide what to do
with the data in cleaned_data. You could put that into one or model
objects and save them. Or do something entirely different with it.

Regards,
Malcolm


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



Re: Where are all the Django jobs?

2009-01-10 Thread Malcolm Tredinnick

On Sat, 2009-01-10 at 15:38 -0700, David Lindquist wrote:
> First, I understand that the world economy is in a slump, and that  
> the job market as a whole has not fared well of late. But even before  
> the recent downturn, I noticed that there are precious few jobs in  
> Django development (yes, I know about DjangoGigs.com). A simple  
> keyword search on popular job boards shows that the number of Ruby on  
> Rails jobs outnumber Django easily by a factor of 10 or 20. True,  
> Rails has been around longer, but not by much (a year maybe?).
> 
> So my question to the group is: if Rails has been widely adopted in  
> the enterprise, why hasn't Django? Do you think Django will catch on?  
> Or do you think it will be more of a "boutique" framework?

There are some slight problems with your methodology. Large companies
adopting something like Django aren't necessarily going to be posting to
djangogigs.com or places like that. They'll already have competent
programmers in-house to do the work. Or they'll hire through more
traditional channels. So it might well be that Django is more heavily
used in large organisations than Rails and all the Rails jobs you see
being advertised are because there are lots more gigs at the smaller
end.

I have no evidence to support this either way, but it's always tough to
estimate "the number of people using X" by the job advertisements
without a lot more controlling of factors.

It's probably a mistake to base your entire career for any period of
time on only doing Django work unless you have some long-term contract
or permanent position already lined up. But it's not a bad skill to have
in your bag of tools, since many other problems that contractors are
asked to solve can be solved using that particular skill. Keep in mind
that keyword searches only find offerings where the client/employer has
already picked the solution and is trying to backfill a lack of skills
and hoping desperately that adding more people or bringing in new people
won't make things worse than they are (hiring contractors is very
risky). There are many other positions where the hirer is in a position
of having a problem and after a solution. That's where the experienced,
all-around consultant can often add genuine value.

Over the years, Python job advertisements have lagged behind other,
trendier areas. It's led to some perception problems, particularly when
trying to "sell" Python-based solutions to more conservative outfits.
But you can only hold one job at a time, so all you need is one job
opening in an area you can work in and you're fine. Do you want to be a
quality craftsman in an area where the quality can be identified
(Python), or just one of tens or hundreds of thousands in an area like
Rails or Java or C#?

Malcolm


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



Model Updates. use save() or signals

2009-01-10 Thread juice

I am having trouble with setting up a pre_save signal. I want to be
able to set a location in a model instance, but only have 1 entry at
any time. I thought about just overriding the save, and adding an
update something like:

def save(sefl):
   oa = Article.objects.filter(location=self.location)
   oa = oa[0]
   oa = oa(location=0)
   oa.save()
   super.save()

Something so that it will find the old object with that location, set
it to 0, then continue with the new updated one. This is having
problems on the queryset operations.

I then figured it may run into a loop of saving the same model, so i
was going to use signals but ran into the same issue that it would
still need to be in the save function.

Any tips or points would really help me out.

matt

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Form object has no attribute 'save' ( form.is_bound returns true )

2009-01-10 Thread Dmitri13

Hi Guys,
I am unable to save to table TEST_QST   ,it returns error  QstForm
object has no attribute 'save'
I have confirmed that
form.is_bound returns true
form.is_valid returns true
I have included my code in this post

Please asssit

#MODEL -

class TEST_TYPE(models.Model):
  test_id = models.AutoField(max_length=3,primary_key=True)
  test_name = models.CharField(max_length=10,
db_column='testname',unique=True)
  active = models.BooleanField(default = True,db_column='active')

  def __unicode__(self):
return '%s' % self.test_id




class TEST_CATEGORY(models.Model):
  test_cat_id = models.AutoField(max_length=3, db_column='testcatid',
primary_key=True)
  test_id = models.ManyToManyField(TEST_TYPE,through='TEST_QST')
  test_cat_name = models.CharField(max_length=20,
db_column='categoryname')
  active = models.BooleanField(default = True,db_column='active')

  def __unicode__(self):
return '%s' % self.test_cat_id

#  def __unicode__(self):
#return self.test_cat_name


class TEST_QST(models.Model):
  qst_id = models.AutoField(max_length=8, primary_key=True)
  test_id = models.ForeignKey(TEST_TYPE)
  test_cat_id = models.ForeignKey(TEST_CATEGORY)
  qst = models.TextField()
  status = models.CharField(max_length='1',default='1')
  active = models.BooleanField(default = True)

  def __unicode__(self):
return '%s' % self.qst_id



#FORM -

from django.forms import ModelForm
from django import newforms as forms
from django.newforms import widgets
from olewebapp.ole.models import TEST_QST,TEST_TYPE,TEST_CATEGORY

# Create the form class.
class QstForm(forms.Form):
   qst_id = forms.CharField(max_length=8,widget=forms.HiddenInput)
   test_id = forms.CharField(widget=forms.HiddenInput)
   test_cat_id =forms.CharField(widget=forms.HiddenInput)
   qst =   forms.CharField
(max_length='200',widget=forms.Textarea ,label='')
   status = forms.CharField(widget=forms.HiddenInput)
   active = forms.BooleanField(widget=forms.HiddenInput)


class SaveQstForm(ModelForm):
  class Meta:
 model = TEST_QST


#VIEW--
if request.method == 'POST':
if request.POST['submit_action'] == 'Add':
  # attempt to do add
  #QstForm = forms.form_for_model(TEST_QST)
  TId=TEST_TYPE.objects.get(test_id=request.POST['test_id'])
  CId=TEST_CATEGORY.objects.get(test_cat_id=request.POST
['test_cat_id'])

  form = QstForm()
  data = {'qst_id': request.POST['qst_id'],
   'test_id':TId,
   'test_cat_id': CId,
   'qst': request.POST
['qst'],
   'status': request.POST['status'] ,
   'active': request.POST['active']
   }
  form = QstForm(data)
  try :
if form.is_valid():
  form.save();
  message = 'Question added.'
else:
  # validation failed: show submitted values in form
  message = 'Failed to added.'
  f = form

  except Exception, e:

 logging.error('%s Form error while saving--->'
%form.errors )
 logging.error('%s while saving---' % (e) )


'QstForm' object has no attribute 'save'




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Collapsed fieldsets in admin without h2

2009-01-10 Thread degei

Hi all, extreme Django newbie here (trying it out for the first time
today) so I apologize in advance if my question turns out to be
stupid.

I was running through the intro tutorial and reached the "Customize
the admin form" section (http://docs.djangoproject.com/en/dev/intro/
tutorial02/#customize-the-admin-form).

I added a few fieldsets and was basically just playing around with the
display a bit when I tried adding the "collapse" class to a few of the
fieldsets. One in particular I noticed displayed as only a thin line
in the browser, not giving the ability to expand/collapse it.

Screenshot: http://people.stfx.ca/x2004/x2004cad/images/before_screen.png

I realized this was most likely because I hadn't added a title, so it
didn't have an "h2" element in which to add the show/hide buttons. So
I opened "django/contrib/admin/media/js/admin/CollapsedFieldsets.js"
and made a few changes.

You can see a diff of my changes at http://pastie.org/357732

"After" screenshots:
http://people.stfx.ca/x2004/x2004cad/images/after_screen_collapsed.png
http://people.stfx.ca/x2004/x2004cad/images/after_screen_open.png

My question is basically: is this intended behaviour? Should I always
have a title for a fieldset I intend to make collapsible? I realize
this kind of situation probably wouldn't come up often, and that for
usability sake it might make sense to require a title on those
fieldsets, I'm just kind of interested to see if it was an active
decision.

Thanks in advance.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: What is Django/python equivalent of this - Display textarea content with line breaks in html page?

2009-01-10 Thread Brian Neal

On Jan 10, 8:13 pm, zweb  wrote:
> Javascript:
> document.getElemnetById(’textareacontent’).value.replace(/\n/
> g,’’);
> PHP:
> preg_replace(”/\n/”,””,$_REQUEST['t1']);
> Ruby:
> (teaxtareacontent).gsub(/\n/,””)
>
> ( reference 
> -http://rkutti.wordpress.com/2008/01/31/display-textarea-content-with-...)

I'm not exactly sure what you mean, as you don't want to put a 
inside a text area without escaping it.

If you are talking about displaying text that you got from a text
area, then the PHP idiom is nl2br().

In Django templates, see the linebreaks and linebreaksbr filters:

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#linebreaks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



What is Django/python equivalent of this - Display textarea content with line breaks in html page?

2009-01-10 Thread zweb


Javascript:
document.getElemnetById(’textareacontent’).value.replace(/\n/
g,’’);
PHP:
preg_replace(”/\n/”,””,$_REQUEST['t1']);
Ruby:
(teaxtareacontent).gsub(/\n/,””)

( reference - 
http://rkutti.wordpress.com/2008/01/31/display-textarea-content-with-line-breaks-in-html-page/)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Where are all the Django jobs?

2009-01-10 Thread Ashish

My opinion, RoR was just right there when people were getting
frustated with java and perl and it was very well marketed hence much
wider adoption.  now Ruby has another framework - MERB which is
gaining traction.

Django is like RoR + MERB + more based on presentations I have seen on
RoR and MERB. Not sure why it is not getting that level of popularity.
I like Django very much and have recommended it to many people.

Google App engine using parts of Django helped a lot in Django gaining
more adoption.



On Jan 10, 2:38 pm, David Lindquist  wrote:
> First, I understand that the world economy is in a slump, and that  
> the job market as a whole has not fared well of late. But even before  
> the recent downturn, I noticed that there are precious few jobs in  
> Django development (yes, I know about DjangoGigs.com). A simple  
> keyword search on popular job boards shows that the number of Ruby on  
> Rails jobs outnumber Django easily by a factor of 10 or 20. True,  
> Rails has been around longer, but not by much (a year maybe?).
>
> So my question to the group is: if Rails has been widely adopted in  
> the enterprise, why hasn't Django? Do you think Django will catch on?  
> Or do you think it will be more of a "boutique" framework?
>
> I am perfectly open to the idea that my perceptions are way off or  
> that I am being unrealistic or impatient. But I would really like to  
> escape PHP-land someday.
>
> Someone give me hope, please? :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: drawing diagrams in django?

2009-01-10 Thread aastrand



On Jan 10, 9:41 pm, Alistair Marshall 
wrote:
> hi folks,
>
> I am currently trying to create an app which allows the user to
> generate flowsheets (of a chemical plant)
>
> So far I have created all the basics and allow the user to enter
> information about the individual unitsw chemicals etc and the user can
> even run a simulation.
>
> what I now want to do is create a graphical overview of the process. I
> want to be able to draw out the flowsheet to an image and perhaps even
> allow the user to click on areas of the image to be linked to that
> section of the process.
>
> Currently I have a very rough function that generates x,y coardanites
> of each unit (though this could be improved greatly). All I really
> need is a simple method of drawing lines (or arrows), saving them to a
> png, and returning the saved location.
>
> I was wondering if anyone else had a simalar drawing requirement and
> to ask what they use
>
> Thanks
> Alistair

For high-quality graphics, you should really aim at producing svg-
files ( http://www.w3.org/Graphics/SVG/ ). Last time I looked for it,
I only found early attempts of a python library for drawing svg
figures, but perhaps this one has become good enough: http://codeboje.de/pysvg/

Cheers,

Per-Olof
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 relevant django book 1.0 is ?

2009-01-10 Thread Chris Amico

And there's a new version in the works: 
http://holovaty.com/blog/archive/2009/01/09/0133

I found the book was good for getting a broader explanation of certain
concepts, especially when I first started with Django.

On Jan 10, 5:22 am, timur  wrote:
> Hello!
>
> I am newbie in django now reading Django Book 
> athttp://www.djangobook.com/en/1.0/.
> As far as I know it covers django version 0.96, not modern releases of
> 1.* branch. So my questions are:
>
> 1) How relevant this book on the 1.*  django ?
> 2) What should I keep in mind while reading this book ? I mean what
> kind of major changes have been made to django since then ?
>
> 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
-~--~~~~--~~--~--~---



Where are all the Django jobs?

2009-01-10 Thread David Lindquist

First, I understand that the world economy is in a slump, and that  
the job market as a whole has not fared well of late. But even before  
the recent downturn, I noticed that there are precious few jobs in  
Django development (yes, I know about DjangoGigs.com). A simple  
keyword search on popular job boards shows that the number of Ruby on  
Rails jobs outnumber Django easily by a factor of 10 or 20. True,  
Rails has been around longer, but not by much (a year maybe?).

So my question to the group is: if Rails has been widely adopted in  
the enterprise, why hasn't Django? Do you think Django will catch on?  
Or do you think it will be more of a "boutique" framework?

I am perfectly open to the idea that my perceptions are way off or  
that I am being unrealistic or impatient. But I would really like to  
escape PHP-land someday.

Someone give me hope, please? :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: deploying in server and templates folder is wrong:

2009-01-10 Thread Steve Potter



On Jan 10, 3:44 pm, Alan  wrote:
> Hello List,
> So, using django server por development and my apps were working fine. Now
> that I got apache2 + mod_wsgi working (on Mac Leopard), when trying to
> access a page, I always get a error saying "TemplateDoesNotExist" and I can
> see why, it's looking for templates in $HOME folder (eg.
> "/Users/alan/templates/index.html" but it is in "
> /Users/alan/workspace/webapps/templates") and obviously they are not there.
>
> Any idea of what is going wrong here? Any help would be very appreciated.
>
> Many thanks in advance.
>
> Alans.

You need to edit your settings.py file and change your TEMPLATE_DIRS
to point to the new location.

Steve

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



deploying in server and templates folder is wrong:

2009-01-10 Thread Alan
Hello List,
So, using django server por development and my apps were working fine. Now
that I got apache2 + mod_wsgi working (on Mac Leopard), when trying to
access a page, I always get a error saying "TemplateDoesNotExist" and I can
see why, it's looking for templates in $HOME folder (eg.
"/Users/alan/templates/index.html" but it is in "
/Users/alan/workspace/webapps/templates") and obviously they are not there.

Any idea of what is going wrong here? Any help would be very appreciated.

Many thanks in advance.

Alans.

-- 
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 I add my template content to my html email?

2009-01-10 Thread alex.gay...@gmail.com

You can create  a template and render it the same way you would in a
view, checkout the render_to_string function(it's in django.template I
believe).

Alex

On Jan 10, 2:41 pm, Michael  wrote:
> Hello,
> I able to send an html email using the code below:
>
> ///
>
> def emaildiscount(request):
>     subject, from_email, to = 'hello', 'u...@domain.com',
> 'u...@domain.com'
>     text_content = 'This is an important message.'
>     html_content = 'This is an important message. p>'
>     msg = EmailMultiAlternatives(subject, text_content, from_email,
> [to])
>     msg.attach_alternative(html_content, "text/html")
>     msg.send()
>
> ///
>
> However, I've now created a .htm file that I want to use as the email
> content.  The .htm template is over 100 lines long.  I don't think
> pasting the code into the view is the smart thing to do.  Does django
> allow the html_content variable to access my .htm file?
>
> 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
-~--~~~~--~~--~--~---



Re: drawing diagrams in django?

2009-01-10 Thread Jeff Hammerbacher
Hey Alistair,

For static image generation, I've used pygraphviz (
http://networkx.lanl.gov/pygraphviz/), a Python interface to AT's graphviz
library.

Regards,
Jeff

On Sat, Jan 10, 2009 at 12:41 PM, Alistair Marshall <
runninga...@googlemail.com> wrote:

>
> hi folks,
>
> I am currently trying to create an app which allows the user to
> generate flowsheets (of a chemical plant)
>
> So far I have created all the basics and allow the user to enter
> information about the individual unitsw chemicals etc and the user can
> even run a simulation.
>
> what I now want to do is create a graphical overview of the process. I
> want to be able to draw out the flowsheet to an image and perhaps even
> allow the user to click on areas of the image to be linked to that
> section of the process.
>
> Currently I have a very rough function that generates x,y coardanites
> of each unit (though this could be improved greatly). All I really
> need is a simple method of drawing lines (or arrows), saving them to a
> png, and returning the saved location.
>
> I was wondering if anyone else had a simalar drawing requirement and
> to ask what they use
>
> Thanks
> Alistair
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



How do I add my template content to my html email?

2009-01-10 Thread Michael

Hello,
I able to send an html email using the code below:

///

def emaildiscount(request):
subject, from_email, to = 'hello', 'u...@domain.com',
'u...@domain.com'
text_content = 'This is an important message.'
html_content = 'This is an important message.'
msg = EmailMultiAlternatives(subject, text_content, from_email,
[to])
msg.attach_alternative(html_content, "text/html")
msg.send()

///

However, I've now created a .htm file that I want to use as the email
content.  The .htm template is over 100 lines long.  I don't think
pasting the code into the view is the smart thing to do.  Does django
allow the html_content variable to access my .htm file?

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



drawing diagrams in django?

2009-01-10 Thread Alistair Marshall

hi folks,

I am currently trying to create an app which allows the user to
generate flowsheets (of a chemical plant)

So far I have created all the basics and allow the user to enter
information about the individual unitsw chemicals etc and the user can
even run a simulation.

what I now want to do is create a graphical overview of the process. I
want to be able to draw out the flowsheet to an image and perhaps even
allow the user to click on areas of the image to be linked to that
section of the process.

Currently I have a very rough function that generates x,y coardanites
of each unit (though this could be improved greatly). All I really
need is a simple method of drawing lines (or arrows), saving them to a
png, and returning the saved location.

I was wondering if anyone else had a simalar drawing requirement and
to ask what they use

Thanks
Alistair
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: reusable apps and dependencies

2009-01-10 Thread eXt

On 10 Sty, 20:15, "uber.ubiwanken...@gmail.com"
 wrote:
> Sorry, I'm afraid I was not too clear.
> What I have to do? How I have to put the new version?
> How can I have both versions of django-cms?
Use virtualenv! It is what you need :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: reusable apps and dependencies

2009-01-10 Thread Milan Andric

On Sat, Jan 10, 2009 at 1:15 PM, uber.ubiwanken...@gmail.com
 wrote:
>
> Sorry, I'm afraid I was not too clear.
> For example:
>
> I've got 2 projects 'myproject1' and 'myproject2' that use django-cms
> (and django-tinymce and so on...).
> 'myproject1' use an old version of django-cms, 'myproject2' a new one.
>
> In settings.py of my projects I have:
>
> INSTALLED_APPS = (
>...
>'cms',
>'tinymce',
>'filebrowser',
>...
> )
>
> In my .profile I have something like this:
>
>  export PYTHONPATH=/Users/giorgio/workspaces/django/apps:$PYTHONPATH
>
> and in /Users/giorgio/workspaces/django/apps I have the old version of
> diango-cms that I don't want to update.
>
> What I have to do? How I have to put the new version?
> How can I have both versions of django-cms?
>

Thinking could create a separate apps directory for each project?  Or
put the old django-cms in a apps-old directory and then set your
python path for that specific project to be

export 
PYTHONPATH=/Users/giorgio/workspaces/django/apps-old:/Users/giorgio/workspaces/django/apps

That's one idea ..

If you were deploying with mod_wsgi then you could do a similar thing
in your dispatch.wsgi file with sys.path.insert() to specify your
python path for each project.

--
Milan

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: reusable apps and dependencies

2009-01-10 Thread uber.ubiwanken...@gmail.com

Sorry, I'm afraid I was not too clear.
For example:

I've got 2 projects 'myproject1' and 'myproject2' that use django-cms
(and django-tinymce and so on...).
'myproject1' use an old version of django-cms, 'myproject2' a new one.

In settings.py of my projects I have:

INSTALLED_APPS = (
...
'cms',
'tinymce',
'filebrowser',
...
)

In my .profile I have something like this:

  export PYTHONPATH=/Users/giorgio/workspaces/django/apps:$PYTHONPATH

and in /Users/giorgio/workspaces/django/apps I have the old version of
diango-cms that I don't want to update.

What I have to do? How I have to put the new version?
How can I have both versions of django-cms?

Thanks for your patience :)
Giorgio


On Jan 10, 7:43 pm, eXt  wrote:
> On 10 Sty, 18:42, "uber.ubiwanken...@gmail.com" 
> wrote:
> > Hi all,
> > I've created a directory for all my usable apps, configured PYTHONPATH
> > and everything's fine.
> > But I got a problem when some apps release new versions and I want to
> > update them on my hd.
>
> Why? What is the problem?
>
> > Plus, usually I get the svn version of an app to quickly update it.
>
> svn up, and...?
>
> > How do you resolve this kind of problem?
>
> But what is your problem?
>
> > Do you use virtualenv or django-reusableapps?
>
> Yes, and?
>
> > What is the right way to deal with it in a production environment?
>
> When you deploy an application (in Django world - "project") onto
> production env, then you should use specific revision of your own
> application which will contain specific revisions of external
> applications. For example Django 1.0.2 or Django rev. xxx (i mean svn
> revision number), photologue rev. xxx etc. Then your application in
> version 1.0 is build of your code and external apps in specific
> versions. When you create version 1.1 then you will probably include
> other versions of externals (for example when there are new ones).
>
> Do you use any SCM like svn? If you use svn then for external apps you
> can use so called "vendor branches".
>
> eXt
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: reusable apps and dependencies

2009-01-10 Thread eXt

On 10 Sty, 18:42, "uber.ubiwanken...@gmail.com"
 wrote:
> Hi all,
> I've created a directory for all my usable apps, configured PYTHONPATH
> and everything's fine.
> But I got a problem when some apps release new versions and I want to
> update them on my hd.
Why? What is the problem?

> Plus, usually I get the svn version of an app to quickly update it.
svn up, and...?

> How do you resolve this kind of problem?
But what is your problem?

> Do you use virtualenv or django-reusableapps?
Yes, and?

> What is the right way to deal with it in a production environment?
When you deploy an application (in Django world - "project") onto
production env, then you should use specific revision of your own
application which will contain specific revisions of external
applications. For example Django 1.0.2 or Django rev. xxx (i mean svn
revision number), photologue rev. xxx etc. Then your application in
version 1.0 is build of your code and external apps in specific
versions. When you create version 1.1 then you will probably include
other versions of externals (for example when there are new ones).

Do you use any SCM like svn? If you use svn then for external apps you
can use so called "vendor branches".

eXt
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: which class does ####__iexact belong to, where #### is the attribute of a model?

2009-01-10 Thread rabbi

High 5! :-)

On Jan 10, 7:30 pm, Christian Joergensen  wrote:
> rabbi wrote:
> > Hi,
> > I'm trying to write a generic filter function do something like
> > following:
> >    MyModel.objects.filter(   getattr(???,my_dict['search_field']
> > +'__iexact')=my_dict['search_value']   )
>
> > But I don't know what to put in place of '???'
> > Where does 'field__iexact' actually come from?
> > Is it part of MyModel or somewhere else?
>
> You don't need getattr:
>
> MyModel.objects.filter(**{
>    my_dict['search_field'] + '__iexact': my_dict['search_value']
>
> })
>
> I believe that will do the trick :)
>
> Regards,
> Christian
>
> --
> Christian Joergensenhttp://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Deleting a session variable

2009-01-10 Thread Christian Joergensen

Michael wrote:
> Hello,
> I'm sure this is a easy question.
> 
> In one of my views I need to delete the session variable
> 'request.session['percent']'.  However, sometimes 'request.session
> ['percent']' never gets created.  When this is the case I get an error
> when I do 'del request.session['percent']'.  How do I check to see if
> 'request.session['percent']' has been created?

if 'percent' in request.session:
 del request.session['percent']

Regards,
Christian

-- 
Christian Joergensen
http://www.technobabble.dk

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: which class does ####__iexact belong to, where #### is the attribute of a model?

2009-01-10 Thread Christian Joergensen

rabbi wrote:
> Hi,
> I'm trying to write a generic filter function do something like
> following:
>MyModel.objects.filter(   getattr(???,my_dict['search_field']
> +'__iexact')=my_dict['search_value']   )
> 
> But I don't know what to put in place of '???'
> Where does 'field__iexact' actually come from?
> Is it part of MyModel or somewhere else?

You don't need getattr:

MyModel.objects.filter(**{
   my_dict['search_field'] + '__iexact': my_dict['search_value']
})

I believe that will do the trick :)

Regards,
Christian

-- 
Christian Joergensen
http://www.technobabble.dk

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



which class does ####__iexact belong to, where #### is the attribute of a model?

2009-01-10 Thread rabbi

Hi,
I'm trying to write a generic filter function do something like
following:
   MyModel.objects.filter(   getattr(???,my_dict['search_field']
+'__iexact')=my_dict['search_value']   )

But I don't know what to put in place of '???'
Where does 'field__iexact' actually come from?
Is it part of MyModel or somewhere else?

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



reusable apps and dependencies

2009-01-10 Thread uber.ubiwanken...@gmail.com

Hi all,
I've created a directory for all my usable apps, configured PYTHONPATH
and everything's fine.
But I got a problem when some apps release new versions and I want to
update them on my hd.
Plus, usually I get the svn version of an app to quickly update it.

How do you resolve this kind of problem?
Do you use virtualenv or django-reusableapps?
What is the right way to deal with it in a production environment?

Thanks to all
Giorgio

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Deleting a session variable

2009-01-10 Thread Michael

Hello,
I'm sure this is a easy question.

In one of my views I need to delete the session variable
'request.session['percent']'.  However, sometimes 'request.session
['percent']' never gets created.  When this is the case I get an error
when I do 'del request.session['percent']'.  How do I check to see if
'request.session['percent']' has been created?

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



small contenttypes mystery

2009-01-10 Thread Eric Abrahamsen

I've got a Topic model, which is a bit like a category. Then there are  
TopicItem objects, which have a foreign key to a Topic, and a generic  
foreign key to anything else in the website, so that I can attach  
anything to a particular Topic. In my admin site, a few models have a  
generic inline formset for TopicItems, for conveniences' sake (all  
that work quite nicely, thanks to whoever developed that), and then  
the Topics themselves each display theirTopicItems via plain old  
inline formsets.

My question is, how do the TopicItems appearing on the Topics page  
determine their heading? At the bottom of each Topic page there's a  
"Topic Items" section, and each item within that section has a little  
heading reading "Topic item: None". I don't want it to say "None",  
obviously, I want it to produce the unicode method of the object  
that's connected (via generic foreign key) to that TopicItem. The  
TopicItem __unicode__ method looks like this:

def __unicode__(self):
   return unicode(self.content_object)

This works great in the shell: if I print a TopicItem, it prints the  
unicode method of its related object. But in the admin it's mostly  
None. Except for in *one* case, where one instance of one model  
produces the correct title. Everything else is still None. So clearly  
this is confusing. I can't see anything special about that one  
instance of that one model, and I can't (despite lengthy poking)  
actually figures out from where in the source code this particular  
value arises. Can someone just point me to a file and line number? Or  
otherwise clarify this?

Many thanks in advance,

Eric

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 relevant django book 1.0 is ?

2009-01-10 Thread alex.gay...@gmail.com

On Jan 10, 7:22 am, timur  wrote:
> Hello!
>
> I am newbie in django now reading Django Book 
> athttp://www.djangobook.com/en/1.0/.
> As far as I know it covers django version 0.96, not modern releases of
> 1.* branch. So my questions are:
>
> 1) How relevant this book on the 1.*  django ?
> 2) What should I keep in mind while reading this book ? I mean what
> kind of major changes have been made to django since then ?
>
> Thanks!

There have been some fairly major changes to the Django codebase
since .96, particularly with regards to the admin.  For that reason I
would recommend starting with the official Django documentation found
here: http://docs.djangoproject.com/en/dev/

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



How relevant django book 1.0 is ?

2009-01-10 Thread timur

Hello!

I am newbie in django now reading Django Book at 
http://www.djangobook.com/en/1.0/.
As far as I know it covers django version 0.96, not modern releases of
1.* branch. So my questions are:

1) How relevant this book on the 1.*  django ?
2) What should I keep in mind while reading this book ? I mean what
kind of major changes have been made to django since then ?

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



Re: What's the best configuration for Apache + mod_wsgi + nginx

2009-01-10 Thread Alan
Can't you use crontab to submit your conversion task?
Cheers,
Alan

On Sat, Jan 10, 2009 at 09:19, Stefan Tunsch  wrote:

>
> It looks like it's clear video conversion is your bottleneck.
>
> I would also suggest doing that on a different worker process.
>
> You will also want to avoid converting the same file again if you've
> done it before...
>
> I was suggesting to give a shot of using ONLY nginx with Django.
> If you search in Google you'll find docs that help you setting that up.
>
> In general, 1GB of RAM is not much for a site that coverts video on the
> fly...
>
> Regards
>
> On 1/10/09, Graham Dumpleton  wrote:
> >
> >
> >
> > On Jan 10, 11:05 am, lenin  wrote:
> >> The server MPM is prefork.
> >>
> >> I had mod_wsgi in daemon mode I think, with this lines:
> >>
> >> WSGIDaemonProcess user_name user=user_name group=user_name
> >> WSGIProcessGroup user_name
> >> WSGIScriptAlias / /path/to/django.wsgi
> >
> > Which is one process with 15 threads. That means at most 15 requests
> > can be handled at the same time.
> >
> > The problem is that with what you are doing, is it is likely that the
> > requests take a long time if they doing video conversion. Thus if you
> > get 15 requests active at one time, other requests will be queued and
> > will appear to take a lot longer.
> >
> > How long does a request which involves conversion normally take?
> > Knowing this is critical to determining how many processes/threads you
> > need to handle enough concurrent requests based on your load.
> >
> > The next problem though is if you are doing the video conversion
> > within the Django process itself, then allowing more concurrent
> > requests and thus conversions, means that the process size will
> > balloon out if this process takes a lot of memory for each request.
> > So, are you doing conversion within the Django process and how much
> > memory does the process of conversion use.
> >
> > You thus perhaps should not be doing video conversion within the same
> > process, but executing a separate application to perform the
> > conversion. Even then, you may need a queueing system or otherwise
> > some way of restricting how many conversions can occur at a time,
> > because even though performed by a separate application, it may still
> > take up a lot of transient memory while running.
> >
> > Also, from what I understand Django's abilities to serve up static
> > files or streamed data, isn't that excellent. In particular, if
> > hosting with WSGI capable server, it doesn't use the wsgi.file_wrapper
> > extension. This extension ensures that files are streamed in blocks
> > and the file is not read all into memory first in order to be able to
> > send it. Also, if operating system provides it, Apache will use
> > sendfile() or memory mapping techniques to return data in a much more
> > efficient way. So, how exactly are you returning the converted data
> > for Django to respond with?
> >
> >> That was at the moment of the first message, but now I have commented
> >> out the WSGIDaemonProcess and WSGIProcessGroup directives, and what
> >> happens is that the memory fills up until the server crashes, It runs
> >> out of RAM and swap and it just dies. But until it crashes it is very
> >> responsive.
> >
> > Which is not surprising as prefork means that instead of a restricted
> > number of copies of Apache, based on your configuration you could have
> > up to 70. That is 70 copies of Django, plus memory from conversions.
> > This would quickly cripple a box without adequate memory. Just the
> > startup cost of the extra processes when Apache deems they need to be
> > created would cause the load average of the box to shoot up.
> >
> >> I have tried putting processes=5 threads=1 maximum-
> >> requests=200 in the daemon configuration but it doesn't help.
> >
> > Which is only 5 concurrent requests, which is worse than the 15 you
> > had before. You also have 5 potentially fat Django processes rather
> > than 1.
> >
> > Graham
> >
> >> On apache I have this configuration
> >>  KeepAlive Off
> >> 
> >> StartServers 5
> >> MinSpareServers  5
> >> MaxSpareServers  10
> >> MaxClients   70
> >> MaxRequestsPerChild 150
> >> 
> >>
> >> On nginx I have
> >> worker_processes  10;
> >> events {
> >> worker_connections  4096;
> >> use epoll;}
> >>
> >>  location / {
> >> proxy_pass  http://localhost:8080;
> >> proxy_redirect  default;
> >> proxy_set_headerHost $host;
> >> proxy_set_headerX-Real-IP $remote_addr;
> >> proxy_set_headerX-Forwarded-For
> >> $proxy_add_x_forwarded_for;
> >>
> >> client_max_body_size10m;
> >> client_body_buffer_size 128k;
> >>
> >> proxy_connect_timeout   1000;
> >> proxy_send_timeout  1000;
> >> 

Re: deploying a project

2009-01-10 Thread Alan
Not hurt Malcolm. In fact I really try to avoid asking at the list, trying
to google first, and I really appreciate the work of guys like you and
Graham. I confess I don't have the patience enough to run a mailing list.
And you guys here are pretty much helpful, like Karen for example, besides
you two.
But sometimes I got frustrated too... I am suposed to be a scientist, doing
research, writing papers than code, but I really really like coding. And
Django has been quite a pleasure.

However, straight deadlines, lots of hurdles (related to our server and
applications), having to learn something new in a fortnight and when you
think you're done, here comes another task, learn apache. But that's ok, I
am starting to get the stuff.

Anyway, although about "...Django will provide recipes for doing stuff that
is out of
scope and should remain so", don't get it wrong but setting up an apache is
not out of scope of Django IMHO. Great if Django site has this stuff there,
but a link sometimes is pretty much all that we need. For example, I only
realise here in the list that is Graham who developed mod_wsgi and not from
Django site (OK, if I had read more there I would find it too, but, gosh,
the day has only 24 h and I have no clones).
All the best.
Cheers,
Alan

PS: to not mention that we have "life" as well, in my case a baby daughter
and a wife who ordered me to clean the house now (apache and wsgi later).

On Sat, Jan 10, 2009 at 10:58, Malcolm Tredinnick
wrote:

>
> On Sat, 2009-01-10 at 10:37 +, Alan wrote:
> > Thanks Graham, indeed I was being stupid, I didn't realise that mac
> > leopard holds apache 2.2 now...
> >
> >
> > About docs, where can I find something about apache2 + mac osx +
> > mod_wsgi in http://docs.djangoproject.com or google? All I get is
> > puzzles with missing pieces...
>
> So, here's the thing: one day we'll include a short piece on the really
> basic setups for mod_wsgi in the Django docs, similar to what we do for
> mod_python. We'll do that because somebody will write it (or one of the
> rest of use will eventually find the time). However, it will never
> replace the mod_wsgi documentation. Deliberately.
>
> The Django project shouldn't have to provide that kind of one-stop
> replacement. The Django documentation is about using Django. For
> documentaiton on using Apache, there is wonderful documentation provided
> by the Apache project. For documentation on using Python, python.org is
> the source. For documentation on using mod_wsgi, there is the mod_wsgi
> project at Google. You can see the pattern here. Particularly when
> external resources provide good documentation (python, Apache, mod_wsgi,
> mod_python, etc, etc), we absolutely should dispatch to them (and Google
> and Yahoo are our friends in this respect). I think it's absolutely
> fantastic that somebody like Graham Dumpleton spends so much time on a
> list like django-users when he doesn't have to. It provides a lot of
> people with a lot of help. I also find it to be a form of highly
> wasteful time usage, since most of the questions have more appropriate
> forums and there's not always the "teach a man to fish" result falling
> out at the end. Glad Graham does not, not about to pick up the slack if
> he ever decides to ask people to come to the appropriate lists to ask
> questions.
>
> We document how to use Django. We also go the extra mile and include a
> bunch of other documentation to help out people just starting out (for
> example, a lot of examples and explanations are somewhat verbose because
> we're helping out Python beginners, which aren't our primary audience),
> but it always has the slight side-effect of actually making the Django
> documentation harder to use. The extra explanations of stuff that isn't
> Django related often tends to obscure the actual useful Django
> documentation.
>
> I'm not intending to be harsh here, but that is the reality. If somebody
> is going to develop using Apache, then the same as if they're going to
> use HTML or Javascript or Python or CSS or Eclipse or vim or whataver,
> they have to be spend some time reading and learning about that tool.
> Yes, it's a huge learning curve to develop web applications. It's
> actually hard stuff.
>
> This isn't targeted (only) at you. It's a general complaint against
> people hoping Django will provide recipes for doing stuff that is out of
> scope and should remain so.
>
> Regards,
> Malcolm
>
>
>
> >
>


-- 
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 

Re: first newbie question

2009-01-10 Thread _Sebastian_

juhu, it works...

I have to admit after reading my initial post again I could habe been
more clear.

So here my example & test case which now works with Umapathy S
suggestion.

I created a model:

class Diameter(models.Model):
thickener_diameter = models.SmallIntegerField()

when I add a few diameters in the shell and then query them I get only

Diameter.objects.all()
[]

I then added

def __unicode__(self):
return self.thickener_diameter

to the model and when querying the Diameter I receive a

TypeError: coercing to Unicode: need string or buffer, int found

So I assumed it has something to do with that thickener diameter is
not a string

But when I use

def __unicode__(self):
   return "%d" % self.question_number

it works! Thant you all ... as I said I'a quite a beginner :-)

On Jan 10, 2:42 am, "Umapathy S"  wrote:
> I usually do
>
> def __unicode__(self):
>        return "%d" % self.question_number
>
> On Fri, Jan 9, 2009 at 2:42 PM, Eric Abrahamsen  wrote:
>
> > On Jan 9, 2009, at 10:19 PM, _Sebastian_ wrote:
>
> > > Hi all,
>
> > > I've been following the tutorial
> >http://docs.djangoproject.com/en/dev/intro/tutorial01/#playing-with-t...
> > > and working on a own test-project as well.
>
> > > so I tried to adapt from
>
> > > class Poll(models.Model):
> > >    question = models.CharField('question',max_length=200)
>
> > >    def __unicode__(self):
> > >        return self.question
>
> > > to this
>
> > > class Poll2(models.Model):
> > >    question_number = models.IntegerField()
>
> > >    def __unicode__(self):
> > >        return self.question_number
>
> > > to list the actual question number instead of Question Object in the
> > > admin interface.
>
> > > Somehow it was not working. How do I need to do it so it's right?
>
> > A couple of questions: what do you mean exactly by question number?
> > And also, how is it not working? And, for good measure, what would it
> > look like if it were right? As you've written this, it should work
> > fine – when you create a Poll object its data will consist of a number
> > (but no question!), and that number will be returned by the
> > __unicode__ method. You might be trying to retrieve the primary key
> > for Poll2 objects, which is a column that Django usually makes
> > implicitly for you, in the background, unless you specify that you
> > want to do it yourself. If this is the number you want, you can get it
> > in the __unicode__ method as self.pk. That might not really be what
> > you want, though, because that number will increment regardless of
> > deletes or modifications, and you can't (or shouldn't) modify it
> > manually. If you were hoping for a number attribute that you can
> > modify, and use for ordering, etc., let us know, and that should be
> > easy to arrange.
>
> > Welcome and good luck,
> > Eric
>
> > > cheers,
>
> > > seb
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: deploying a project

2009-01-10 Thread Malcolm Tredinnick

On Sat, 2009-01-10 at 10:37 +, Alan wrote:
> Thanks Graham, indeed I was being stupid, I didn't realise that mac
> leopard holds apache 2.2 now...
> 
> 
> About docs, where can I find something about apache2 + mac osx +
> mod_wsgi in http://docs.djangoproject.com or google? All I get is
> puzzles with missing pieces...

So, here's the thing: one day we'll include a short piece on the really
basic setups for mod_wsgi in the Django docs, similar to what we do for
mod_python. We'll do that because somebody will write it (or one of the
rest of use will eventually find the time). However, it will never
replace the mod_wsgi documentation. Deliberately.

The Django project shouldn't have to provide that kind of one-stop
replacement. The Django documentation is about using Django. For
documentaiton on using Apache, there is wonderful documentation provided
by the Apache project. For documentation on using Python, python.org is
the source. For documentation on using mod_wsgi, there is the mod_wsgi
project at Google. You can see the pattern here. Particularly when
external resources provide good documentation (python, Apache, mod_wsgi,
mod_python, etc, etc), we absolutely should dispatch to them (and Google
and Yahoo are our friends in this respect). I think it's absolutely
fantastic that somebody like Graham Dumpleton spends so much time on a
list like django-users when he doesn't have to. It provides a lot of
people with a lot of help. I also find it to be a form of highly
wasteful time usage, since most of the questions have more appropriate
forums and there's not always the "teach a man to fish" result falling
out at the end. Glad Graham does not, not about to pick up the slack if
he ever decides to ask people to come to the appropriate lists to ask
questions.

We document how to use Django. We also go the extra mile and include a
bunch of other documentation to help out people just starting out (for
example, a lot of examples and explanations are somewhat verbose because
we're helping out Python beginners, which aren't our primary audience),
but it always has the slight side-effect of actually making the Django
documentation harder to use. The extra explanations of stuff that isn't
Django related often tends to obscure the actual useful Django
documentation.

I'm not intending to be harsh here, but that is the reality. If somebody
is going to develop using Apache, then the same as if they're going to
use HTML or Javascript or Python or CSS or Eclipse or vim or whataver,
they have to be spend some time reading and learning about that tool.
Yes, it's a huge learning curve to develop web applications. It's
actually hard stuff.

This isn't targeted (only) at you. It's a general complaint against
people hoping Django will provide recipes for doing stuff that is out of
scope and should remain so.

Regards,
Malcolm



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



Re: deploying a project

2009-01-10 Thread Graham Dumpleton



On Jan 10, 9:37 pm, Alan  wrote:
> Thanks Graham, indeed I was being stupid, I didn't realise that mac leopard
> holds apache 2.2 now...
> About docs, where can I find something about apache2 + mac osx + mod_wsgi
> inhttp://docs.djangoproject.comor google? All I get is puzzles with
> missing pieces...
>
> OK, I am maybe just being lazy... I will give another look, but if you have
> a good how to, please, I'd love to read it.

Anything wrong with the top Google search result for mod_wsgi.

  http://www.google.com/search?client=safari=en=mod_wsgi=UTF-8=UTF-8

Should yield:

  http://www.modwsgi.org

Graham

> Cheers,
> Alan
>
> On Sat, Jan 10, 2009 at 09:04, Graham Dumpleton
> wrote:
>
>
>
>
>
> > On Jan 10, 7:32 pm, Alan  wrote:
> > > I use mac book pro, and I didn't like the way I have to set put apache2 +
> > > mod_wsgi in mac osx... poor documentation by the way.
> > > I will give a 2nd thought about it.
>
> > Huh, what are you talking about?
>
> > The mod_wsgi package builds against Apple supplied Apache and Python
> > out of the box. How to build mod_wsgi from source code is well
> > documented, as is how to setup Apache for mod_wsgi and then how to
> > setup Django to work with it.
>
> > Which documentation are you looking about which you think is
> > inadequate?
>
> > Graham
>
> > > Thanks Malcolm.
>
> > > Alan
>
> > > On Sat, Jan 10, 2009 at 08:27, Malcolm Tredinnick
> > > wrote:
>
> > > > On Sat, 2009-01-10 at 08:03 +, Alan wrote:
> > > > > Good you asked, I don't know because I couldn't try it yet. This a
> > bit
> > > > > complicated. We are spread across Europe and I don't have the access
> > > > > as admin to the server, so what I am doing is the best I can because
> > > > > then the admin will test it. She set up the apache to restart every
> > > > > hour. So you see, if I don't success at first I will have to wait
> > > > > another hour... or her do restart (if available), not just 2 min for
> > > > > me unfortunately :-)
>
> > > > You don't have to test it out on the production servers. Set up Apache
> > > > on your laptop or development workstation.
>
> > > > Regards,
> > > > Malcolm
>
> > > --
> > > Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
> > > Department of Biochemistry, University of Cambridge.
> > > 80 Tennis Court Road, Cambridge CB2 1GA, UK.
>
> > > >>http://www.bio.cam.ac.uk/~awd28<<
>
> --
> Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
> Department of Biochemistry, University of Cambridge.
> 80 Tennis Court Road, Cambridge CB2 1GA, UK.
>
> >>http://www.bio.cam.ac.uk/~awd28<<
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: deploying a project

2009-01-10 Thread Alan
Thanks Graham, indeed I was being stupid, I didn't realise that mac leopard
holds apache 2.2 now...
About docs, where can I find something about apache2 + mac osx + mod_wsgi
in http://docs.djangoproject.com or google? All I get is puzzles with
missing pieces...

OK, I am maybe just being lazy... I will give another look, but if you have
a good how to, please, I'd love to read it.

Cheers,
Alan

On Sat, Jan 10, 2009 at 09:04, Graham Dumpleton
wrote:

>
>
>
> On Jan 10, 7:32 pm, Alan  wrote:
> > I use mac book pro, and I didn't like the way I have to set put apache2 +
> > mod_wsgi in mac osx... poor documentation by the way.
> > I will give a 2nd thought about it.
>
> Huh, what are you talking about?
>
> The mod_wsgi package builds against Apple supplied Apache and Python
> out of the box. How to build mod_wsgi from source code is well
> documented, as is how to setup Apache for mod_wsgi and then how to
> setup Django to work with it.
>
> Which documentation are you looking about which you think is
> inadequate?
>
> Graham
>
> > Thanks Malcolm.
> >
> > Alan
> >
> > On Sat, Jan 10, 2009 at 08:27, Malcolm Tredinnick
> > wrote:
> >
> >
> >
> >
> >
> > > On Sat, 2009-01-10 at 08:03 +, Alan wrote:
> > > > Good you asked, I don't know because I couldn't try it yet. This a
> bit
> > > > complicated. We are spread across Europe and I don't have the access
> > > > as admin to the server, so what I am doing is the best I can because
> > > > then the admin will test it. She set up the apache to restart every
> > > > hour. So you see, if I don't success at first I will have to wait
> > > > another hour... or her do restart (if available), not just 2 min for
> > > > me unfortunately :-)
> >
> > > You don't have to test it out on the production servers. Set up Apache
> > > on your laptop or development workstation.
> >
> > > Regards,
> > > Malcolm
> >
> > --
> > Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
> > Department of Biochemistry, University of Cambridge.
> > 80 Tennis Court Road, Cambridge CB2 1GA, UK.
> >
> > >>http://www.bio.cam.ac.uk/~awd28<<
> >
>


-- 
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Related articles based on keywords.

2009-01-10 Thread Russell Keith-Magee

On Sat, Jan 10, 2009 at 6:27 AM, Ariel Mauricio Nunez Gomez
 wrote:
>>> In the view for a single article, I would like to be able to pull up
>>> related articles based on shared keywords. Just pulling up all the
>>> articles that share at least one keyword would be to imprecise. What
>>> I'd like to do is use some sort of weighting algorithm, so that if
>>> there are articles that share 5 keywords they get pulled up while ones
>>> that only share 1 do not. I've been thinking over ways to do this, but
>>> they all seem to be fairly slow and processor intensive.
>
> Also, if you are looking for performance, you may want to find a way to use
> the SQL aggregation operations (Like Count, Avg, StdDev) to help you with
> your problem.
> That feature is scheduled for Django 1.1 and 'may' be merged into trunk
> soon,

It's a little more certain than "may". I have a couple of small issues
to attend to, but barring a major bug report, I'd estimate that
aggregates will land in trunk by the end of next week.

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



Re: django-admin.py not working on Vista

2009-01-10 Thread Eugene Mirotin

You can simply append django's bin directory to your _system_ PATH
variable (still the same way as on the earlier versions - through the
computer properties - advanced)
I do not have my Vista laptop on hand, but I believe, this it what I
have done to make it work

On Jan 10, 5:55 am, Rex  wrote:
> I installed Django on my Vista box. Using the Windows command shell, I
> go to the site-packages/django/bin directory and here's what I get
> when I type various commands:
>
> > django-admin.py help
>
> Type 'django-admin.py help' for usage.
>
> > python django-admin.py help
>
> [This gives me the proper help instructions]
>
> Why is it only giving me the correct output when I prepend "python"?
> This is a problem because when I'm in a different folder (such as my
> Django projects folder), I can't type "python django-admin.py", since
> that will not look in different Path directories for the file django-
> admin.py. However, typing "django-admin.py help" in any other
> directory gives me the same output as above.
>
> I Googled around, and the only thing I found was this comment:
>
> "you have to change the file association from (cant remember) to "%1″
> %* and it should work"
> Source:http://i.justrealized.com/2008/04/08/how-to-install-python-and-django...
>
> Does anyone understand what this means?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: What's the best configuration for Apache + mod_wsgi + nginx

2009-01-10 Thread Stefan Tunsch

It looks like it's clear video conversion is your bottleneck.

I would also suggest doing that on a different worker process.

You will also want to avoid converting the same file again if you've
done it before...

I was suggesting to give a shot of using ONLY nginx with Django.
If you search in Google you'll find docs that help you setting that up.

In general, 1GB of RAM is not much for a site that coverts video on the fly...

Regards

On 1/10/09, Graham Dumpleton  wrote:
>
>
>
> On Jan 10, 11:05 am, lenin  wrote:
>> The server MPM is prefork.
>>
>> I had mod_wsgi in daemon mode I think, with this lines:
>>
>> WSGIDaemonProcess user_name user=user_name group=user_name
>> WSGIProcessGroup user_name
>> WSGIScriptAlias / /path/to/django.wsgi
>
> Which is one process with 15 threads. That means at most 15 requests
> can be handled at the same time.
>
> The problem is that with what you are doing, is it is likely that the
> requests take a long time if they doing video conversion. Thus if you
> get 15 requests active at one time, other requests will be queued and
> will appear to take a lot longer.
>
> How long does a request which involves conversion normally take?
> Knowing this is critical to determining how many processes/threads you
> need to handle enough concurrent requests based on your load.
>
> The next problem though is if you are doing the video conversion
> within the Django process itself, then allowing more concurrent
> requests and thus conversions, means that the process size will
> balloon out if this process takes a lot of memory for each request.
> So, are you doing conversion within the Django process and how much
> memory does the process of conversion use.
>
> You thus perhaps should not be doing video conversion within the same
> process, but executing a separate application to perform the
> conversion. Even then, you may need a queueing system or otherwise
> some way of restricting how many conversions can occur at a time,
> because even though performed by a separate application, it may still
> take up a lot of transient memory while running.
>
> Also, from what I understand Django's abilities to serve up static
> files or streamed data, isn't that excellent. In particular, if
> hosting with WSGI capable server, it doesn't use the wsgi.file_wrapper
> extension. This extension ensures that files are streamed in blocks
> and the file is not read all into memory first in order to be able to
> send it. Also, if operating system provides it, Apache will use
> sendfile() or memory mapping techniques to return data in a much more
> efficient way. So, how exactly are you returning the converted data
> for Django to respond with?
>
>> That was at the moment of the first message, but now I have commented
>> out the WSGIDaemonProcess and WSGIProcessGroup directives, and what
>> happens is that the memory fills up until the server crashes, It runs
>> out of RAM and swap and it just dies. But until it crashes it is very
>> responsive.
>
> Which is not surprising as prefork means that instead of a restricted
> number of copies of Apache, based on your configuration you could have
> up to 70. That is 70 copies of Django, plus memory from conversions.
> This would quickly cripple a box without adequate memory. Just the
> startup cost of the extra processes when Apache deems they need to be
> created would cause the load average of the box to shoot up.
>
>> I have tried putting processes=5 threads=1 maximum-
>> requests=200 in the daemon configuration but it doesn't help.
>
> Which is only 5 concurrent requests, which is worse than the 15 you
> had before. You also have 5 potentially fat Django processes rather
> than 1.
>
> Graham
>
>> On apache I have this configuration
>>  KeepAlive Off
>> 
>> StartServers 5
>> MinSpareServers  5
>> MaxSpareServers  10
>> MaxClients   70
>> MaxRequestsPerChild 150
>> 
>>
>> On nginx I have
>> worker_processes  10;
>> events {
>> worker_connections  4096;
>> use epoll;}
>>
>>  location / {
>> proxy_pass  http://localhost:8080;
>> proxy_redirect  default;
>> proxy_set_headerHost $host;
>> proxy_set_headerX-Real-IP $remote_addr;
>> proxy_set_headerX-Forwarded-For
>> $proxy_add_x_forwarded_for;
>>
>> client_max_body_size10m;
>> client_body_buffer_size 128k;
>>
>> proxy_connect_timeout   1000;
>> proxy_send_timeout  1000;
>> proxy_read_timeout  1000;
>>
>> proxy_buffer_size   4k;
>> proxy_buffers   4 32k;
>> proxy_busy_buffers_size 64k;
>> proxy_temp_file_write_size  128k;
>> }
>> I only include the bits I think are relevant.
>>
>> The site is kickyoutube.com, you can download any youtube video in
>> several formats by appending kick to 

Re: deploying a project

2009-01-10 Thread Graham Dumpleton



On Jan 10, 7:32 pm, Alan  wrote:
> I use mac book pro, and I didn't like the way I have to set put apache2 +
> mod_wsgi in mac osx... poor documentation by the way.
> I will give a 2nd thought about it.

Huh, what are you talking about?

The mod_wsgi package builds against Apple supplied Apache and Python
out of the box. How to build mod_wsgi from source code is well
documented, as is how to setup Apache for mod_wsgi and then how to
setup Django to work with it.

Which documentation are you looking about which you think is
inadequate?

Graham

> Thanks Malcolm.
>
> Alan
>
> On Sat, Jan 10, 2009 at 08:27, Malcolm Tredinnick
> wrote:
>
>
>
>
>
> > On Sat, 2009-01-10 at 08:03 +, Alan wrote:
> > > Good you asked, I don't know because I couldn't try it yet. This a bit
> > > complicated. We are spread across Europe and I don't have the access
> > > as admin to the server, so what I am doing is the best I can because
> > > then the admin will test it. She set up the apache to restart every
> > > hour. So you see, if I don't success at first I will have to wait
> > > another hour... or her do restart (if available), not just 2 min for
> > > me unfortunately :-)
>
> > You don't have to test it out on the production servers. Set up Apache
> > on your laptop or development workstation.
>
> > Regards,
> > Malcolm
>
> --
> Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
> Department of Biochemistry, University of Cambridge.
> 80 Tennis Court Road, Cambridge CB2 1GA, UK.
>
> >>http://www.bio.cam.ac.uk/~awd28<<
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: deploying a project

2009-01-10 Thread Alan
I use mac book pro, and I didn't like the way I have to set put apache2 +
mod_wsgi in mac osx... poor documentation by the way.
I will give a 2nd thought about it.

Thanks Malcolm.

Alan

On Sat, Jan 10, 2009 at 08:27, Malcolm Tredinnick
wrote:

>
> On Sat, 2009-01-10 at 08:03 +, Alan wrote:
> > Good you asked, I don't know because I couldn't try it yet. This a bit
> > complicated. We are spread across Europe and I don't have the access
> > as admin to the server, so what I am doing is the best I can because
> > then the admin will test it. She set up the apache to restart every
> > hour. So you see, if I don't success at first I will have to wait
> > another hour... or her do restart (if available), not just 2 min for
> > me unfortunately :-)
>
> You don't have to test it out on the production servers. Set up Apache
> on your laptop or development workstation.
>
> Regards,
> Malcolm
>
>
>
> >
>


-- 
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: deploying a project

2009-01-10 Thread Malcolm Tredinnick

On Sat, 2009-01-10 at 08:03 +, Alan wrote:
> Good you asked, I don't know because I couldn't try it yet. This a bit
> complicated. We are spread across Europe and I don't have the access
> as admin to the server, so what I am doing is the best I can because
> then the admin will test it. She set up the apache to restart every
> hour. So you see, if I don't success at first I will have to wait
> another hour... or her do restart (if available), not just 2 min for
> me unfortunately :-)

You don't have to test it out on the production servers. Set up Apache
on your laptop or development workstation.

Regards,
Malcolm



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



Re: deploying a project

2009-01-10 Thread Alan
Good you asked, I don't know because I couldn't try it yet. This a bit
complicated. We are spread across Europe and I don't have the access as
admin to the server, so what I am doing is the best I can because then the
admin will test it. She set up the apache to restart every hour. So you see,
if I don't success at first I will have to wait another hour... or her do
restart (if available), not just 2 min for me unfortunately :-)
Many thanks,
Alan

On Sat, Jan 10, 2009 at 01:16, Malcolm Tredinnick
wrote:

>
> On Fri, 2009-01-09 at 14:03 +, Alan wrote:
> [...]
>
> > ---
> > 
> > DocumentRoot /home/blabla/myproj_1
> > ServerName myproj1.acme.com
> >
> > Alias
> >  >  ...
> > 
> >  ...
> >
> > WSGIScriptAlias / "/home/blabla/myproj_1/myproj_1.wsgi"
> > WSGIDaemonProcess myproj_1 user=blabla group=users processes=1
> > threads=16
> > WSGIProcessGroup myproj_1
> >  ...
> > 
> >
> >
> > 
> > DocumentRoot /home/blabla/myproj_2
> > ServerName myproj2.acme.com
> >
> > Alias
> >  >  ...
> > 
> >  ...
> >
> > WSGIScriptAlias / "/home/blabla/myproj_2/myproj_2.wsgi"
> > WSGIDaemonProcess myproj_2 user=blabla group=users processes=1
> > threads=16
> > WSGIProcessGroup myproj_2
> >  ...
> > 
> > ---
> >
> >
> >
> > where myproj_1 is already working with wsgi.
> >
> >
> > Is that?
>
> That looks like it should work. But, seriously, what happened when you
> tried it? This sort of thing takes two minutes to try out and test and
> will fail very obviously if it doesn't work. So set up an Apache install
> on your development machine and try it out.
>
> Regards,
> Malcolm
>
>
>
>
> >
>


-- 
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---