Sphene Community Tools

Community

Copyright © 2007-2018 by Herbert Poul

You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Board » General » Why does Django crash if I override TEMPLATE_DIRS in settings_local.py

I am trying to NOT muck with anything coming out of SVN so I tried to override the TEMPLATE_DIRS variable in the settings_local.py file. When I do this Django crashes on startup without any error messages.

So I guess I have two questions:

1) Why is this happening?

2) I can't find any logging output, error messages out or stack traces where the heck are the Django stacktraces and log messages going?
i'm not sure what you mean with .. crash without any errors.. it is just exiting without any messages ?

are you using the django dev server ?
i do have .. one guess though .. the communitydraft/community/settings.py uses the following code to include settings_local.py

try:
    # settings_local overwrites a few settings from here, and has to define SECRET_KEY
    from settings_local import *
except:
    print "Warning - Unable to import settings_local"


so if there are any syntax errors in your settings_local.py it would simply print a warning on STDOUT .. not an actual stack trace.. is that what you see ?

(i have to admit this is pretty annoying .. but i don't want the communitydraft to fail without a settings_local.py .. )
Hey, we have Signatures !!! Great, isn't it ? ;)
Well it seems that something is just swallowing stdout and stderr. I am trying to figure out what is going on. I am running using fcgi on lighttpd. So I think there is an error in the fcgi hangler someplace. I am tracing the code. I have added a series of print outputs into my settings_local.py file. So when I start seeing those in any log file I'll know I have fixed the problem.

I am running the manage.py with the --traceback option and have tried with and without redirecting stdout & stederr.
is it crashing if you are using manage.py ?
e.g. ./manage.py runserver
? any output/errors ?
Hey, we have Signatures !!! Great, isn't it ? ;)
Well I found one problem there was a bug in django/core/servers/fastcgi.py that was ignoring the output settings unless it was being daemonized. So adding the else clause below has fixed it so I am now getting stdout and stderr messages.

    if daemonize:
        from django.utils.daemonize import become_daemon
        become_daemon(our_home_dir=options["workdir"], **daemon_kwargs)
    else:
        if options['outlog']:
            so = open(options['outlog'], 'a+', 0)
            os.dup2(so.fileno(), sys.stdout.fileno())
        if options['errlog']:
            se = open(err_log, 'a+', 0)
            os.dup2(se.fileno(), sys.stderr.fileno())


I need to submit this to the Django project. But at least I am able to see error messages now.

Please login to post a reply.



Powered by Sphene Community Tools