rdegges / django-skel

A modern Django (1.5) project skeleton.
http://django-skel.rtfd.org/
518 stars 105 forks source link

Internal Server Error #34

Open andyjessop opened 11 years ago

andyjessop commented 11 years ago

Hi, I've been following your instructions and have deployed my app but am getting an internal server error when trying to access the website:

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request.

I logged all the steps that I took during deployment, and it all looks fine (except for the memcache installation, see below) so I'm not sure what's gone wrong here:

git remote add olp-heroku git@heroku.com:olp-main-website.git

git push olp-heroku master

$ heroku addons:add memcache:5mb --app olp-main-website Adding memcache:5mb on olp-main-website... failed ! The memcache add-on has been disabled. Please choose an alternative service at https://addons.heroku.com/#caching

$ heroku addons --app olp-main-website === olp-main-website Configured Add-ons cloudamqp:lemur heroku-postgresql:dev HEROKU_POSTGRESQL_GRAY newrelic:standard pgbackups:auto-month scheduler:standard sentry:developer

$ heroku pg:info --app olp-main-website === HEROKU_POSTGRESQL_GRAY_URL (DATABASE_URL) Plan: Dev Status: available Connections: 1 PG Version: 9.2.4 Created: 2013-06-03 08:36 UTC Data Size: 6.3 MB Tables: 0 Rows: 0/10000 (In compliance) Fork/Follow: Unsupported

$ heroku pg:promote HEROKU_POSTGRESQL_GRAY --app olp-main-website Promoting HEROKU_POSTGRESQL_GRAY_URL (DATABASE_URL) to DATABASE_URL... done

values hidden

$ heroku config:add --app olp-main-website AWS_ACCESS_KEY_ID=xxx $ heroku config:add --app olp-main-website AWS_SECRET_ACCESS_KEY=xxx $ heroku config:add --app olp-main-website AWS_STORAGE_BUCKET_NAME=xxx

$ heroku config:add --app olp-main-website DJANGO_SETTINGS_MODULE=website.settings.prod

$ heroku config:add --app olp-main-website SECRET_KEY=xxx

$ heroku ps --app olp-main-website === web (1X): newrelic-admin run-program gunicorn -c gunicorn.py.ini wsgi:application web.1: up 2013/06/03 09:57:57 (~ 21m ago)

$ heroku run python manage.py collectstatic --noinput --app olp-main-website $ heroku run python manage.py compress --app olp-main-website

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request.

andyjessop commented 11 years ago

Also, just looking at the db-related lines above, it looks like the db didn't migrate across.

cswenor commented 11 years ago

I use memcachier now because you get more for free, it looks like memcache has been disabled. https://addons.heroku.com/memcachier Another thing I learned when I started playing with this is that I didn't have to create a DB one was created for me already. So I just used that one. Also it would be nice if you could give us the exact error that you are getting. That is the error it is telling your browser, but if you could check your logs it would make it easier. Thanks, Chris

andyjessop commented 11 years ago

Thanks for that, Chris. These are the log entries when trying to access the app:

$ heroku logs --app olp-main-website 2013-06-03T10:14:37.038473+00:00 app[web.1]: 2013-06-03 10:14:37,038 (8/Dummy-2) newrelic.core.agent INFO - New Relic Python Agent (1.3.0.289) 2013-06-03T10:14:36.871665+00:00 heroku[router]: at=info method=GET path=/ host=olp-main-website.herokuapp.com fwd="86.161.31.50" dyno=web.1 connect=1ms service=302ms status=500 bytes=0 2013-06-03T10:14:37.493994+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=olp-main-website.herokuapp.com fwd="86.161.31.50" dyno=web.1 connect=1ms service=455ms status=404 bytes=5

shrikant-joshi commented 11 years ago

I see the same errors too, occasionally. And looking at @babaggeii's logs, it seems to be due to the favicon.ico and something to do with django-compressor. Here's my sentry log snippet from the same error:

OfflineGenerationError
You have offline compression enabled but key "xxxx" is missing from offline manifest. You may need to run "python manage.py compress".

...and the stacktrace:

  Stacktrace (most recent call last):

  File "django/core/handlers/base.py", line 153, in get_response
    response = callback(request, **param_dict)
  File "django/utils/decorators.py", line 91, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "django/views/defaults.py", line 26, in page_not_found
    return http.HttpResponseNotFound(template.render(RequestContext(request, {'request_path': request.path})))
  File "django/template/base.py", line 140, in render
    return self._render(context)
  File "django/template/base.py", line 134, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 830, in render
    bit = self.render_node(node, context)
  File "django/template/base.py", line 844, in render_node
    return node.render(context)
  File "django/template/loader_tags.py", line 124, in render
    return compiled_parent._render(context)
  File "django/template/base.py", line 134, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 830, in render
    bit = self.render_node(node, context)
  File "django/template/base.py", line 844, in render_node
    return node.render(context)
  File "compressor/templatetags/compress.py", line 147, in render
    return self.render_compressed(context, self.kind, self.mode, forced=forced)
  File "compressor/templatetags/compress.py", line 88, in render_compressed
    cached_offline = self.render_offline(context, forced=forced)
  File "compressor/templatetags/compress.py", line 72, in render_offline
    'You may need to run "python manage.py compress".' % key)

Looking at the django-compressor docs, it seems the cache key is not being passed to the function. I'm still trying to figure out why this should happen with favicon.ico, but if anyone else has an answer, please help?

Thanks! :)