1

I have a problem with Django, running on Apache and Python 3.5.

App is running okay, and the first problem with my app is with Debug=False thing. I already created custom handler404 method , and when i type some wrong URL, basically I'm expecting Django on request to show me my custom 404 template, but he don't do that! Django constantly showing his message: *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. *

settings.py with middleware

DEBUG = False
ALLOWED_HOSTS = ["www.bancaintesa.com"]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',                
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

Here is the file views.py with handler404

def handler404(request):
    response = render_to_response('404.html', context_instance=RequestContext(request))
    response.status_code = 404
    return response

urls.py file

handler404 = 'intesa.views.handler404'

Second thing, installed version of Django is 1.10, but when i run Django app on some irrelevant URL error, he shows me that Django is running on 1.8.7 version. Mindblowing. Any explanation?

Does anybody knows what is happening or somethinf, Thank you, I appreciate it [very much] (sorry for bad english).

mejdenovac
  • 21
  • 1
  • 2
    Do you have any virtualenv's installed? Is it possible it isn't using the one you think it is? – erik-sn Sep 26 '16 at 00:02
  • In respect of using virtual environments with mod_wsgi, make sure you review http://blog.dscpl.com.au/2014/09/using-python-virtual-environments-with.html to make sure you are doing it the correct way. – Graham Dumpleton Sep 26 '16 at 00:27
  • From the docs: “If DEBUG is set to True (in your settings module), then your 404 view will never be used, and your URLconf will be displayed instead, with some debug information.” – Andrey Shipilov Sep 26 '16 at 10:12
  • And yes, you're most likely using virtual environments. – Andrey Shipilov Sep 26 '16 at 10:13
  • Yes, i tried with **virtualenv** and without, and it's giving me the same message. I also deleted all *.pyc files, and nothing.... Thank you all for answers once more! – mejdenovac Sep 27 '16 at 19:20

0 Answers0