On Sun, Nov 8, 2015 at 12:59 PM, Robin Fourcade <fourcadero...@gmail.com>
wrote:

> Hi,
> Thanks for your answer !
> (I'd add that even if apache is running, if I run the server on the port
> 8000, I can acces the django project on this port without any issue)
>
>
That simply means that the Django runserver management command has found
all of the right pieces to run, and is (mostly) irrelevant to running your
site using Apache/mod_wsgi.



> Here's the log
>
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] mod_wsgi
> (pid=22420): Exception occurred processing WSGI script
> '/var/www/html/pizzaclub/public/pizzaclub.wsgi'.
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] Traceback (most
> recent call last):
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 219,
> in __call__
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]
> self.load_middleware()
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 37,
> in load_middleware
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]     for
> middleware_path in settings.MIDDLEWARE_CLASSES:
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/utils/functional.py", line 184, in
> inner
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]     self._setup()
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 42, in
> _setup
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]
> self._wrapped = Settings(settings_module)
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 95, in
> __init__
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]     raise
> ImportError("Could not import settings '%s' (Is it on sys.path?): %s" %
> (self.SETTINGS_MODULE, e))
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] ImportError:
> Could not import settings 'pizzaclub.settings' (Is it on sys.path?): No
> module named pizzaclub.settings
>
>
Aside from the path import issue that Gergely already pointed out, you
actually have a larger problem. The version of mod_wsgi that Apache is
using is compiled against the wrong version of Python per your mention of
Python 2.7. Even with tweaking the location of the Python interpreter to a
newer version, mod_wsgi needs to be compiled against the same version that
you are running. This means you need to either find an RPM that does this
for you somewhere, or you need to recompile mod_wsgi yourself against the
version of Python you presumably installed manually.

This guide may help, although I've never done this myself and I can't vouch
for its accuracy (especially given the typo in the URL). YMMV:
https://www.fir3net.com/Programming/Python/how-do-i-compile-modwgsi-for-python-27.html



> I think I've an issue with the python version. I installed django on
> python 2.7, but even if I make alias python=/usr/local/bin/python2.7, the
> log still shows python2.6, CentOS doesn't want to use the 2.7 version by
> default, even if I have this:
>
> python --version
>
> Python 2.7.8
>

Creating an alias will only affect your particular user environment (and
creating an alias in that manner will likely break other things on the
system you are trying to do that are expecting 2.6). Apache is running as a
different user and does not have a shell environment where aliases can be
applied. Either upgrade CentOS to a newer release that includes a more
recent version of Python by default (which would include a matching version
of mod_wsgi for Apache), or recompile mod_wsgi.

Reverting to an older version of Django is also not an option because none
of the currently supported Django versions work with Python 2.6 (1.4LTS
ended on Oct. 1, 2015).

 -James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVWFArqw_NqpwJCB1kFHgtbkV8H3yXDso8EVc9nj55oiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to