Local timezone in django admin
Hi, The default timezone in our application is UTC (stored in the database). However I would like to display the datetime fields on the admin interface based on the user's local timezone. We're using Django 1.6. Thanks, Vamsy -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5310042b-7fa0-4735-980e-c425157fc5f5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Application scope variable
Hi, I'm using an IMAP connection in my application and want to use the same connection across sessions to fetch the relevant data. I added the below snippet in my settings.py file and importing connection in my view function where I need this. However this is instantiating the variable each time for each connection. Consequently any parallel connections exceeding 15 start throwing errors as that is the upper limit for gmail. Is there a way to achieve what I want in Django/ Python? import imaplib connection = imaplib.IMAP4_SSL('imap.gmail.com') connection.login('useremail', 'password') Regards, Vamsy -- You received this message because you are subscribed to the Google 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: file upload size problem
Yes Tom, thanks. That makes sense. And yes it works like a charm on Opera. On Mar 17, 2:47 pm, Tom Evans <tevans...@googlemail.com> wrote: > On Thu, Mar 17, 2011 at 6:51 AM, vamsy krishna <badguitar...@gmail.com> wrote: > > That is true Michal. My understanding is that the server does send > > back a 413 response as soon as it finds the huge mismatch in the > > upload limit and the actual upload size. Also I think the server > > immediately terminates the connection for the request. The problem > > however is that the browser instead of reading the response from the > > server shows the connection interrupted message. Ideally I would like > > to configure it in a way the 413 error page is shown instead. Or do > > you think it is not feasible in such a case? > > > Regards, > > Vamsy > > Think for a moment about how this works. You've set the upload limit > to 500k. If you start uploading more than this, then the web server > can really only do one thing, it can send you a 413 response and close > the connection. > > If your browser then tries to continue to upload the file, it will try > to write data to a closed socket connection, and fail. If it's smart, > it will then see if there is a response to read from the socket, > otherwise it will display a cryptic 'connection interrupted' message. > Try the same test in a bunch of browsers; I bet Opera will handle it > correctly. > > You've asked for the connection to be interrupted, by setting > LimitRequestBody. It can't both limit the request body size, and wait > for a client to be ready to read the error response. > > Cheers > > Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
That is true Michal. My understanding is that the server does send back a 413 response as soon as it finds the huge mismatch in the upload limit and the actual upload size. Also I think the server immediately terminates the connection for the request. The problem however is that the browser instead of reading the response from the server shows the connection interrupted message. Ideally I would like to configure it in a way the 413 error page is shown instead. Or do you think it is not feasible in such a case? Regards, Vamsy On Mar 16, 9:36 pm, Michal Petruchawrote: > > > I've set a custom error page for the 413 error when the upload file > > > size exceeds the maximum set in apache LimitRequestBody directive (500 > > > KB). > > > This is working fine for all files upto 3 MB. However when the size > > > exceeds this limit, the browser is showing the below message instead > > > of my custom error page. Can someone point me in the right direction? > > > > Connection Interrupted > > > > The connection to the server was reset while the page was > > > loading. > > > > The network link was interrupted while negotiating a connection. > > > Please try again. > > My guess is that the webserver hangs up as soon as it sees the > request size exceeds some multiple of the limit. > > I think this is reasonable, just imagine that somebody would try to > upload for example /dev/urandom or /dev/zero (i. e. an infinite amount > of data). Would you want the server to suck it all in and then give an > error message saying that the limit has been exceeded? > > Michal Petrucha > > signature.asc > < 1KViewDownload -- You received this message because you are subscribed to the Google 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: file upload size problem
Any suggestions please? On Mar 15, 12:18 pm, vamsy krishna <badguitar...@gmail.com> wrote: > Hi All, > > I've set a custom error page for the 413 error when the upload file > size exceeds the maximum set in apache LimitRequestBody directive (500 > KB). > This is working fine for all files upto 3 MB. However when the size > exceeds this limit, the browser is showing the below message instead > of my custom error page. Can someone point me in the right direction? > > Connection Interrupted > > The connection to the server was reset while the page was > loading. > > The network link was interrupted while negotiating a connection. > Please try again. > > Thanks, > Vamsy > > On Mar 15, 11:21 am, vamsy krishna <badguitar...@gmail.com> wrote: > > > Thanks Tom. I also looked up the Django code and realised there is no > > handler413 defined. I'm now doing it in apache the way you mentioned. > > > On Mar 14, 4:38 pm, Tom Evans <tevans...@googlemail.com> wrote: > > > > On Mon, Mar 14, 2011 at 9:02 AM, vamsy krishna <badguitar...@gmail.com> > > > wrote: > > > > I'm facing a new problem now. I have a defined a custom error page and > > > > using the handler413 in my urls file to load this template. However > > > > this is not getting picked up. I would like to handle this at django > > > > level instead of apache. The ErrorDocument definition in apache works > > > > fine. > > > > > Also the handler404 and handler500 are working without any issue. Can > > > > someone point me in the right direction? > > > > > Thanks, > > > > Vamsy > > > > handler404 and handler500 get called if django tries to serve a page > > > that doesn't exist or a page that errors. Your 413 is generated from > > > apache, and so does not ever call django, therefore django cannot > > > handle this error. > > > > To get around this, set > > > > ErrorHandler 413 /some/django/url > > > > Apache will use an internal redirect to fetch this URL, so it should > > > be transparent to your users. > > > > Cheers > > > > Tom > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
Hi All, I've set a custom error page for the 413 error when the upload file size exceeds the maximum set in apache LimitRequestBody directive (500 KB). This is working fine for all files upto 3 MB. However when the size exceeds this limit, the browser is showing the below message instead of my custom error page. Can someone point me in the right direction? Connection Interrupted The connection to the server was reset while the page was loading. The network link was interrupted while negotiating a connection. Please try again. Thanks, Vamsy On Mar 15, 11:21 am, vamsy krishna <badguitar...@gmail.com> wrote: > Thanks Tom. I also looked up the Django code and realised there is no > handler413 defined. I'm now doing it in apache the way you mentioned. > > On Mar 14, 4:38 pm, Tom Evans <tevans...@googlemail.com> wrote: > > > On Mon, Mar 14, 2011 at 9:02 AM, vamsy krishna <badguitar...@gmail.com> > > wrote: > > > I'm facing a new problem now. I have a defined a custom error page and > > > using the handler413 in my urls file to load this template. However > > > this is not getting picked up. I would like to handle this at django > > > level instead of apache. The ErrorDocument definition in apache works > > > fine. > > > > Also the handler404 and handler500 are working without any issue. Can > > > someone point me in the right direction? > > > > Thanks, > > > Vamsy > > > handler404 and handler500 get called if django tries to serve a page > > that doesn't exist or a page that errors. Your 413 is generated from > > apache, and so does not ever call django, therefore django cannot > > handle this error. > > > To get around this, set > > > ErrorHandler 413 /some/django/url > > > Apache will use an internal redirect to fetch this URL, so it should > > be transparent to your users. > > > Cheers > > > Tom > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
Thanks Tom. I also looked up the Django code and realised there is no handler413 defined. I'm now doing it in apache the way you mentioned. On Mar 14, 4:38 pm, Tom Evans <tevans...@googlemail.com> wrote: > On Mon, Mar 14, 2011 at 9:02 AM, vamsy krishna <badguitar...@gmail.com> wrote: > > I'm facing a new problem now. I have a defined a custom error page and > > using the handler413 in my urls file to load this template. However > > this is not getting picked up. I would like to handle this at django > > level instead of apache. The ErrorDocument definition in apache works > > fine. > > > Also the handler404 and handler500 are working without any issue. Can > > someone point me in the right direction? > > > Thanks, > > Vamsy > > handler404 and handler500 get called if django tries to serve a page > that doesn't exist or a page that errors. Your 413 is generated from > apache, and so does not ever call django, therefore django cannot > handle this error. > > To get around this, set > > ErrorHandler 413 /some/django/url > > Apache will use an internal redirect to fetch this URL, so it should > be transparent to your users. > > Cheers > > Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
I'm facing a new problem now. I have a defined a custom error page and using the handler413 in my urls file to load this template. However this is not getting picked up. I would like to handle this at django level instead of apache. The ErrorDocument definition in apache works fine. Also the handler404 and handler500 are working without any issue. Can someone point me in the right direction? Thanks, Vamsy On Mar 14, 11:07 am, vamsy krishna <badguitar...@gmail.com> wrote: > Oh yes. Thanks Karen. > > On Mar 12, 7:06 pm, Karen Tracey <kmtra...@gmail.com> wrote: > > > On Sat, Mar 12, 2011 at 12:06 AM, vamsy krishna > > <badguitar...@gmail.com>wrote: > > > > I'm doing a file upload from one of my forms and writing the content > > > to a temp file on the server. The problem is any file of size more > > > than 250 KB is throwing the below error: > > > > Request Entity Too Large > > > The requested resource > > > /tera/tera_upload/ > > > does not allow request data with POST requests, or the amount of data > > > provided in the request exceeds the capacity limit. > > > > I read through the django file uploads documentation and it says the > > > default file upload size in memory is about 2.5 MB. Can anyone tell me > > > what I'm overlooking? Also how do I set a maximum file size limit and > > > handle it? > > > This error isn't coming from Django, it's coming from your web server which > > has apparently been configured to limit request body size. How to change the > > limit will depend on what server you are using. If Apache, see for example > > LimitRequestBody here:http://httpd.apache.org/docs/2.0/mod/core.html > > > Karen > > --http://tracey.org/kmt/ > > -- You received this message because you are subscribed to the Google 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: file upload size problem
Oh yes. Thanks Karen. On Mar 12, 7:06 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Sat, Mar 12, 2011 at 12:06 AM, vamsy krishna <badguitar...@gmail.com>wrote: > > > I'm doing a file upload from one of my forms and writing the content > > to a temp file on the server. The problem is any file of size more > > than 250 KB is throwing the below error: > > > Request Entity Too Large > > The requested resource > > /tera/tera_upload/ > > does not allow request data with POST requests, or the amount of data > > provided in the request exceeds the capacity limit. > > > I read through the django file uploads documentation and it says the > > default file upload size in memory is about 2.5 MB. Can anyone tell me > > what I'm overlooking? Also how do I set a maximum file size limit and > > handle it? > > This error isn't coming from Django, it's coming from your web server which > has apparently been configured to limit request body size. How to change the > limit will depend on what server you are using. If Apache, see for example > LimitRequestBody here:http://httpd.apache.org/docs/2.0/mod/core.html > > Karen > --http://tracey.org/kmt/ -- You received this message because you are subscribed to the Google 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.
file upload size problem
Hi, I'm doing a file upload from one of my forms and writing the content to a temp file on the server. The problem is any file of size more than 250 KB is throwing the below error: Request Entity Too Large The requested resource /tera/tera_upload/ does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit. I read through the django file uploads documentation and it says the default file upload size in memory is about 2.5 MB. Can anyone tell me what I'm overlooking? Also how do I set a maximum file size limit and handle it? Thanks, Vamsy -- You received this message because you are subscribed to the Google 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: maintenance mode UI
Thanks Cal. I'm now using inline styling. On Feb 12, 11:57 am, "Cal Leeming [Simplicity Media Ltd]" <cal.leem...@simplicitymedialtd.co.uk> wrote: > Hi, > > Maintenance mode pages should be completely self contained. You could even > go to the extent of storing the images in base64 within the HTML (I have > seen this done somewhere), but personally I have them hosted on a CDN > somewhere. > > Cal > > On Sat, Feb 12, 2011 at 4:20 AM, vamsy krishna <badguitar...@gmail.com>wrote: > > > Hi, > > > I've set up the django maintenance mode for my site to display a > > custom message to the users. The message gets picked up fine but all > > the relevant styling does not get loaded. It would be really nice if > > it can load the styling info. Any suggestions? > > > Regards, > > Vamsy > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-users@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
maintenance mode UI
Hi, I've set up the django maintenance mode for my site to display a custom message to the users. The message gets picked up fine but all the relevant styling does not get loaded. It would be really nice if it can load the styling info. Any suggestions? Regards, Vamsy -- You received this message because you are subscribed to the Google 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.
handler500 not working
Hi, I've defined the following in my root urls and also defined the corresponding views and templates. The 404 handler picks up the template correctly but the 500 handler doesn't. The control never reaches the view function though apache logs report it as 500 server error. Am I missing something here? handler500 = 'error.views.display500' handler404 = 'error.views.display404' Regards, Vamsy -- You received this message because you are subscribed to the Google 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: 'if' statement improperly formatted
I've added the smart if feature to my custom template tags to get this working. On Jan 23, 7:05 pm, vamsy krishna <badguitar...@gmail.com> wrote: > Oh ok. Thanks for the direction. The server on which it fails uses > django 1.1. I was looking through the documentation for the same and > did not find anything related to relational operators in the django > templates. Any idea how can I do '<', '>' in 1.1? > > On Jan 23, 6:39 pm, Karen Tracey <kmtra...@gmail.com> wrote: > > > On Sun, Jan 23, 2011 at 8:25 AM, vamsy krishna > > <badguitar...@gmail.com>wrote: > > > > I'm getting the below exception from the third line in the snippet. > > > This works fine on one server while fails on the other. Any help? > > > > Exception Type: TemplateSyntaxError > > > Exception Value: 'if' statement improperly formatted > > > > {% range 1:32 as i %} > > > {% ifequal i curdattime.day > > > %} > > > {% if i < 10 %} > > > That's the error message you get if you try to use "smart" if (a Django 1.2 > > feature:http://docs.djangoproject.com/en/1.2/releases/1.2/#smart-if-tag) > > with an earlier release of Django. You either need to stick to the if tag > > syntax supported by your lower-level release or upgrade your Django install > > to 1.2. > > > Karen > > --http://tracey.org/kmt/ -- You received this message because you are subscribed to the Google 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: 'if' statement improperly formatted
Oh ok. Thanks for the direction. The server on which it fails uses django 1.1. I was looking through the documentation for the same and did not find anything related to relational operators in the django templates. Any idea how can I do '<', '>' in 1.1? On Jan 23, 6:39 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Sun, Jan 23, 2011 at 8:25 AM, vamsy krishna <badguitar...@gmail.com>wrote: > > > I'm getting the below exception from the third line in the snippet. > > This works fine on one server while fails on the other. Any help? > > > Exception Type: TemplateSyntaxError > > Exception Value: 'if' statement improperly formatted > > > {% range 1:32 as i %} > > {% ifequal i curdattime.day > > %} > > {% if i < 10 %} > > That's the error message you get if you try to use "smart" if (a Django 1.2 > feature:http://docs.djangoproject.com/en/1.2/releases/1.2/#smart-if-tag) > with an earlier release of Django. You either need to stick to the if tag > syntax supported by your lower-level release or upgrade your Django install > to 1.2. > > Karen > --http://tracey.org/kmt/ -- You received this message because you are subscribed to the Google 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.
'if' statement improperly formatted
Hi, I'm getting the below exception from the third line in the snippet. This works fine on one server while fails on the other. Any help? Exception Type: TemplateSyntaxError Exception Value:'if' statement improperly formatted {% range 1:32 as i %} {% ifequal i curdattime.day %} {% if i < 10 %} 0{{i}} {% else %} {{i}} {% endif %} {% else %} {% if i < 10 %} 0{{i}} {% else %} {{i}} {% endif %} {% endifequal %} {% endrange %} P.S: "range" is a custom tag which I've picked up online for range looping in the template. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: max recursion depth exceeded
I was able to find two such recursive instances and things work fine after removing them :) On Jan 17, 10:12 am, vamsy krishna <badguitar...@gmail.com> wrote: > Hi Justin, > > There are over 60 urls.py in my app and I'm running through each one > by one. Wish the stack trace had something from within the app. Thanks > for the help anyway. Will let you know if I manage to find the bad > file. > > Regards, > Vamsy > > On Jan 13, 5:07 pm, Justin Murphy <jus...@jlmurphy.com> wrote: > > > Hi vamsy, > > Can you post your urls.py files? Perhaps you have a recursive inclusion. > > > Example: > > myapp.urls.py > > > patterns = urlpatterns('', > > url(r'^/', include('myapp.urls') # this will result in a recursive > > inclusion. > > > ) > > > -Justin -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: max recursion depth exceeded
Hi Justin, There are over 60 urls.py in my app and I'm running through each one by one. Wish the stack trace had something from within the app. Thanks for the help anyway. Will let you know if I manage to find the bad file. Regards, Vamsy On Jan 13, 5:07 pm, Justin Murphywrote: > Hi vamsy, > Can you post your urls.py files? Perhaps you have a recursive inclusion. > > Example: > myapp.urls.py > > patterns = urlpatterns('', > url(r'^/', include('myapp.urls') # this will result in a recursive > inclusion. > > ) > > -Justin -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
max recursion depth exceeded
Hi, I'm trying to use Django-Cms on my site and I see the below exception whenever I try to add a page or a group. The below stacktrace repeats itself indefinitely. I think this error is independent of the cms system and hence I'm posting it here instead of the cms forum. The current recursion limit is set to 1000. Any help would be appreciated. RuntimeError: maximum recursion depth exceeded File "/var/www/sites/test/django/core/urlresolvers.py", line 195, in _get_reverse_dict self._populate() File "/var/www/sites/test/django/core/urlresolvers.py", line 175, in _populate for name in pattern.reverse_dict: File "/var/www/sites/test/django/core/urlresolvers.py", line 195, in _get_reverse_dict self._populate() File "/var/www/sites/test/django/core/urlresolvers.py", line 175, in _populate for name in pattern.reverse_dict: -- You received this message because you are subscribed to the Google 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.
django cms without django admin
Hi, I'm trying to set up django-cms-2.0.2 for my site. The problem is we haven't enabled the django admin for security reasons and want to keep it that way. Is there a way to use the cms without the admin interface? Thanks, Vamsy -- 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: redirect after login
request.GET returns an empty dict On Dec 7, 3:35 pm, Kenneth Gonsalves <law...@au-kbc.org> wrote: > On Tue, 2010-12-07 at 02:31 -0800, vamsy krishna wrote: > > redirect_to = request.REQUEST.get('next') > > how about > redirect_to = request.GET? > -- > regards > Kenneth Gonsalves -- 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.
redirect after login
Hi, I have the below line in my login code which decides the redirect screen on successful login redirect_to = request.REQUEST.get('next') However redirect_to is always evaluating to None even though the parameter 'next' is part of the url. Any idea what i might be doing wrong? 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-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: minidom parsestring error
I see a 502 Bad Request on the browser and the server is auto-shutting down. I do not see any error logs even though am using a try except block for the line file_xml = minidom.parseString(file_feed) None of the logs output beyond this line and the execution seems to halt. I haven't seen a 502 error on the server before. This is a new code. On Dec 1, 7:06 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Dec 1, 1:18 pm, vamsy krishna <badguitar...@gmail.com> wrote: > > > > > Hi, > > > I have a function to read and display an RSS feed which is working as > > expected in my local Apache. However I'm getting a HTTP 502 error when > > I access the same on Webfaction. Below is a snippet from my code and > > the error is originating from the last step involving parsing. > > > Like i mentioned the below code works locally with the same feed and > > this also works on the python shell on Webfaction. However is is > > failing while accessing through my browser. Any help will be > > appreciated. Thanks > > > feed_url = 'http://blog.ionlab.in/feed/' > > file_request = urllib2.Request(feed_url) > > file_opener = urllib2.build_opener() > > file_feed = file_opener.open(file_request).read() > > file_xml = minidom.parseString(file_feed) > > Failing how? What is the error? > -- > 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.
minidom parsestring error
Hi, I have a function to read and display an RSS feed which is working as expected in my local Apache. However I'm getting a HTTP 502 error when I access the same on Webfaction. Below is a snippet from my code and the error is originating from the last step involving parsing. Like i mentioned the below code works locally with the same feed and this also works on the python shell on Webfaction. However is is failing while accessing through my browser. Any help will be appreciated. Thanks feed_url = 'http://blog.ionlab.in/feed/' file_request = urllib2.Request(feed_url) file_opener = urllib2.build_opener() file_feed = file_opener.open(file_request).read() file_xml = minidom.parseString(file_feed) -- 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: php script in django app
Oh ok. Thanks for the quick response. I guess I'll have to rewrite the script in Python. On Dec 1, 9:04 am, Javier Guerra Giraldez <jav...@guerrag.com> wrote: > On Tue, Nov 30, 2010 at 10:51 PM, vamsy krishna <badguitar...@gmail.com> > wrote: > > I am trying to embed an Ajax call to load some RSS feeds using a PHP > > script in my Django app. This does not work and it returns my actual > > PHP code which is not getting executed. This works when I try the same > > outside of Django in Apache. > > i guess that it doesn't work when using Django's dev server. > > - to execute PHP, you need a PHP interpreter > > - Django's devserver is a simple Python HTTP server that translates > every request into WSGI calls to Django. > > so should it work? no way > > -- > Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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.
php script in django app
Hi, I am trying to embed an Ajax call to load some RSS feeds using a PHP script in my Django app. This does not work and it returns my actual PHP code which is not getting executed. This works when I try the same outside of Django in Apache. Can someone help me to get it working? Is it ok to use a PHP script in a Django app? Or am I trying to stick a Ferrari in a box of Apples? 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-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: choosing queryset
That's it! Thanks for pointing me in the right direction. Also my apologies for posting on the other forum. I did not know i wasn't supposed to do that. And thanks DR for your response. I've sorted it out now. On Oct 26, 5:42 pm, Jirka Vejrazkawrote: > > I've two modules called plan and income and both have a class called > > Income in their respective models. Now if I do user.income_set, it is > > accessing the income set under plan. How do I alter it to access > > income.income? Any ideas? > > Hi, > > have you had a chance to check out related_name in the > documentation? It does define "how should the other model call me". > Seehttp://docs.djangoproject.com/en/dev/ref/models/fields/ > > HTH > > Jirka -- 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.
choosing queryset
I've two modules called plan and income and both have a class called Income in their respective models. Now if I do user.income_set, it is accessing the income set under plan. How do I alter it to access income.income? Any ideas? 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-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.
session cookie problem in IE
Hi, I am doing the below in my login form. I am setting the session cookie expiry to expire on close of browser unless the user chooses the remember me on this computer option. My problem is that the cookie expires mid-way and too frequently between user actions on IE. Is there anything more i should do to keep IE happy? def login(self, request): if self.is_valid(): auth_login(request, self.user) request.user.message_set.create( message="Successfully logged in as %(username)s." % { 'username' : self.user.username } ) if self.cleaned_data["remember"]: request.session.set_expiry(60 * 60 * 24 * 7 * 3) else: request.session.set_expiry(0) return True return False Thanks & Regards Vamsy -- 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: noob: cyclic import issue
thnx jonas...i figured datz wat i mite do...so django has a limitation on imports like in da case i mentioned? On Mar 29, 2:51 pm, Jonas Obrist <ojiido...@gmail.com> wrote: > On 03/29/2010 10:28 AM, vamsy krishna wrote: > > > hi...am very new to django and am having some problem with my code... > > > say i've two modules...mod1 n mod2...n views in both modules have > > certain generic functions which i need to import from each other...as > > in > > > (in views.py of mod1) > > > from mod2.views import xyz > > > (and in views.py of mod2) > > > from mod1.views import abc > > > and this ofcourse is throwing an import error saying cannot import > > name xyz...how do i get this working? thanks in advance > > I recommend creating an utils.py (or however you want to name that) and > put 'xyz' and 'abc' in there. Then do: > > in mod1.views.py: > > from utils import xyz, abc > > in mod2.views.py: > > from utils import xyz, abc -- 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.
noob: cyclic import issue
hi...am very new to django and am having some problem with my code... say i've two modules...mod1 n mod2...n views in both modules have certain generic functions which i need to import from each other...as in (in views.py of mod1) from mod2.views import xyz (and in views.py of mod2) from mod1.views import abc and this ofcourse is throwing an import error saying cannot import name xyz...how do i get this working? 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-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.