Re: Apache & wsgi & Django > Content-Length
Brett Parker THANK YOU! This was it I just added 'django.middleware.http.ConditionalGetMiddleware', to the middleware and that's it. I think I would search answer for this problem for a few days if you would't told me for this middleware. It is strange although that sometimes content-length was sent and sometimes did't. :P http://axonnsd.org/WebData/FlashFun/flash/thankyou.swf On Feb 2, 6:28 pm, uroshwrote: > Thank you very much for answering. > > The examples with wget are done on the same url. Nothing is missing. > It's just that sometimes content-length is set and sometimes is not > and when that happens i noticed that phone can't fetch xml. Xml is > always the same in this case. And in the log of apache.log this looks > this(the same content): > > 192.168.1.247 - - [02/Feb/2010:18:26:47 +0100] "GET /pb.xml?peer=298 > HTTP/1.0" 200 535 "-" "Wget/1.11.4" > 192.168.1.247 - - [02/Feb/2010:18:26:48 +0100] "GET /pb.xml?peer=298 > HTTP/1.0" 200 535 "-" "Wget/1.11.4" > 192.168.1.247 - - [02/Feb/2010:18:26:48 +0100] "GET /pb.xml?peer=298 > HTTP/1.0" 200 514 "-" "Wget/1.11.4" > > I will try with middleware, if I can, then report back. > > On Feb 2, 3:50 pm, Brett Parker wrote: > > > On 02 Feb 06:30, urosh wrote: > > > > Hello. > > > > I have a problem with content-length heater in HTTP-message. I am > > > writing application for voip phone, which is not always specified, > > > then the phone can't download xml file correctly (stupid, I gess). > > > > How can I correct this behaviour? > > > I tested this with wget tool. Here are results. > > > > Connecting to 192.168.1.248:80... connected. > > > [12] 18882 > > > HTTP request sent, awaiting response... [9] Done > > > wgethttp://192.168.1.248/pb.xml?peer=298 > > > [10] Done p=1 > > > u...@user-laptop:/tmp$ 200 OK > > > Length: 360 [text/xml] > > > Saving to: `pb.xml?peer=298.32' > > > > 100% > > > [===>] > > > 360 --.-K/s in 0s > > > > 2010-02-02 15:28:56 (20.6 MB/s) - `pb.xml?peer=298.32' saved [360/36 > > > > HTTP request sent, awaiting response... [50] 18962 > > > [47] Done wgethttp://192.168.1.248/pb.xml?peer=298 > > > [48] Done p=1 > > > u...@user-laptop:/tmp$ 200 OK > > > Length: unspecified [text/xml] > > > Saving to: `pb.xml?peer=298.51' > > > > [ <=> > > > ] > > > 360 --.-K/s in 0s > > > > 2010-02-02 15:29:35 (25.6 MB/s) - `pb.xml?peer=298.51' saved [360] > > > Erm, looks like you're missing a bit to the wget, is there (perchance) > > an =1... because that's what it looks like it should have so try: > > wget "http://192.168.1.248/pb.xml?peer=298=1; > > > Note the "s... otherwise you end up running a wget and "p=1", which > > probably isn't what you wanted it to do. > > > Are you saying that the phone can't read unless Content-length is set? > > You might be able to do that with some middleware, infact, it appears > > that you can just use the ConditionalGetMiddleware to add the > > Content-length header. > > >http://docs.djangoproject.com/en/dev/ref/middleware/#module-django.mi... > > > Hope that helps, > > -- > > Brett Parker -- 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: Apache & wsgi & Django > Content-Length
Thank you very much for answering. The examples with wget are done on the same url. Nothing is missing. It's just that sometimes content-length is set and sometimes is not and when that happens i noticed that phone can't fetch xml. Xml is always the same in this case. And in the log of apache.log this looks this(the same content): 192.168.1.247 - - [02/Feb/2010:18:26:47 +0100] "GET /pb.xml?peer=298 HTTP/1.0" 200 535 "-" "Wget/1.11.4" 192.168.1.247 - - [02/Feb/2010:18:26:48 +0100] "GET /pb.xml?peer=298 HTTP/1.0" 200 535 "-" "Wget/1.11.4" 192.168.1.247 - - [02/Feb/2010:18:26:48 +0100] "GET /pb.xml?peer=298 HTTP/1.0" 200 514 "-" "Wget/1.11.4" I will try with middleware, if I can, then report back. On Feb 2, 3:50 pm, Brett Parkerwrote: > On 02 Feb 06:30, urosh wrote: > > > > > Hello. > > > I have a problem with content-length heater in HTTP-message. I am > > writing application for voip phone, which is not always specified, > > then the phone can't download xml file correctly (stupid, I gess). > > > How can I correct this behaviour? > > I tested this with wget tool. Here are results. > > > Connecting to 192.168.1.248:80... connected. > > [12] 18882 > > HTTP request sent, awaiting response... [9] Done > > wgethttp://192.168.1.248/pb.xml?peer=298 > > [10] Done p=1 > > u...@user-laptop:/tmp$ 200 OK > > Length: 360 [text/xml] > > Saving to: `pb.xml?peer=298.32' > > > 100% > > [===>] > > 360 --.-K/s in 0s > > > 2010-02-02 15:28:56 (20.6 MB/s) - `pb.xml?peer=298.32' saved [360/36 > > > HTTP request sent, awaiting response... [50] 18962 > > [47] Done wgethttp://192.168.1.248/pb.xml?peer=298 > > [48] Done p=1 > > u...@user-laptop:/tmp$ 200 OK > > Length: unspecified [text/xml] > > Saving to: `pb.xml?peer=298.51' > > > [ <=> > > ] > > 360 --.-K/s in 0s > > > 2010-02-02 15:29:35 (25.6 MB/s) - `pb.xml?peer=298.51' saved [360] > > Erm, looks like you're missing a bit to the wget, is there (perchance) > an =1... because that's what it looks like it should have so try: > wget "http://192.168.1.248/pb.xml?peer=298=1; > > Note the "s... otherwise you end up running a wget and "p=1", which > probably isn't what you wanted it to do. > > Are you saying that the phone can't read unless Content-length is set? > You might be able to do that with some middleware, infact, it appears > that you can just use the ConditionalGetMiddleware to add the > Content-length header. > > http://docs.djangoproject.com/en/dev/ref/middleware/#module-django.mi... > > Hope that helps, > -- > Brett Parker -- 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: Apache & wsgi & Django > Content-Length
On 02 Feb 06:30, urosh wrote: > Hello. > > I have a problem with content-length heater in HTTP-message. I am > writing application for voip phone, which is not always specified, > then the phone can't download xml file correctly (stupid, I gess). > > How can I correct this behaviour? > I tested this with wget tool. Here are results. > > Connecting to 192.168.1.248:80... connected. > [12] 18882 > HTTP request sent, awaiting response... [9] Done > wget http://192.168.1.248/pb.xml?peer=298 > [10] Donep=1 > u...@user-laptop:/tmp$ 200 OK > Length: 360 [text/xml] > Saving to: `pb.xml?peer=298.32' > > 100% > [===>] > 360 --.-K/s in 0s > > 2010-02-02 15:28:56 (20.6 MB/s) - `pb.xml?peer=298.32' saved [360/36 > > > HTTP request sent, awaiting response... [50] 18962 > [47] Donewget http://192.168.1.248/pb.xml?peer=298 > [48] Donep=1 > u...@user-laptop:/tmp$ 200 OK > Length: unspecified [text/xml] > Saving to: `pb.xml?peer=298.51' > > > [ <=> >] > 360 --.-K/s in 0s > > 2010-02-02 15:29:35 (25.6 MB/s) - `pb.xml?peer=298.51' saved [360] Erm, looks like you're missing a bit to the wget, is there (perchance) an =1... because that's what it looks like it should have so try: wget "http://192.168.1.248/pb.xml?peer=298=1; Note the "s... otherwise you end up running a wget and "p=1", which probably isn't what you wanted it to do. Are you saying that the phone can't read unless Content-length is set? You might be able to do that with some middleware, infact, it appears that you can just use the ConditionalGetMiddleware to add the Content-length header. http://docs.djangoproject.com/en/dev/ref/middleware/#module-django.middleware.http Hope that helps, -- Brett Parker -- 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.
Apache & wsgi & Django > Content-Length
Hello. I have a problem with content-length heater in HTTP-message. I am writing application for voip phone, which is not always specified, then the phone can't download xml file correctly (stupid, I gess). How can I correct this behaviour? I tested this with wget tool. Here are results. Connecting to 192.168.1.248:80... connected. [12] 18882 HTTP request sent, awaiting response... [9] Done wget http://192.168.1.248/pb.xml?peer=298 [10] Donep=1 u...@user-laptop:/tmp$ 200 OK Length: 360 [text/xml] Saving to: `pb.xml?peer=298.32' 100% [===>] 360 --.-K/s in 0s 2010-02-02 15:28:56 (20.6 MB/s) - `pb.xml?peer=298.32' saved [360/36 HTTP request sent, awaiting response... [50] 18962 [47] Donewget http://192.168.1.248/pb.xml?peer=298 [48] Donep=1 u...@user-laptop:/tmp$ 200 OK Length: unspecified [text/xml] Saving to: `pb.xml?peer=298.51' [ <=> ] 360 --.-K/s in 0s 2010-02-02 15:29:35 (25.6 MB/s) - `pb.xml?peer=298.51' saved [360] -- 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: Apache WSGI DJANGO
I think the problem is not in your wsgi file, but in your apache's vhost configuration. You should have this in your vhost configuration, to use your django application with mod_wsgi : WSGIScriptAlias / /var/www/conf/myconf.wsgi So, you should add this line (if your admin/media is url /admin/media, you can override this in your project's settings file, with ADMIN_MEDIA_PREFIX) : Alias /admin/media /usr/lib/python2.5/site-packages/django/contrib/admin/media As you could have this for other local media : Alias /media /var/www/media All path depend on your installation, of course. :) F. 2009/10/13 Nilesh Patel> here is my apache config file for wsgi, > > import os, sys > apache_configuration= os.path.dirname(__file__) > project = os.path.dirname(apache_configuration) > sys.path.append('/var/www') > sys.path.append('/var/www/myproj/cms') > os.environ['DJANGO_SETTINGS_MODULE'] = 'myproj.settings' > import django.core.handlers.wsgi > from django.conf import settings > settings.DEBUG=False > application = django.core.handlers.wsgi.WSGIHandler() > > > > 2009/10/11 Kenneth Gonsalves > >> >> On Sunday 11 Oct 2009 12:14:13 pm lafada wrote: >> > Apache says, >> > >> > File does not exist: /var/lib/python-support/python2.5/django/contrib/ >> > admin/media/js/actions.js >> > >> > When I tried to locate server says, >> > /usr/lib/python2.5/site-packages/django/contrib/admin/media/js/ >> > actions.js >> > >> > what may be the cause ??? >> >> you have not given the correct path to django/contrib/admin in your apache >> config. >> -- >> regards >> kg >> http://lawgon.livejournal.com >> >> >> > > > -- > #Japan Shah > Sent from Gujarat, India > > > --~--~-~--~~~---~--~~ 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: Apache WSGI DJANGO
here is my apache config file for wsgi, import os, sys apache_configuration= os.path.dirname(__file__) project = os.path.dirname(apache_configuration) sys.path.append('/var/www') sys.path.append('/var/www/myproj/cms') os.environ['DJANGO_SETTINGS_MODULE'] = 'myproj.settings' import django.core.handlers.wsgi from django.conf import settings settings.DEBUG=False application = django.core.handlers.wsgi.WSGIHandler() 2009/10/11 Kenneth Gonsalves> > On Sunday 11 Oct 2009 12:14:13 pm lafada wrote: > > Apache says, > > > > File does not exist: /var/lib/python-support/python2.5/django/contrib/ > > admin/media/js/actions.js > > > > When I tried to locate server says, > > /usr/lib/python2.5/site-packages/django/contrib/admin/media/js/ > > actions.js > > > > what may be the cause ??? > > you have not given the correct path to django/contrib/admin in your apache > config. > -- > regards > kg > http://lawgon.livejournal.com > > > > -- #Japan Shah Sent from Gujarat, India --~--~-~--~~~---~--~~ 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: Apache WSGI DJANGO
On Sunday 11 Oct 2009 12:14:13 pm lafada wrote: > Apache says, > > File does not exist: /var/lib/python-support/python2.5/django/contrib/ > admin/media/js/actions.js > > When I tried to locate server says, > /usr/lib/python2.5/site-packages/django/contrib/admin/media/js/ > actions.js > > what may be the cause ??? you have not given the correct path to django/contrib/admin in your apache config. -- regards kg http://lawgon.livejournal.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Apache WSGI DJANGO
Apache says, File does not exist: /var/lib/python-support/python2.5/django/contrib/ admin/media/js/actions.js When I tried to locate server says, /usr/lib/python2.5/site-packages/django/contrib/admin/media/js/ actions.js what may be the cause ??? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Better attack handling on Apache(wsgi)/Django servers
I'm starting a new project on Django 1.0/Pinax and I'm noticing that these silly IIS attacks that I used to see in my previous logs show up in a much more cluttered way through Apache(wsgi)/Django. Is there a best practices way to handle these types of attacks so that the attack is logged (or not) and it only takes up one line? A couple of solutions I can think of is to use Nginx or something else as a proxy? Otherwise, is there a mod_security template that is available with Django-specific rulesets? Thanks, Adam [Mon Oct 20 19:45:23 2008] [error] [client 200.162.46.91] mod_wsgi (pid=30283): Exception occurred within WSGI script '/var/www/pinax/ projects/complete_project/deploy/pinax.wsgi'. [Mon Oct 20 19:45:23 2008] [error] [client 200.162.46.91] Traceback (most recent call last): [Mon Oct 20 19:45:23 2008] [error] [client 200.162.46.91] File "/usr/ lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 239, in __call__ [Mon Oct 20 19:45:23 2008] [error] [client 200.162.46.91] response = self.get_response(request) [Mon Oct 20 19:45:23 2008] [error] [client 200.162.46.91] File "/usr/ lib/python2.5/site-packages/django/core/handlers/base.py", line 67, in get_response [Mon Oct 20 19:45:23 2008] [error] [client 200.162.46.91] response = middleware_method(request) [Mon Oct 20 19:45:23 2008] [error] [client 200.162.46.91] File "/usr/ lib/python2.5/site-packages/django/middleware/common.py", line 67, in process_request [Mon Oct 20 19:45:23 2008] [error] [client 200.162.46.91] "settings.") % (new_url[0], new_url[1]) [Mon Oct 20 19:45:23 2008] [error] [client 200.162.46.91] RuntimeError: You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to 75.101.151.190/_vti_bin/_vti_aut/author.dll/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---