Issue in deploying django application
Question: I am getting "Internal Server Error" when I try to access the django website.
I am using Django 1.8, Python 2.7.10, centos 6.5 and apache.

In apache log I am getting the following error:

    
    
    mod_wsgi (pid=23866): Target WSGI script '/abc/abc/abc/wsgi.py' cannot be loaded as Python module.
    [Mon May 25 14:40:47 2015] [error] [client xyz] mod_wsgi (pid=23866): Exception occurred processing WSGI script '/abc/abc/abc/wsgi.py'.
    [Mon May 25 14:40:47 2015] [error] [client xyz] Traceback (most recent call last):
    [Mon May 25 14:40:47 2015] [error] [client xyz]   File "/abc/abc/abc/wsgi.py", line 12, in <module>
    [Mon May 25 14:40:47 2015] [error] [client xyz]     from django.core.wsgi import get_wsgi_application
    [Mon May 25 14:40:47 2015] [error] [client xyz]   File "/abc/lib/python2.7/site-packages/django/__init__.py", line 1, in <module>
    [Mon May 25 14:40:47 2015] [error] [client xyz]     from django.utils.version import get_version
    [Mon May 25 14:40:47 2015] [error] [client xyz]   File "/abc/lib/python2.7/site-packages/django/utils/version.py", line 7, in <module>
    [Mon May 25 14:40:47 2015] [error] [client xyz]     from django.utils.lru_cache import lru_cache
    [Mon May 25 14:40:47 2015] [error] [client xyz]   File "/abc/lib/python2.7/site-packages/django/utils/lru_cache.py", line 28
    [Mon May 25 14:40:47 2015] [error] [client xyz]      fasttypes = {int, str, frozenset, type(None)},
    [Mon May 25 14:40:47 2015] [error] [client xyz]                      ^
    [Mon May 25 14:40:47 2015] [error] [client xyz]  SyntaxError: invalid syntax
    

Thanks


Answer: Although you say you are running Python 2.7, this error indicates that in fact
you are using 2.6, as set literals were only introduced in 2.7.

The issue is that mod_wsgi is compiled against a specific Python version,
which in your case is the one that comes with Centos 6.5. You will need to
recompile it for 2.7, or find a version already compiled against that.

