I got a Django project, with 1 application in it.
If I have debug set to True, and I hit write in a url like /sdfsdfsf then it will give an error
Using the URLconf defined in website.urls, Django tried these URL patterns, in this order:
...
The current URL, dsd, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
I then edit the settings.py to turn off Debug, but now I get 500 error. I look in the error config and get this;
mod_wsgi (pid=17601): Exception occurred processing WSGI script '/var/websites/xxxxx/website/django.wsgi'.
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 272, in __call__
response = self.get_response(request)
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 153, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 218, in handle_uncaught_exception
return callback(request, **param_dict)
File "/usr/local/lib/python2.6/dist-packages/django/utils/decorators.py", line 93, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/defaults.py", line 30, in server_error
t = loader.get_template(template_name) # You need to create a 500.html template.
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py", line 157, in get_template
template, origin = find_template(template_name)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py", line 128, in find_template
loader = find_template_loader(loader_name)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py", line 95, in find_template_loader
mod = import_module(module)
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.6/dist-packages/django/template/loaders/app_directories.py", line 23, in <module>
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
ImproperlyConfigured: ImportError cardir: No module named cardir
cardir is the name of my app in the project. However if go to a page which is not a 404 (like / or /about) the it works fine, so it can get the cardir. I feel something else is going on.
Structure;
# ls
cardir django.wsgi __init__.py __init__.pyc manage.py settings.py settings.pyc static templates urls.py urls.pyc
# cd templates/ && ls
404.html 500.html base.html index.html
Check if there is not an error in 404.html. I had similar issue some time ago.