Django: url and content creation results in 500 and no apache error log entry
Question: If i try to open a created url i get an 500 error.

My procedure was:

First `python manage.py startapp black`

I added in `project/settings.py` under `INSTALLED_APPS` `'black',`

I added in `project/urls.py` `url(r'^test/', include('black.urls')),`

Content of `black/urls.py` is:

    
    
    from django.conf.urls import patterns, url
    from black import views
    
    urlpatterns = patterns('',
    url(r'^$', views.index, name='index')
    )
    

And content of black/views.py:

    
    
    from django.http import HttpResponse
    
    def index(request):
            return HttpResponse("SHOW ME: BLACK")
    

After all i synced the database.

I can't see any error in apache-error-log and also not in my posted django
files. What could cause this?


Answer: I suggest you to take a look a the several handy ways to [log
errors](https://docs.djangoproject.com/en/dev/topics/logging/) with django.  
For production, you will want to configure your logging behavior.  
You can find an example
[here](https://docs.djangoproject.com/en/dev/topics/logging/#an-example) in
the same docs.

What I personally do in production is enabling email logging, it sends me an
email each time there is a fatal error.

Let's see what it would look like for logging both by mail and in a file:

**settings.py**

    
    
    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'handlers': {
            'mail_admins': {
                'level': 'ERROR',
                'class': 'django.utils.log.AdminEmailHandler'
            },
            'logfile': {
                'class': 'logging.handlers.WatchedFileHandler',
                'filename': '/var/log/django/your_application.log'
            },
        },
        'loggers': {
            'django.request': {
                'handlers': ['mail_admins'],
                'level': 'ERROR',
                'propagate': True,
            },
            'django': {
                'handlers': ['logfile'],
                'level': 'ERROR',
                'propagate': False,
            },
        }
    }
    

