django1.3 static file problem - django-templates

hi, I am new to django,I doing user authentication for my project,Well its works properly.
I have created a folder named 'static' in my projects root folder[now am in local devlopment] and necessary editing in setting.py ,
My first page[which contains a login form] displays the images and uses the css file successfully,If login success accounts/profile url map to a view ,which in turn
leads to a template 'LoginSuccess.html' but which doesn't displays the images,and css files.
The problem is it doesn't fetches the images from static folder.
My command prompt looks as follows
0 errors found
Django version 1.3, using settings 'SecondPrjt.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[20/Sep/2011 22:11:47] "GET / HTTP/1.1" 200 5394
[20/Sep/2011 22:11:47] "GET /static/css/style.css HTTP/1.1" 200 3612
[20/Sep/2011 22:11:47] "GET /static/images/favicon.ico HTTP/1.1" 200 1150
[20/Sep/2011 22:12:10] "POST / HTTP/1.1" 302 0
[20/Sep/2011 22:12:10] "GET /accounts/profile/ HTTP/1.1" 200 1930
[20/Sep/2011 22:12:10] "GET /accounts/profile/css/style.css HTTP/1.1" 404 2758
[20/Sep/2011 22:12:10] "GET /accounts/profile/images/logo.jpg HTTP/1.1" 404 2764
[20/Sep/2011 22:12:10] "GET /accounts/profile/images/rss.jpg HTTP/1.1" 404 2761
[20/Sep/2011 22:12:10] "GET /accounts/profile/images/but1.gif HTTP/1.1" 404 2764
Also am confused about the HTTP 302 which not related to the static files
Note: I use a base.html(calls css files,some images) which inherits all of my templates
urls.py
(r'^$',login),
(r'^accounts/profile/$',views.loginsuccess),
(r'^accounts/logout/$',logout),

The problem I forgot to pass context while render
return render_to_response('user/LoginSuccess.html',context_instance=RequestContext(request)

Related

Fail2ban filter for a specific string in *access.log

I have many GET Request on my server to "nike-air" URLs like this
216.*.*.* - - [13/Dec/2016:20:07:54 +0100] "GET /jd/nike-huarache-2010.php HTTP/1.1" 404
216.*.*.* - - [13/Dec/2016:20:07:57 +0100] "GET /jd/nike-roshe-run-homme-original.php HTTP/1.1" 404
187.*.*.* - - [13/Dec/2016:20:17:26 +0100] "GET /jd/nike-mercurial.php HTTP/1.1" 404
I decide to create a fail2ban filter for stop it:
# apache-nike.conf
[Definition]
failregex = ^<HOST> -.*"GET .*nike-.*".*
ignoreregex =
It works but I think it can be improved? Too bad there is no online tool to create filters :)
Thank you for your suggestions.

undocumented http status codes in apache log files

I am working on a Grails application which uses Apache as front end and a Tomcat server to run the application. In order to check for people that are
logged in I send, via Ajax, a signal that generates a response from the clients every minute when there is no apparent activity on a client.
In the Apache log files I find entries that have status codes that I can't understand. The responses look like this (IP stands for the IP number and some other info is changed, DateAndTime instead of real date and time and ... for uninteresting info):
IP - - [DateAndTime] "POST /rapp/admin/AXpush HTTP/1.1" 200 420 "..."
IP - - [DateAndTime] "POST /rapp/admin/AXpush HTTP/1.1" 200 581 "..."
IP - - [DateAndTime] "POST /rapp/admin/AXpush HTTP/1.1" 200 581 "..."
IP - - [DateAndTime] "POST /rapp/admin/AXpush HTTP/1.1" 200 581 "..."
IP - - [DateAndTime] "POST /rapp/admin/AXpush HTTP/1.1" 200 581 "..."
IP - - [DateAndTime] "POST /rapp/admin/AXpush HTTP/1.1" 200 5867 "..."
IP - - [DateAndTime] "POST /rapp/admin/AXpush HTTP/1.1" 200 581 "..."
IP - - [DateAndTime] "POST /rapp/admin/AXpush HTTP/1.1" 200 581 "..."
IP - - [DateAndTime] "POST /rapp/admin/AXpush HTTP/1.1" 200 581 "..."
IP - - [DateAndTime] "POST /rapp/admin/AXpush HTTP/1.1" 200 581 "..."
IP - - [DateAndTime] "POST /rapp/admin/AXpush HTTP/1.1" 200 5867 "..."
...
There is exactly one minute between calls.
Now I wonder what the numbers 420, 581 and 5867 stand for. I can find some info about 420, saying: "Enhance Your Calm" whatever that means. For the codes 581 and 5867, I find nothing.
I see that I deserve the -1 here. Of course these numbers are not status codes. I still wonder about the 5867, as it is different and all calls are exactly the same, but thanks regilero for putting me on track. I'll find out about the rest.

PUT forbidden in SVN

I have set up SVN 1.8.8 with Apache on RedHat running on AWS.
I am committing my first base code now and pushing all my current baselines into /tags.
Everything seems good, until I come to .rar files. The commit is failing with the following error message.
I've tried to debug it for 2 days now.
Ensured that my repositories are owned by 'apache' user
There is no Deny directive in /etc/httpd/conf/httpd.conf and /etc/httpd/conf.d/subversion.conf
Added AddType for .rar
Log shows that the PUT is via serf
Some may ask why am I committing a zipped file instead of the individual files. Well, this particular .rar is an incoming deliverable and I would want to track it as an entire package, on top of the individual files that I am developing myself.
It is happening only to this file extension. Can anyone help?
Update 20140605:
I tried using CLI and force it to serf, same error.
Also, here is a snapshot of apache httpd's access_log.
192.101.84.225 - - [05/Jun/2014:05:34:13 +0000] "OPTIONS /svn/test/trunk HTTP/1.1" 401 517 "-" "SVN/1.8.9 (x64-microsoft-windows) serf/1.3.5 TortoiseSVN-1.8.7.25475"
192.101.84.225 - tanst [05/Jun/2014:05:34:13 +0000] "OPTIONS /svn/test/trunk HTTP/1.1" 200 188 "-" "SVN/1.8.9 (x64-microsoft-windows) serf/1.3.5 TortoiseSVN-1.8.7.25475"
192.101.84.225 - tanst [05/Jun/2014:05:34:13 +0000] "OPTIONS /svn/test/trunk HTTP/1.1" 200 97 "-" "SVN/1.8.9 (x64-microsoft-windows) serf/1.3.5 TortoiseSVN-1.8.7.25475"
192.101.84.225 - tanst [05/Jun/2014:05:34:14 +0000] "POST /svn/test/!svn/me HTTP/1.1" 201 - "-" "SVN/1.8.9 (x64-microsoft-windows) serf/1.3.5 TortoiseSVN-1.8.7.25475"
192.101.84.225 - tanst [05/Jun/2014:05:34:14 +0000] "HEAD /svn/test/trunk/testing.rar HTTP/1.1" 404 - "-" "SVN/1.8.9 (x64-microsoft-windows) serf/1.3.5 TortoiseSVN-1.8.7.25475"
192.101.84.225 - tanst [05/Jun/2014:05:34:15 +0000] "DELETE /svn/test/!svn/txn/1-k HTTP/1.1" 204 - "-" "SVN/1.8.9 (x64-microsoft-windows) serf/1.3.5 TortoiseSVN-1.8.7.25475"
There are no errors in error_log.

Customizing Apache Logs

I am running a website with siginup/login process. and I like to insert user ids when the user signs up or in to my website.
My apache access.log is as in the following:
115.137.10.87 - - [26/Aug/2013:07:38:52 +0900] "GET /api/game/ HTTP/1.1" 200 1402 "-" "android-async-http/1.4.3 (http://loopj.com/android-async-http)"
115.137.10.87 - - [26/Aug/2013:07:38:59 +0900] "GET /api/premium/brand HTTP/1.1" 200 721 "-" "android-async-http/1.4.3 (http://loopj.com/android-async-http)"
115.137.10.87 - - [26/Aug/2013:07:38:59 +0900] "GET /api/brand/ HTTP/1.1" 200 2510 "-" "android-async-http/1.4.3 (http://loopj.com/android-async-http)"
115.137.10.87 - - [26/Aug/2013:07:39:00 +0900] "GET /api/game/ HTTP/1.1" 200 1402 "-" "android-async-http/1.4.3 (http://loopj.com/android-async-http)"
I can clearly see what http request was sent from what ip address.
But if I put the user id (eg. $userid) to this log, it would be wonderful log, and I will be able to get a good statistic information for making decision.
If it is possible, is there any way to do this?
Any advice will be really appreciated.
The log will be like this:
115.137.10.87 - - [26/Aug/2013:07:38:52 +0900] "***[USERID]*** GET /api/game/ HTTP/1.1" 200 1402 "-" "android-async-http/1.4.3 (http://loopj.com/android-async-http)"
If you are using HTTP Basic or Digest authentication, then the user name is derived from an HTTP header and can be inserted into the log by using %u in a LogFormat directive in your apache config. If you have a login system that does not include the username in a header (likely), then the only other option I know of would be to somehow set an environment variable which Apache could then write out with %{FOOBAR}e. See http://httpd.apache.org/docs/2.2/logs.html
Otherwise, you're probably better off writing out your own log file from your application code (or use an application level logging library - Log4j, or whatever.)

Apache access log : multiple status code

In Apache access.log, I am used to this kind of access log line:
127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326
I was checking some apache access logs this morning and found something I'm not used to:
192.168.1.10- - [20/Feb/2013:00:00:45 +0000] "POST /form/... 404 200 252 "-" "-" 435835
There are multiple status code. Does-it mean the request was sended multiple times (something like a failed/retry mechanism?