0

i am new to Django and web-faction.

I am trying to deploy a django project to production on webfaction

i performed all settings as per django tuts .

syncdb did not gave me any error on the terminal.

navigate to the site it gives this error

200 Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

i found that there were logs in Apache folder . also there were logs in folders called user and fronted in my username directory at top level. which logs do i see.

what is the meaning of access logs in user directory ? error logs in user directory ? access logs in front end directory ? error logs in front end directory ? logs folder in Apache ?

also what is the error i am getting and how can i solve it best ?

silverkid
  • 9,291
  • 22
  • 66
  • 92

2 Answers2

2

Did you set DEBUG=False in your settings? If so, you must add a SECRET_KEY value and ALLOWED_HOSTS setting. Check the Django docs for more info about these settings.

Apart from that, the logs at ~/log/user/error_yourapp.log is what you need to check.

However, a 200 error is not a server error (500), and therefore might not end up in that error log, if I am not mistaken.

A last resort might be to create a custom app listening to a port (and a hook it up to a website). Then SSH into your account and start ./manage.py runserver localhost:YOURPORT and open yourproject.webfactional.com:YOURPORT. If the server crashes, you should see the traceback right there in the terminal.

mbrochh
  • 1,011
  • 1
  • 10
  • 21
  • log , log.1, log.2 ... what is the meaning of 1 2 etc. – silverkid Dec 29 '14 at 13:12
  • I think this is some way of apache making sure that the files don't get too big. Just ignore the numbered ones and always look at the bottom of the one without a number. (With Vim you can get to the bottom of the file quickly by pressing `SHIFT+G`) – mbrochh Dec 29 '14 at 13:14
  • i saw in log that there is an import error of settings.py. the sys path does not contain the path to settings . the syspath is pointing to home/username/lib/python2.6 ... i am unable to add the path to settings file location – silverkid Dec 29 '14 at 13:59
1

"200 error" from a mod_wsgi app is really an internal server error.

mod_wsgi 3.4 introduced some new code that returns a "200 Error" status line:

/*
 * Look for the special case of status being 200 but the
 * status line indicating an error and translate it into a
 * 500 error so that error document processing will occur
 * for those cases where WSGI application wouldn't have
 * supplied their own error document. We used to use 0
 * here for status but Apache 2.4 prohibits it now.
 */

.....

/*
 * Execute the actual target WSGI application. In
 * normal cases OK should always be returned. If
 * however an error occurs in importing or executing
 * the script or the Python code raises an exception
 * which is not caught and handled, then an internal
 * server error can be returned. As we don't want to
 * be triggering any error document handlers in the
 * daemon process we use a fake status line with 0
 * as the status value. This will be picked up in
 * the Apache child process which will translate it
 * back to a 500 error so that normal error document
 * processing occurs.
 */

r->status = HTTP_OK;

if (wsgi_execute_script(r) != OK) {
    r->status = HTTP_INTERNAL_SERVER_ERROR;
    r->status_line = "200 Error";
}

Apache interprets it as a 500 error, and you'll see the 500 status code in your logs, but the generated title of the Apache error page will show the "200 Error" status line.

Sean F
  • 817
  • 9
  • 20