Re: FeedMagnet: New Django-powered website just launched

2009-12-26 Thread James Matthews
Just as a side recommendation and this is no way the only way to secure your
site. You may want to move your login portal to another page then the
default /admin page.

On Sat, Dec 26, 2009 at 6:44 PM, OkaMthembo  wrote:

> Great work, Jason & team. I thought it would be interesting to take a peek
> at the timeline.
>
> Season's greetings to all..
>
> Lloyd
>
>
> On Thu, Dec 17, 2009 at 4:10 PM, Jason Ford  wrote:
>
>> Let's see. We started on the Django version in mid-October...so right
>> at 2 months from first code until now. Luke had used Django on a few
>> projects before this one, but the past two months have been my
>> introduction to Django. I really like it - especially compared with
>> some of the PHP frameworks I had dabbled in previously. Not only was
>> it quicker to build in Django, but I feel like our code is much more
>> maintainable too.
>>
>> - Jason
>>
>>
>> On Dec 17, 2:21 am, OkaMthembo  wrote:
>> > Look great, Jason. If i may ask, how long did it take from nought to
>> finish?
>> >
>> > Lloyd
>> >
>> >
>> >
>> >
>> >
>> > On Thu, Dec 17, 2009 at 12:18 AM, Jason Ford 
>> wrote:
>> > > We just launched the public beta of FeedMagnet a few minutes ago. It
>> > > is a Django-powered web app that helps business harness social media.
>> > > It is essentially an aggregator that pulls in content from multiple
>> > > social networks and lets you do things with it - like putting the
>> > > incoming content back up on your own website.
>> >
>> > >http://www.feedmagnet.com
>> >
>> > > Our experience using Django to build the site has been fantastic.
>> > > We're also using CouchDB to store all of the updates and images as
>> > > they come in from Twitter, Flickr, Delicious, RSS feeds, and other
>> > > sources. We're planning to release our custom CouchDB/Python
>> > > integration code as an open source module soon.
>> >
>> > > Thanks to the Django community for the excellent framework,
>> > > documentation, and user groups. We're glad to be a part of the
>> > > community!
>> >
>> > > - Jason
>> >
>> > > --
>> >
>> > > 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.
>> >
>> > --
>> > Regards,
>> > Sithembewena Lloyd Dubehttp://www.lloyddube.com
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>>
>
>
> --
> Regards,
> Sithembewena Lloyd Dube
>
> http://www.lloyddube.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
http://www.goldwatches.com

--

--

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




mapping url to feed

2009-12-26 Thread neridaj
I'm trying to retrieve blog entries for a specific category and I'm
not sure how to generate the correct url in my template. here is what
I have:


{{ category.title }}

feeds = { 'entries': LatestEntriesFeed, 'links': LatestLinksFeed,
'categories': CategoryFeed, 'tweets': LatestTweetsFeed }

(r'^feeds/(?P.*)/$', 'django.contrib.syndication.views.feed',
{ 'feed_dict': feeds }, 'category_feed'),

I think I need to have "categories/category.title" to correctly map to
"feeds/categories/category.title" but I'm not sure how/if I should do
that in the template.


Thanks for any help,

J

--

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: mmmmm

2009-12-26 Thread Michael Jenkinson
hi

Thanks for this. As it happens Ive had a hard drive go so installing again is 
now the only option. I will be much more careful about how I install stuff. I 
guess thats the peril of using older stuff but I cant afford new.

This pc (not the one with a hd failure) has fedora 12 on it. Ive just been 
looking at how it has installed python. I might give downloading django onto 
here a go and see if its any different.

Im sorry if I was vague before but extremely grateful for all of the help.


Cheers


Michael





From: Adrian Maier 
To: django-users@googlegroups.com
Sent: Sat, December 26, 2009 8:39:57 PM
Subject: Re: m


On Sat, Dec 26, 2009 at 08:13, Michael Jenkinson  
wrote:

Hi
>
>Thank you so much for taking the time to reply.
>
>When you are as new to both python and django as I am you dont always see the 
>wood for the trees. Yes I still know I have a problem with how the paths are 
>setup, system paths that is that relate to python in general and to django, 
>what I do about it at this moment Im not sure. I may end up reinstalling 
>ubuntu completely because I think it is something that I have done that has 
>caused the problem. I do like how it (python/django) works when it does work 
>but then I do something and the django bit stops. I do think that my 60yo 
>brain needs the exercise though so will persevere. Perhaps I will avoid 
>dementia for an extra 6 months because of this but then the stress probably 
>takes off a year. 
>
>Thank you so much for your time
> and patience. Sorry for being vague. Happy to be still awake at 6:15 in the 
> morning trying to get this to work. Its a while since had an all night 
> session!!!
>


Michael,

Reinstalling the whole operating system sounds like a very extreme solution.

Firstly, does the following work or not ? 
  $ python
  >>> import django
  >>> print django.VERSION
  (1, 1, 0, 'beta', 1)


Secondly, are you absolutely sure that you have installed _only_ the 'django' 
ubuntu package?  I'm asking because you have mentioned that you've copied some 
files. It is strange that you are trying to do such a thing  . When installing 
a package with apt-get the files are copied to the right directories, and you 
are not supposed to do anything with them. 

Thirdly,  are you absolutely sure that you didn't in fact try to install django 
'by hand'  which means "download a django archive from the website ,  unarchive 
it yourself and then install it as a python module"   ? 

I have experienced a broken django installation when the ubuntu package was 
installed,   and then someone has also tried to install django 'by hand'.   

I'd suggest you to :
- uninstall the django ubuntu package- verify that the django module is 
installed  (  start python  , and then see if 'import django' works   )
- get the django  tar.gz  from the Django website
- unarchive it 
- (as root)  execute :   python  setup.py   install 
- verify that the django module is installed  (  start python  , and then see 
if 'import django' works   )- verify that the django module is installed  (  
start python  , and then see if 'import django' works   )

If i remember correctly, the  django-admin.py  is copied to /usr/local/bin 
which is
not in the default PATH.   So for conveninience you might want to add 
/usr/local/bin 
to your PATH . 



Good luck,
Adrian Maier

--
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: {% url admin:index %} generating wrong urls

2009-12-26 Thread Karen Tracey
On Sat, Dec 26, 2009 at 6:54 PM, Chris Withers wrote:

> Karen Tracey wrote:
> > In my case, environ.get('SCRIPT_URL', u'') and
> > environ.get('REDIRECT_URL', u'') both return empty.
>
> I wonder what SCRIPT_URL is and why it's empty for you but not for me?
>
>
It's set by mod_rewrite:

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

Enabling it and turning it on for this virtual host I see the behavior you
describe, when I access the root page without a trailing slash.  With a
trailing slash things are fine.

There is at least one bug open on empty PATH_INFO handling:

http://code.djangoproject.com/ticket/9435

though it doesn't sound like it's focused on exactly the same issue, and
fixing this one for the special case of empty PATH_INFO may be easier than
the overall problem that is the concern of that ticket.  But I don't have
time at the moment to really look at it closely, nor to check if there's
another open ticket that might match this one more closely.

Karen

--

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




Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
Karen Tracey wrote:
> In my case, environ.get('SCRIPT_URL', u'') and 
> environ.get('REDIRECT_URL', u'') both return empty.

I wonder what SCRIPT_URL is and why it's empty for you but not for me?

I wonder if SCRIPT_URL having a value is something that came along with 
a  later version of mod_wsgi? Could you trying using the debian-packaged 
mod_wsgi (whih is version 2.5.x) and see if that changes the behaviour 
you observe?

> Since rewrites were mentioned earlier perhaps it's significant that this 
> Apache setup doesn't have mod_rewrite enabled.

I don't think so, I've checked with the rewrite engine's logging and all 
the urls in question are being passed straight through.

Chris

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

--

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




Re: New to Django

2009-12-26 Thread datta
Thanks Selvam. I like the tut as well (now :-) ) and it covers quite a
bit of material.

Regards,
Datta.

On Dec 24, 9:33 am, "S.Selvam"  wrote:
> > Some simple tutorial (other than the one on Django website).
>
> I have been learning with the offical website tutorial,it is excellent !,why
> don't you try it ?
>
> > If some Django evangelist can guild me I will be INDEBTED!
>
> > Regards,
> > Datta
>
> --
> Regards,
> S.Selvam

--

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: New to Django

2009-12-26 Thread datta
@Shawn,
Thanks a lot for your time and response. I don't need any animations,
but I do need a presentable web-page which is user-friendly. I already
built all of this in PHP and I just hate it (it looks very clumsy , in
terms of presentation and code-management). So I decided to give
Django a try.

@Shawn/All,

If any one in this community  wouldn't mind giving me some pointers on
what I want to do specifically, that will be great. ( I kinda want to
deliver a simple web site by Monday, and any help in this regard is
greatly appreciated). I wouldn't be mean by asking your for a specific
solution, but I will be very pleased to get some suggestions and
ideas.

Here is a brief write up of what I am doing and what I need.

1. My Objective:
To build a modular/easily manageable web application which allows
users to view a data repository that I built. The user can then
compare his/her data with the data in my repository and carry out some
statistical analysis ( I have the tools build for it (in Python)
already.). The results of the statistical analysis are the real
deliverables to the end-user. My repository is the 'seed-data'  to run
the statistical models. The hope is that users will like the tool and
(as a token of gratitude) choose to donate their data to the
repository (which I expect to be useful to the community at large).

2. My specific requirements:
A. I want to know who is using the tool and what they are submitting.
So I want only the logged-in users to play with my web-tools. So, I
need a user self-registration module.
B. I want an admin-management module - to administer user access. In
addition, I want to have user specific access control to the data in
my repository. (but this is in the phase-II plan, so it is not an
immediate requirement).
C. I want data level access control . i.e., I want to ensure that if I
choose to mask certain data to certain users, I should be able to do
so. (but this is phase-II and not an immediate requirement.)
D. I want to render my results as "html web pages" containing "tables
(data)" and "images (plots)". The data in the html tables should be
exportable as csv files and plots exportable as pdf reports. ( so I
need an 'export' functionality. Part of this requirement in phase-II.
So basically I will do what ever I can in phase-I).
E. I want to enforce certain basic security measures (to prevent my
web server from crashing). Specifically, I want to ensure I don't get
repeat hits from the same IP/domain. Also, I want to ensure that my
web server is not used as an intermediate route by hackers ( so I
basically should have a very strict set possible operations by the
user). I will prefer using https and i will prefer 'masking' my URL's
( so they really dont know where the actual data resides).

3. What am I seeking from this community?
1. Pointers to pluggable django apps. (this is what I really need)
2. Brief ideas of how you would go about with each of these
requirements , if you are dealing with similar things. ( of course if
you have some time to spare and wouldn't mind doing thing -- but I
will reaallly appreciate any mentoring in this regard).

4. Logistics:
I have a fedora box on which I will host my application. I will have a
firewall and make sure I have only specific ports open. Obviouslly, I
will be using Apache as the web server. As of now, I am planning on
using sqlite as my database.

Regards,
Datta.




On Dec 23, 9:50 pm, Shawn Milochik  wrote:
> On Dec 23, 2009, at 7:43 PM,Dattatreya Mwrote:
>
> > 1. @Shawn, Thanks for the reply. I appreciate you taking time to answer.
>
> > 2. I am going through the Django tutI was wondering if there is 
> > something else that would save me hours of 're-inventing' the wheel (with 
> > regards to designing websites using Django). (cook book/ for 'dummies' kind 
> > of a thing/ etc...??)
>
> > 3. By UI design, I mean, those flashy websites that people make. As it is, 
> > I write code to manipulate data. For the first time I am hosting a page for 
> > the world to access one of my statistical models. How do I make those 
> > flashy-flashy things..
>
> > Regards,
> > Datta.
>
> Well, Django lets you do anything you can do with any other server-side 
> language. If you want to add animation and stuff like that, that's not 
> Django. Nor is it PHP, ASP, or any other language or framework. You might 
> want to look into Flash. Django doesn't make the "look and feel" of your 
> site. It serves up the data. Even things like JavaScript are outside of 
> Django's domain.
>
> It sounds to be like you aren't really looking for Django, but maybe 
> something like Dreamweaver. The stuff you call "re-inventing the wheel" is 
> what I call "learning to program." You have to copy what others have done to 
> learn how it works, so you can then adapt it for yourself.
>
> However, if your statistical models exist in a database, and you'd like a 
> friendly ORM [1] to use to write the logic behind your Web site, then I 
> wholeheartedly r

Re: FeedMagnet: New Django-powered website just launched

2009-12-26 Thread OkaMthembo
Great work, Jason & team. I thought it would be interesting to take a peek
at the timeline.

Season's greetings to all..

Lloyd

On Thu, Dec 17, 2009 at 4:10 PM, Jason Ford  wrote:

> Let's see. We started on the Django version in mid-October...so right
> at 2 months from first code until now. Luke had used Django on a few
> projects before this one, but the past two months have been my
> introduction to Django. I really like it - especially compared with
> some of the PHP frameworks I had dabbled in previously. Not only was
> it quicker to build in Django, but I feel like our code is much more
> maintainable too.
>
> - Jason
>
>
> On Dec 17, 2:21 am, OkaMthembo  wrote:
> > Look great, Jason. If i may ask, how long did it take from nought to
> finish?
> >
> > Lloyd
> >
> >
> >
> >
> >
> > On Thu, Dec 17, 2009 at 12:18 AM, Jason Ford 
> wrote:
> > > We just launched the public beta of FeedMagnet a few minutes ago. It
> > > is a Django-powered web app that helps business harness social media.
> > > It is essentially an aggregator that pulls in content from multiple
> > > social networks and lets you do things with it - like putting the
> > > incoming content back up on your own website.
> >
> > >http://www.feedmagnet.com
> >
> > > Our experience using Django to build the site has been fantastic.
> > > We're also using CouchDB to store all of the updates and images as
> > > they come in from Twitter, Flickr, Delicious, RSS feeds, and other
> > > sources. We're planning to release our custom CouchDB/Python
> > > integration code as an open source module soon.
> >
> > > Thanks to the Django community for the excellent framework,
> > > documentation, and user groups. We're glad to be a part of the
> > > community!
> >
> > > - Jason
> >
> > > --
> >
> > > 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.
> >
> > --
> > Regards,
> > Sithembewena Lloyd Dubehttp://www.lloyddube.com
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>


-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.com

--

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




Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Karen Tracey
On Sat, Dec 26, 2009 at 6:07 PM, Chris Withers wrote:

> Graham Dumpleton wrote:
> >
> >> I also added a {{request}} to the base.html of the django
> >> app. Here's the output of the request's SCRIPT_NAME for various urls:
> >>
> >> /studio   - u''
> >> /studio/  - u'/studio'
> >> /test - '/test'
> >> /test/- '/test/'
> >
> > Hmmm, that would suggest that it is Django that is changing it for
> > some reason.
>
> I believe it's a bug in Django:
>
>
> http://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/core/handlers/base.py#L204
>
>
Inline is easier to see:

script_url = environ.get('SCRIPT_URL', u'')
if not script_url:
script_url = environ.get('REDIRECT_URL', u'')
if script_url:
return force_unicode(script_url[:-len(environ.get('PATH_INFO',
''))])
return force_unicode(environ.get('SCRIPT_NAME', u''))

Line 204 is the one that returns a modified script_url based on what's in
PATH_INFO.

 [snip]

> The problem is when PATH_INFO is empty, as it is in the top case. Python
> has no notion of positive or negative zero (;-)) so we end up returning
> script_url[:0]...
>
> Now, I'm really curious that Karen says this works for her. Karen, can
> you have a look at what's different about your apache setup, as I can't
> see how this would ever correctly work for the "root url without the
> slash" case.
>

In my case, environ.get('SCRIPT_URL', u'') and environ.get('REDIRECT_URL',
u'') both return empty.  So I don't get to line 204, I go to line 205, which
returns the correct value. I don't know what's different about my Apache
setup to result in that difference, this is a pretty bare-bones virtual host
I have set up for testing.

Since rewrites were mentioned earlier perhaps it's significant that this
Apache setup doesn't have mod_rewrite enabled.

Karen

--

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




Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Karen Tracey
On Sat, Dec 26, 2009 at 5:59 PM, Chris Withers wrote:

> Karen Tracey wrote:
> > On Sat, Dec 26, 2009 at 5:32 PM, Chris Withers  > > wrote:
> >
> >
> > If anyone can tell me how to do "httpd -X" on a debian or ubuntu host
> > I'd be very grateful...
> >
> >
> > /usr/sbin/apache2 -X
>
> For me that gave:
>
> # /usr/sbin/apache2 -X
> apache2: bad user name ${APACHE_RUN_USER}
>

Oh right.  I had previously run source /etc/apache2/envvars to get the
environment vars exported.


>
> However, as I said in my other thread, what did work for me was:
>
> apache2ctl -X
>
>
I forgot about that one.  It's a front-end to the other that does the
environment variable setup automatically.

Karen

--

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




Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
Graham Dumpleton wrote:
> 
>> I also added a {{request}} to the base.html of the django
>> app. Here's the output of the request's SCRIPT_NAME for various urls:
>>
>> /studio   - u''
>> /studio/  - u'/studio'
>> /test - '/test'
>> /test/- '/test/'
> 
> Hmmm, that would suggest that it is Django that is changing it for
> some reason.

I believe it's a bug in Django:

http://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/core/handlers/base.py#L204

Sadly, still there on the branch and trunk:

http://code.djangoproject.com/browser/django/branches/releases/1.1.X/django/core/handlers/base.py#L215
http://code.djangoproject.com/browser/django/trunk/django/core/handlers/base.py#L215

The problem is when PATH_INFO is empty, as it is in the top case. Python 
has no notion of positive or negative zero (;-)) so we end up returning 
script_url[:0]...

Now, I'm really curious that Karen says this works for her. Karen, can 
you have a look at what's different about your apache setup, as I can't 
see how this would ever correctly work for the "root url without the 
slash" case.

I have to admit, I can't see why the script name would ever need to be 
trimmed like that. Graham, perhaps you might be able to shed some light 
with your greater wsgi experience?

Chris

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

--

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




Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
Karen Tracey wrote:
> On Sat, Dec 26, 2009 at 5:32 PM, Chris Withers  > wrote:
> 
> 
> If anyone can tell me how to do "httpd -X" on a debian or ubuntu host
> I'd be very grateful...
> 
> 
> /usr/sbin/apache2 -X

For me that gave:

# /usr/sbin/apache2 -X
apache2: bad user name ${APACHE_RUN_USER}

However, as I said in my other thread, what did work for me was:

apache2ctl -X

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




running "httpd -X" on debian/ubuntu

2009-12-26 Thread Chris Withers
Chris Withers wrote:
> Graham Dumpleton wrote:
>>> How can I step through execution from the django.wsgi file and see where
>>> I get to? I'm guessing putting an "import pdb; pdb.set_trace()" in the
>>> django.wsgi file won't do what I want?
>> Sort of, but you have to run Apache in single process mode. See
>> further down in same document on debugging.
>>
>>   
>> http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Python_Interactive_Debugger
> 
> If anyone can tell me how to do "httpd -X" on a debian or ubuntu host 
> I'd be very grateful...

In case anyone else needs it:

apache2ctl -X

*sigh* -> why must the debian guys bugger up everything in their distros?!


Chris

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

--

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




Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Karen Tracey
On Sat, Dec 26, 2009 at 5:32 PM, Chris Withers wrote:

>
> If anyone can tell me how to do "httpd -X" on a debian or ubuntu host
> I'd be very grateful...
>
>
/usr/sbin/apache2 -X

Karen

--

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




Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
Graham Dumpleton wrote:
> 
>> How can I step through execution from the django.wsgi file and see where
>> I get to? I'm guessing putting an "import pdb; pdb.set_trace()" in the
>> django.wsgi file won't do what I want?
> 
> Sort of, but you have to run Apache in single process mode. See
> further down in same document on debugging.
> 
>   
> http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Python_Interactive_Debugger

If anyone can tell me how to do "httpd -X" on a debian or ubuntu host 
I'd be very grateful...

Chris

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

--

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




Re: mmmmm

2009-12-26 Thread Adrian Maier
On Sat, Dec 26, 2009 at 08:13, Michael Jenkinson wrote:

> Hi
>
> Thank you so much for taking the time to reply.
>
> When you are as new to both python and django as I am you dont always see
> the wood for the trees. Yes I still know I have a problem with how the paths
> are setup, system paths that is that relate to python in general and to
> django, what I do about it at this moment Im not sure. I may end up
> reinstalling ubuntu completely because I think it is something that I have
> done that has caused the problem. I do like how it (python/django) works
> when it does work but then I do something and the django bit stops. I do
> think that my 60yo brain needs the exercise though so will persevere.
> Perhaps I will avoid dementia for an extra 6 months because of this but then
> the stress probably takes off a year.
>
> Thank you so much for your time and patience. Sorry for being vague. Happy
> to be still awake at 6:15 in the morning trying to get this to work. Its a
> while since had an all night session!!!
>


Michael,

Reinstalling the whole operating system sounds like a very extreme solution.

Firstly, does the following work or not ?
  $ python
  >>> import django
  >>> print django.VERSION
  (1, 1, 0, 'beta', 1)


Secondly, are you absolutely sure that you have installed _only_ the
'django' ubuntu package?  I'm asking because you have mentioned that you've
copied some files. It is strange that you are trying to do such a thing  .
When installing a package with apt-get the files are copied to the right
directories, and you are not supposed to do anything with them.

Thirdly,  are you absolutely sure that you didn't in fact try to install
django 'by hand'  which means "download a django archive from the website ,
unarchive it yourself and then install it as a python module"   ?

I have experienced a broken django installation when the ubuntu package was
installed,   and then someone has also tried to install django 'by hand'.

I'd suggest you to :
- uninstall the django ubuntu package
- get the django  tar.gz  from the Django website
- unarchive it
- (as root)  execute :   python  setup.py   install
- verify that the django module is installed  (  start python  , and then
see if 'import django' works   )

If i remember correctly, the  django-admin.py  is copied to /usr/local/bin
which is
not in the default PATH.   So for conveninience you might want to add
/usr/local/bin
to your PATH .



Good luck,
Adrian Maier

--

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: {% url admin:index %} generating wrong urls

2009-12-26 Thread Graham Dumpleton


On Dec 26, 11:18 pm, Chris Withers  wrote:
> Graham Dumpleton wrote:
>
> > As I told you when you tried to use private email to get me to help on
> > this,
>
> Apologies for that, I was actually trying to use Google's web UI to
> reply to that thread in context. Their UI obvious sucks more than I
> realised as it just sent a private mail to you :-(
>
> >> - I'm running the whole project out of a buildout using djangorecipe
> >> 0.20 (although I did trace through the django.wsgi file and all the work
> >> is still done by django.core.handlers.wsgi.WSGIHandler
>
> > Yes, but what exactly does the WSGI script file contain in regard to
> > the 'application' object. For Django it normally would be:
>
> >   import django.core.handlers.wsgi
> >   application = django.core.handlers.wsgi.WSGIHandler()
>
> Yup, djangorecipe's script sets application to an instance of
> django.core.handlers.wsgi.WSGIHandler(), not a subclass and with no
> apparent buggering around with the environment.
>
> > If that buildout recipe is doing anything else fancy in it and is
> > modifying the WSGI environment, especially the values of SCRIPT_NAME
> > and PATH_INFO, then it could be stuffing it all up.
>
> Nope, can't see any evidence of this...
>
> > What you should do is disable that rewrite rule and then enable Apache
> > rewrite rule logging to see what other rewrites are occurring in case
> > there is something else which is playing with the URL which shouldn't
> > be.
>
> Once the controversial rewrite rule is disabled and I have rewrite
> logging enabled, I get straight pass through when I visit any of:
>
> /studio
> /studio/
> /studio/subdir
>
> > The best first step though on working this out though is that test
> > program you were pointed to in the documentation. Use it instead of
> > Django and then post examples of the WSGI environment for requests:
>
> >   /studio
> >   /studio/
> >   /studio/subdir
>
> > Ensuring you don't have that rewrite rule in place.
>
> Okay, so I put the debugging app you linked to in test.py and now have:
>
> WSGIScriptAlias /studio /django/studio/bin/django.wsgi
> WSGIScriptAlias /test /django/test.py
>
> I also added a {{request}} to the base.html of the django
> app. Here's the output of the request's SCRIPT_NAME for various urls:
>
> /studio   - u''
> /studio/  - u'/studio'
> /test     - '/test'
> /test/    - '/test/'

Hmmm, that would suggest that it is Django that is changing it for
some reason.

> > Also post all mod_wsgi relevant bits of your Apache configuration so
> > can see what else you have in there. If you had for example other
> > configuration, especially WSGIScriptAliasMatch or ScriptAliasMatch
> > directives that also match, then they could be getting applied and
> > causing issues if the way you used those directives is wrong, as they
> > can have side affects of modifying SCRIPT_NAME and PATH_INFO and the
> > relationships between them.
>
> Other than the above two WSGIScriptAlias directives, there are no
> mod_wsgi directives or ScriptAlias*'s...
>
> How can I step through execution from the django.wsgi file and see where
> I get to? I'm guessing putting an "import pdb; pdb.set_trace()" in the
> django.wsgi file won't do what I want?

Sort of, but you have to run Apache in single process mode. See
further down in same document on debugging.

  
http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Python_Interactive_Debugger

Graham

--

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.




Null constraint violations when saving objects with ForeignKey relationships

2009-12-26 Thread gmayer
Hi guys,

I'm new to Django but otherwise quite a seasoned python and sql
programmer. I'm baffled by django's foreign key id behaviour and as a
result stuck in my current coding project. Let me start immediately
with an example of what I'm trying to do. Assume two very simple
models:

class A(models.Model):
pass
class B(models.Model):
a = models.ForeignKey(A)

Now I need to create an instance of A and B without saving either of
them (I'm parsing a whack load of data and only want to commit objects
to the db once successfully parsed):

from test.models import A,B
instA = A()
instB = B(a=instA)

Now I'm done with my parsing and am happy to save them to my database:

instA.save() # all good
instB.save() # fails with IntegrityError: null value in column "a_id"
violates not-null constraint

On closer inspection the second line above fails because instB.a_id is
None, even though instB.a.id is defined. Why does django throw in a
duplicate, now stale instB.a_id field which, to make matters worse, is
used in generating the underlying SQL for instB.save() to result in
failure

Perhaps I'm just to n00b to use the correct semantics which avoid the
above issues... excuse me if that's the case.

Gunther

--

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-tagging is not multi-db safe

2009-12-26 Thread Alex_Gaynor


On Dec 26, 11:11 am, Rob Hudson  wrote:
> > Django-tagging have a lot of users though. Maybe the pinax-people will
> > arrange for a version that is 1.2-safe.
>
> Check out django-taggit:http://github.com/alex/django-taggit

Unfortunately django-taggit isn't multi-db safe, although I'm aware of
this (and have been ever since I wrote it :P).  I don't imagine it'll
be difficult to make it work though, the internal poking is fairly
self contained.

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-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: Matplotlib with Django

2009-12-26 Thread heaviside x
I have looked at POST via AJAX, but I started to steer away from it
after I read that a POST request is more for changing or updating data
in a database and GET is more for changing how the data is viewed.  Is
my understanding wrong?  Honestly, I am a python programmer who is
picking up web development as I go.

In addition, I've been trying to implement this so it works without
javascript if necessary (I've read that this is the best practice if
possible).  If I were to implement this w/out javascript with POST
wouldn't I need to pass all the parameters via the URL?

How does youtube shorten their URLs?

Finally,  the code snippet your proposed would work, but what I was
trying to do by returning both an image and HTML in a request is
remove the separation between my two views.

On Dec 26, 5:39 am, Hinnack  wrote:
> if you want to offer lots of properties one can change, POST via ajax is the
> better way - as you said
> long URLs can get very ugly - although you could shorten them like youtube
> or others do it.
> GET is far better at this point of time, as only GET requests are cachable
> (as far as I know) by djangos
> middleware.
>
> if I understand you right: you want to mix html with image-data? That is
> impossible. But you can
> add parameters to the header of the http response of the image and put in
> there all settings needed to render the image...
> So you need 2 urls - although you could add a second variable to the url
> e.g. output:
> url(r'^graph_example/(?P\d+)/(?P\w+)/$')
>
> and then a view:
>
> def myview(request, id, output):
>    if output == 'image':
>      # output image data
>    else:
>       # output html data
>
> 2009/12/26 heaviside x 
>
> > Hello,
>
> > To start, this is not another how do I get matplotlib to work in
> > Django thread.  This is how do I get matplotlib to work better with
> > django.  Before I go on, let me outline what I'm doing.
>
> > I'm currently working on a scientific data manager/viewer which uses
> > matplotlib as the primary graphing workhorse.  My intention is to be
> > able to easily handle all sorts of crazy scientific plots (Smith
> > Charts, Polar Plots with negative values, and other crazy mappings).
> > In the past, matplotlib has been able to easily and elegantly handle
> > these charts, so I'm sticking with it for now.  I also want to be able
> > to take these generated plots and quickly dump them into documents or
> > reports so a save functionality (or drag and drop via the browser) is
> > key.
>
> > Currently, my application is based off the standard matplotlib
> > example.  I have a webpage that contains a static graph.png image and
> > I point that url to another view that renders my matplotlib png and
> > returns it.
>
> > url(r'^graph_example/(?P\d+)/$')
> > url(r'^graph_example/(?P\d+)/graph.png')
>
> > How should I implement editable scales, titles, and labels?  For
> > instance, the graph comes up but I want a different scaling for a
> > report.  I could add all this information as url variables to the
> > view, but that would be extremely ugly.  Is the simple solution a
> > query string?  However, this also yields very ugly URLs.
>
> > Instead of just returning an image in the HttpResposne as the django/
> > matplotlib example shows, is there a way to return the image with the
> > rest of the base page's response?  Removing the need for hard coding a
> > "graph.png" url into my template.
>
> > Any help would be greatly appreciated.
>
> > --
>
> > 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: django-tagging is not multi-db safe

2009-12-26 Thread Rob Hudson
> Django-tagging have a lot of users though. Maybe the pinax-people will
> arrange for a version that is 1.2-safe.

Check out django-taggit: http://github.com/alex/django-taggit

--

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-tagging is not multi-db safe

2009-12-26 Thread Hanne Moa
2009/12/26 James Bennett :
> On Fri, Dec 25, 2009 at 1:06 PM, Hanne Moa  wrote:
>> How is one to use as_sql() now with multi-db in?
>
> One doesn't. And, generally, one should be sticking to the stable
> release of Django;

Kinda hard when one wants to experiment to see what needs to change in
order to upgrade to what will become the next stable version :) I'm
not running 1.2 on production code, no.

> third-party applications don't tend to offer guarantees of working with 
> unreleased development code.

Django-tagging have a lot of users though. Maybe the pinax-people will
arrange for a version that is 1.2-safe.


HM

--

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-tagging is not multi-db safe

2009-12-26 Thread Hanne Moa
2009/12/26 Russell Keith-Magee :
> On Sat, Dec 26, 2009 at 3:06 AM, Hanne Moa  wrote:
>> A site using django-tagging will break hard on 1.2 as of today. See
>> issue http://code.google.com/p/django-tagging/issues/detail?id=233 .
>>
>> How is one to use as_sql() now with multi-db in?
>
> as_sql() is (and has always been) an internal function - it shouldn't
> be relied upon as public API for any application.

I've been using as_sql() for debugging myself. Running it without
arguments doesn't work, so how does one discover what arguments to
feed it?

> Looking at the ticket you linked, it appears that django-tagging has been 
> relying on
> the internals of sql.Query(), which isn't the best idea from the
> perspective of long term code maintainability.

Django-tagging have been relying on a lot of manual sql too, much that
must still remain manual. If only() would also affect what is listed
in a GROUP BY I think at least most of the manual sql could be
dispensed with. Heck, I want only() to work that way regardless. I
could dispense with the last manual sql in my own stuff, used to
calculate statistical mode over a column of integers.


HM

--

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: ManyToOne to auth.models.User

2009-12-26 Thread TiNo
On Mon, Dec 14, 2009 at 15:52, Itay Donenhirsch  wrote:

> any progress?
>

Well, I guess I'll use a 'profile' although it feels like there should be
more logical way, but I guess that depends on the extensibility of the User
model...

On Wed, Dec 9, 2009 at 12:09 PM, Itay Donenhirsch  wrote:
> > use a userprofile
> > see http://docs.djangoproject.com/en/dev/topics/auth/, search for
> "userprofile"
> > also take a look at
> >
> http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/
> >
> >
> > On Tue, Dec 8, 2009 at 11:53 PM, TiNo  wrote:
> >> On Tue, Dec 8, 2009 at 12:58, Itay Donenhirsch  wrote:
> >>>
> >>> one to many from year to user is same as many to one from a
> >>> user to a year.
> >>
> >> Yes, but how? :D I can't place a FK on the User...
> >>
> >> --
> >>
> >> 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: about django model save

2009-12-26 Thread Carlos Ricardo Santos
Thanks for remind me about South.
This really looks amazing!
No more "rm db && manage.py syncdb"
:D

2009/12/25 Shawn Milochik 

> Django-south is the best solution right now. Django-evolution is no longer
> developed, as the author thinks South is the current best solution.
>
> http://south.aeracode.org/
>
> 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
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>


-- 
Cumprimentos,
Carlos Ricardo Santos

--

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: Matplotlib with Django

2009-12-26 Thread Hinnack
if you want to offer lots of properties one can change, POST via ajax is the
better way - as you said
long URLs can get very ugly - although you could shorten them like youtube
or others do it.
GET is far better at this point of time, as only GET requests are cachable
(as far as I know) by djangos
middleware.

if I understand you right: you want to mix html with image-data? That is
impossible. But you can
add parameters to the header of the http response of the image and put in
there all settings needed to render the image...
So you need 2 urls - although you could add a second variable to the url
e.g. output:
url(r'^graph_example/(?P\d+)/(?P\w+)/$')

and then a view:

def myview(request, id, output):
   if output == 'image':
 # output image data
   else:
  # output html data



2009/12/26 heaviside x 

> Hello,
>
> To start, this is not another how do I get matplotlib to work in
> Django thread.  This is how do I get matplotlib to work better with
> django.  Before I go on, let me outline what I'm doing.
>
> I'm currently working on a scientific data manager/viewer which uses
> matplotlib as the primary graphing workhorse.  My intention is to be
> able to easily handle all sorts of crazy scientific plots (Smith
> Charts, Polar Plots with negative values, and other crazy mappings).
> In the past, matplotlib has been able to easily and elegantly handle
> these charts, so I'm sticking with it for now.  I also want to be able
> to take these generated plots and quickly dump them into documents or
> reports so a save functionality (or drag and drop via the browser) is
> key.
>
> Currently, my application is based off the standard matplotlib
> example.  I have a webpage that contains a static graph.png image and
> I point that url to another view that renders my matplotlib png and
> returns it.
>
> url(r'^graph_example/(?P\d+)/$')
> url(r'^graph_example/(?P\d+)/graph.png')
>
> How should I implement editable scales, titles, and labels?  For
> instance, the graph comes up but I want a different scaling for a
> report.  I could add all this information as url variables to the
> view, but that would be extremely ugly.  Is the simple solution a
> query string?  However, this also yields very ugly URLs.
>
> Instead of just returning an image in the HttpResposne as the django/
> matplotlib example shows, is there a way to return the image with the
> rest of the base page's response?  Removing the need for hard coding a
> "graph.png" url into my template.
>
> Any help would be greatly appreciated.
>
> --
>
> 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: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
Graham Dumpleton wrote:
> 
> As I told you when you tried to use private email to get me to help on
> this, 

Apologies for that, I was actually trying to use Google's web UI to 
reply to that thread in context. Their UI obvious sucks more than I 
realised as it just sent a private mail to you :-(

>> - I'm running the whole project out of a buildout using djangorecipe
>> 0.20 (although I did trace through the django.wsgi file and all the work
>> is still done by django.core.handlers.wsgi.WSGIHandler
> 
> Yes, but what exactly does the WSGI script file contain in regard to
> the 'application' object. For Django it normally would be:
> 
>   import django.core.handlers.wsgi
>   application = django.core.handlers.wsgi.WSGIHandler()

Yup, djangorecipe's script sets application to an instance of
django.core.handlers.wsgi.WSGIHandler(), not a subclass and with no 
apparent buggering around with the environment.

> If that buildout recipe is doing anything else fancy in it and is
> modifying the WSGI environment, especially the values of SCRIPT_NAME
> and PATH_INFO, then it could be stuffing it all up.

Nope, can't see any evidence of this...

> What you should do is disable that rewrite rule and then enable Apache
> rewrite rule logging to see what other rewrites are occurring in case
> there is something else which is playing with the URL which shouldn't
> be.

Once the controversial rewrite rule is disabled and I have rewrite 
logging enabled, I get straight pass through when I visit any of:

/studio
/studio/
/studio/subdir

> The best first step though on working this out though is that test
> program you were pointed to in the documentation. Use it instead of
> Django and then post examples of the WSGI environment for requests:
> 
>   /studio
>   /studio/
>   /studio/subdir
> 
> Ensuring you don't have that rewrite rule in place.

Okay, so I put the debugging app you linked to in test.py and now have:

WSGIScriptAlias /studio /django/studio/bin/django.wsgi
WSGIScriptAlias /test /django/test.py

I also added a {{request}} to the base.html of the django 
app. Here's the output of the request's SCRIPT_NAME for various urls:

/studio   - u''
/studio/  - u'/studio'
/test - '/test'
/test/- '/test/'


> Also post all mod_wsgi relevant bits of your Apache configuration so
> can see what else you have in there. If you had for example other
> configuration, especially WSGIScriptAliasMatch or ScriptAliasMatch
> directives that also match, then they could be getting applied and
> causing issues if the way you used those directives is wrong, as they
> can have side affects of modifying SCRIPT_NAME and PATH_INFO and the
> relationships between them.

Other than the above two WSGIScriptAlias directives, there are no 
mod_wsgi directives or ScriptAlias*'s...

How can I step through execution from the django.wsgi file and see where 
I get to? I'm guessing putting an "import pdb; pdb.set_trace()" in the 
django.wsgi file won't do what I want?

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Error

2009-12-26 Thread Łukasz Balcerzak
Hi,

First argument in ``patterns`` factory method is like the starting point
for all views that should be called. Moreover, you may pass function view
as a callable object or as a string but in this case your starting point
has to be hooked first.

So, if for instance, your view method 'firstsite' is in module 'mysite.views'
you have to pass full module-path here ('mysite.views.firstsite') or hook 
'mysite.views'
as starting point (first argument of patterns method). Like that:

> urlpatterns = patterns('mysite.views',
>(r'^first/$','firstsite'),

or if you don't want to specify starting point:

> urlpatterns = patterns('',
>(r'^first/$','mysite.views.firstsite'),


Hope it helps

On Dec 26, 2009, at 12:24 PM, pranjal wrote:

> I had an error using django.Versions : Django 1.1.1, Python 2.6.4
> In the views file when I passed the argument as a string there is an
> error
> Error:   'str' object not callable.
> 
> This shouts : 'str' object not callable
> urlpatterns = patterns('',
>(r'^first/$','firstsite'),
> 
> 
> 
> This works fine :
> 
> urlpatterns = patterns('',
>(r'^first/$',firstsite),
> 
> --
> 
> 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.




Error

2009-12-26 Thread pranjal
I had an error using django.Versions : Django 1.1.1, Python 2.6.4
In the views file when I passed the argument as a string there is an
error
Error:   'str' object not callable.

This shouts : 'str' object not callable
urlpatterns = patterns('',
(r'^first/$','firstsite'),



This works fine :

urlpatterns = patterns('',
(r'^first/$',firstsite),

--

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.




Matplotlib with Django

2009-12-26 Thread heaviside x
Hello,

To start, this is not another how do I get matplotlib to work in
Django thread.  This is how do I get matplotlib to work better with
django.  Before I go on, let me outline what I'm doing.

I'm currently working on a scientific data manager/viewer which uses
matplotlib as the primary graphing workhorse.  My intention is to be
able to easily handle all sorts of crazy scientific plots (Smith
Charts, Polar Plots with negative values, and other crazy mappings).
In the past, matplotlib has been able to easily and elegantly handle
these charts, so I'm sticking with it for now.  I also want to be able
to take these generated plots and quickly dump them into documents or
reports so a save functionality (or drag and drop via the browser) is
key.

Currently, my application is based off the standard matplotlib
example.  I have a webpage that contains a static graph.png image and
I point that url to another view that renders my matplotlib png and
returns it.

url(r'^graph_example/(?P\d+)/$')
url(r'^graph_example/(?P\d+)/graph.png')

How should I implement editable scales, titles, and labels?  For
instance, the graph comes up but I want a different scaling for a
report.  I could add all this information as url variables to the
view, but that would be extremely ugly.  Is the simple solution a
query string?  However, this also yields very ugly URLs.

Instead of just returning an image in the HttpResposne as the django/
matplotlib example shows, is there a way to return the image with the
rest of the base page's response?  Removing the need for hard coding a
"graph.png" url into my template.

Any help would be greatly appreciated.

--

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: Is this right: Modifying the admin changelist?

2009-12-26 Thread alexsantos
Hi,

I just tried your way and it worked great. It's an easy and quick
solution for summing up columns.
I don't know if there is a better way to do it.

Thank you, you saved me a lot of time

On 19 dic, 17:54, yummy_droid  wrote:
> Hi,
>
> I wanted a "sum" of a particular column being listed in the admin list
> page. I looked it up and did it the following way. Is this the correct
> way of doing it?
>
> I modified the admin.py to do the calculation:
>
>  class CollectionAdmin(admin.ModelAdmin):
>     list_display = ('supplier', 'collected_date', 'tonnage',)
>     list_filter = ('collected_date',)
>
>     def changelist_view(self, request, extra_context=None):
>         from django.contrib.admin.views.main import ChangeList
>         from django.db.models import Sum
>         if extra_context is None:
>             extra_context = {}
>         mycl = ChangeList(request, self.model, list(self.list_display),
> self.list_display_links, self.list_filter, self.date_hierarchy,
> self.search_fields, self.list_select_related, self.list_per_page,
> self.list_editable, self)
>         fieldsum = mycl.get_query_set().aggregate(Sum('tonnage'))
>         extra_context['tonnage__sum'] = fieldsum['tonnage__sum']
>         return super(CollectionAdmin, self).changelist_view(request,
> extra_context=extra_context)
>
> then i added the following line to change_list.html:
>
>       {% if tonnage__sum %}Total tonnage: {{ tonnage__sum }}{% endif
> %}
>
> Am I doing something bad in the changelist_view function above? Or is
> it the right way to do this?
>
> the reason I want to use the admin list is because I like the
> filtering option, and I can then see directly the sum of the column
> based on whatever is currently filtered.
>
> Thanks.

--

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




Re: Django-MongoDB

2009-12-26 Thread Peterle
so, what about GAE\BigTables?
How far are we  from that?

On 26 Dic, 10:59, Daniel Roseman  wrote:
> On Dec 26, 12:20 am, RackFeed  wrote:
>
> > Has anybody tried using django-mongodb? What were your impressions?
> > How well/poorly does the ORM work with mongodb?
>
> > I'm tired of sql nonsense and want to use mongodb but also want to
> > keep using django.
>
> Can't speak to MongoDb, but I recently did a project using CouchDb and
> the couchdbkit Django integration (http://couchdbkit.org/) and found
> the experience relatively painless - once I'd got my head round
> CouchDb, that is. The main issue is that you have to pre-define your
> queries in javascript using map-reduce, but once that's done you can
> use ORM objects almost transparently.
> --
> DR.

--

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




Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
Karen Tracey wrote:
> Can anyone tell me what I'm doing wrong?
> 
> 
> No idea.  I can't recreate by copy & pasting you urlpatterns.  Tried on 
> Django 1.1.1 and current trunk.  I've got mod_wsgi 2.3 instead of 2.5 
> but I doubt that makes a difference for this -- everything else the same 
> level as yours. Can you recreate with a bare-bones setup?

Short of firing up a blank VM, I'm not sure how much more bare bones I 
can get :-S

Not sure if it helps but:

- I'm running the whole project out of a buildout using djangorecipe 
0.20 (although I did trace through the django.wsgi file and all the work 
is still done by django.core.handlers.wsgi.WSGIHandler

- A workaround which solves the problem for me is to precede the 
WSGIScriptAlias in the apache config with:

RewriteRule ^/studio$ /studio/ [R]

cheers,

Chris

PS: I never got my original message mailed back to me from the list, was 
I stuck in the google groups moderation queue?

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

--

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