500 error when DEBUG = False

16 views
Skip to first unread message

Mark Cooper

unread,
Mar 10, 2015, 10:25:19 AM3/10/15
to media...@googlegroups.com
Hello! 

This morning's dilemma: with DEBUG = False in settings_production I get a 500 error on the live site, which seems to run fine with DEBUG = True.  I read through the related thread below. ALLOWED_HOSTS is set in the recommend manner. Ideas?  

Thanks, Mark

Here's the Traceback:

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/core/handlers/base.py", line 137, in get_response

   response = response.render()

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/template/response.py", line 105, in render

   self.content = self.rendered_content

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/template/response.py", line 82, in rendered_content

   content = template.render(context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/template/base.py", line 140, in render

   return self._render(context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/test/utils.py", line 85, in instrumented_test_render

   return self.nodelist.render(context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/template/base.py", line 840, in render

   bit = self.render_node(node, context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/template/base.py", line 854, in render_node

   return node.render(context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/template/loader_tags.py", line 123, in render

   return compiled_parent._render(context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/test/utils.py", line 85, in instrumented_test_render

   return self.nodelist.render(context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/template/base.py", line 840, in render

   bit = self.render_node(node, context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/template/base.py", line 854, in render_node

   return node.render(context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/template/defaulttags.py", line 506, in render

   output = self.nodelist.render(context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/template/base.py", line 840, in render

   bit = self.render_node(node, context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/django/template/base.py", line 854, in render_node

   return node.render(context)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/compressor/templatetags/compress.py", line 149, in render

   return self.render_compressed(context, self.kind, self.mode, forced=forced)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/compressor/templatetags/compress.py", line 102, in render_compressed

   cache_key, cache_content = self.render_cached(compressor, kind, mode, forced=forced)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/compressor/templatetags/compress.py", line 81, in render_cached

   cache_key = get_templatetag_cachekey(compressor, mode, kind)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/compressor/cache.py", line 94, in get_templatetag_cachekey

   "templatetag.%s.%s.%s" % (compressor.cachekey, mode, kind))

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/compressor/utils/decorators.py", line 39, in __get__

   value = obj.__dict__[self.__name__] = self.__get(obj)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/compressor/base.py", line 172, in cachekey

   [self.content] + self.mtimes).encode(self.charset), 12)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/compressor/utils/decorators.py", line 39, in __get__

   value = obj.__dict__[self.__name__] = self.__get(obj)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/compressor/base.py", line 166, in mtimes

   for kind, value, basename, elem in self.split_contents()

File "/var/www/mediathread/ve/lib/python2.7/site-packages/compressor/css.py", line 23, in split_contents

   filename = self.get_filename(basename)

 File "/var/www/mediathread/ve/lib/python2.7/site-packages/compressor/base.py", line 137, in get_filename

   self.finders and " or with staticfiles." or "."))

UncompressableFileError: 'css/print.css' could not be found in the COMPRESS_ROOT '/var/www/mediathread/mediathread/media' or with staticfiles.


Susan Dreher

unread,
Mar 10, 2015, 11:30:10 AM3/10/15
to media...@googlegroups.com
Hi Mark - 

The UncompressableFileError seems to indicate django compressor is not able to find referenced files, in this case print.css. By default, the COMPRESS_ROOT is set to: "/var/www/mediathread/mediathread/media/". Is your application deployed to that directory?

btw - just wanted to say thanks for bringing these issues to the group. Having this open dialogue is excellent.

Thanks,
Susan



--
You received this message because you are subscribed to the Google Groups "Mediathread" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mediathread...@googlegroups.com.
To post to this group, send email to media...@googlegroups.com.
Visit this group at http://groups.google.com/group/mediathread.
For more options, visit https://groups.google.com/d/optout.

Mark Cooper

unread,
Mar 10, 2015, 11:43:39 AM3/10/15
to media...@googlegroups.com
Hi Susan,

Thanks for the help! My COMPRESS_ROOT was indeed set to the default, but that path does not exist.  From the GIT css/print.css goes here: “/var/www/mediathread/media/“  It didn't occur to me that changing the DEBUG setting would affect the behavior of COMPRESS_ROOT, but I guest it does. I dropped the extra “mediathread” from the path and the error goes away—maybe this is something to change in the distribution? 

Cheers,
Mark 


You received this message because you are subscribed to a topic in the Google Groups "Mediathread" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mediathread/bIFEAI-4eQs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mediathread...@googlegroups.com.

Susan Dreher

unread,
Mar 10, 2015, 12:11:10 PM3/10/15
to media...@googlegroups.com
Hi Mark - 

Compress is turned off by default when DEBUG=True, thus bypassing the step that caused errors. 

The double mediathread in the directory is an artifact of our internal deployment scheme. The base url (/var/www/mediathread) is created via an infrastructure management tool (salt). We then symlink the mediathread subdirectory to the current full deploy. This allows us to push new code with minimal downtime by simply flipping the symlink when the new deploy is ready.

If having that be the default config is proving problematic, we can definitely pull it and direct everyone to setup deploy_specific/settings.py with their site specific settings. Would that have been clearer do you think?

Cheers,
Susan

Mark Cooper

unread,
Mar 10, 2015, 12:56:39 PM3/10/15
to media...@googlegroups.com
Hi Susan,

Thanks for the explanation.

I found this easy to miss (obviously), and would vote for either moving it to deploy_specific or adding a #comment in settings_production reminding folks that that the extra mediathread might need to go. 

Mark 

Susan Dreher

unread,
Mar 10, 2015, 1:05:31 PM3/10/15
to media...@googlegroups.com
Cool, thanks for the input. We definitely need work on our default deployment documentation. I'll take a task to add our conversations to the existing documentation.

s.
Reply all
Reply to author
Forward
0 new messages