On Nov 8, 2015 11:25 AM, "Robin Fourcade" <fourca...@gmail.com> wrote:
>
> Hello,
> I'm trying to run my django project on my CentOS server.
>
> I followed this tutorial : http://www.science-emergence.com/LeWebFrameworkDjango/DeployerUneApplicationDjangoSurCentos/#deployer-votre-application-django
>
> And at the end, they say that I just have to enter my server IP address and I'll have access to my project, but I only have a 500 error: Internal Server Error
>
What do your Apache access and error logs have to say?
> However, when I shutdown apache and run: python manage.py runsever 0.0.0.0:80, everything works fine.
>
Then it is likely an issue with your Apache setup.
> How is it possible to do without runsever, because I read somewhere that it what not the right thing to do.
You are correct. Apache or another production grade web server should be used when your site is made available on the Internet.
>
> Can somebody help me ?
>
> Thanks,
> Robin Fourcade.
>
> --
[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[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'., referer: http://212.227.107.82/[Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] Traceback (most recent call last):, referer: http://212.227.107.82/[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__, referer: http://212.227.107.82/[Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] self.load_middleware(), referer: http://212.227.107.82/[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, referer: http://212.227.107.82/[Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] for middleware_path in settings.MIDDLEWARE_CLASSES:, referer: http://212.227.107.82/[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, referer: http://212.227.107.82/[Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] self._setup(), referer: http://212.227.107.82/[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, referer: http://212.227.107.82/[Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] self._wrapped = Settings(settings_module), referer: http://212.227.107.82/[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__, referer: http://212.227.107.82/[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)), referer: http://212.227.107.82/[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, referer: http://212.227.107.82/[Sun Nov 08 14:46:42 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:42 2015] [error] [client 109.10.154.52] Traceback (most recent call last):[Sun Nov 08 14:46:42 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:42 2015] [error] [client 109.10.154.52] self.load_middleware()[Sun Nov 08 14:46:42 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:42 2015] [error] [client 109.10.154.52] for middleware_path in settings.MIDDLEWARE_CLASSES:[Sun Nov 08 14:46:42 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:42 2015] [error] [client 109.10.154.52] self._setup()[Sun Nov 08 14:46:42 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:42 2015] [error] [client 109.10.154.52] self._wrapped = Settings(settings_module)[Sun Nov 08 14:46:42 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:42 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:42 2015] [error] [client 109.10.154.52] ImportError: Could not import settings 'pizzaclub.settings' (Is it on sys.path?): No module named pizzaclub.settings[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] mod_wsgi (pid=22420): Exception occurred processing WSGI script '/var/www/html/pizzaclub/public/pizzaclub.wsgi'., referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] Traceback (most recent call last):, referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 219, in __call__, referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] self.load_middleware(), referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 37, in load_middleware, referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] for middleware_path in settings.MIDDLEWARE_CLASSES:, referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] File "/usr/lib/python2.6/site-packages/django/utils/functional.py", line 184, in inner, referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] self._setup(), referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 42, in _setup, referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] self._wrapped = Settings(settings_module), referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 95, in __init__, referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e)), referer: http://212.227.107.82/[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] ImportError: Could not import settings 'pizzaclub.settings' (Is it on sys.path?): No module named pizzaclub.settings, referer: http://212.227.107.82/
python --version
Python 2.7.8
So I'm a bit lost here. :/
Thanks again for your help.
Hello,
no, the problem is here:
[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] ImportError: Could not import settings 'pizzaclub.settings' (Is it on sys.path?): No module named pizzaclub.settings, referer:http://212.227.107.82/
It seems that your settings file is either missing, or Apache is misconfigured so mod_wsgi can not find it.
--
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...@googlegroups.com.
To post to this group, send email to django...@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/d93b25b2-6a65-470c-83df-60b4e1514b2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import os, sys#Calculate the path based on the location of the WSGI scriptapache_configuration = os.path.dirname(__file__)project = os.path.dirname(apache_configuration)workspace = os.path.dirname(project)sys.path.append(workspace)
os.environ['DJANGO_SETTINGS_MODULE'] = 'pizzaclub.settings'import django.core.handlers.wsgiapplication = django.core.handlers.wsgi.WSGIHandler()
Include "/var/www/html/pizzaclub/public/django_wsgi.conf"
Alias /static/ /var/www/html/pizzaclub/public/static/Alias /media/ "/var/www/html/pizzaclub/public/media/"
WSGIScriptAlias / "/var/www/html/pizzaclub/public/pizzaclub.wsgi"WSGIPythonPath /var/www/html/emergence/:/var/www/html/pizzaclub/pizza_club:/var/www/html/pizzaclub/pizza_club/db:/var/www/html/pizzaclub/public/media:/var/www/html/pizzaclub/apache:/usr/bin/python
<Directory "/var/www/html/pizzaclub/public">Allow from all</Directory>
--
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...@googlegroups.com.
To post to this group, send email to django...@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/ec3bba44-a637-48e5-9636-ff5ffadd13e6%40googlegroups.com.
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)
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
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
Hello,there’s a lot that is not clear for me in your included config:• Why are all those paths in WSGIPythonPath?
• Are there Python modules in those directories?
+--- pizzaclub
| +--- pizza_club
| | +--- settings.py
| | +--- wsgi.pyc
| | +--- settings.pyc
| | +--- wsgi.py
| | +--- __init__.pyc
| | +--- __init__.py
| | +--- templates
| +--- public
| | +--- static
| | | +--- fonts
| | | +--- admin
| | | | +--- img
| | | | +--- js
| | | | +--- css
| | | | | +--- base.css
| | | +--- js
| | | +--- css
| | +--- statics
| | | +--- fonts
| | | +--- admin
| | | | +--- js
| | | | | +--- jquery.js
| | | | | +--- timeparse.js
| | | | | +--- actions.js
| | | | | +--- collapse.js
| | | | | +--- related-widget-wrapper.js
| | | | | +--- admin
| | | | | | +--- DateTimeShortcuts.js
| | | | | | +--- RelatedObjectLookups.js
| | | | | +--- LICENSE-JQUERY.txt
| | | | | +--- urlify.js
| | | | | +--- inlines.min.js
| | | | | +--- jquery.init.js
| | | | | +--- jquery.min.js
| | | | | +--- core.js
| | | | | +--- prepopulate.min.js
| | | | | +--- collapse.min.js
| | | | | +--- inlines.js
| | | | | +--- SelectFilter2.js
| | | | | +--- actions.min.js
| | | | | +--- calendar.js
| | | | | +--- SelectBox.js
| | | | | +--- prepopulate.js
| | | | +--- css
| | | | | +--- dashboard.css
| | | | | +--- changelists.css
| | | | | +--- forms.css
| | | | | +--- widgets.css
| | | | | +--- rtl.css
| | | | | +--- login.css
| | | | | +--- ie.css
| | | | | +--- base.css
| | | +--- js
| | | | +--- bootstrap.js
| | | | +--- bootstrap.min.js
| | | | +--- npm.js
| | | +--- css
| | | | +--- styles.css
| | +--- urls.pyc
| | +--- media
| | +--- django_wsgi.conf
| | +--- __init__.pyc
| | +--- pizzaclub.wsgi
| | +--- urls.py
| | +--- __init__.py
| +--- pizza_club_order
| | +--- migrations
| | | +--- 0003_commande_cout.pyc
| | | +--- 0003_commande_cout.py
| | | +--- 0002_transaction.py
| | | +--- 0006_pizza_taille.pyc
| | | +--- 0002_transaction.pyc
| | | +--- 0007_heures.py
| | | +--- 0004_auto_20151025_2251.pyc
| | | +--- __init__.pyc
| | | +--- 0004_auto_20151025_2251.py
| | | +--- 0005_auto_20151025_2251.py
| | | +--- 0007_heures.pyc
| | | +--- 0005_auto_20151025_2251.pyc
| | | +--- __init__.py
| | | +--- 0001_initial.pyc
| | | +--- 0006_pizza_taille.py
| | | +--- 0001_initial.py
| | +--- models.pyc
| | +--- admin.py
| | +--- urls.pyc
| | +--- views.pyc
| | +--- forms.pyc
| | +--- admin.pyc
| | +--- models.py
| | +--- __init__.pyc
| | +--- views.py
| | +--- forms.py
| | +--- urls.py
| | +--- __init__.py
| | +--- tests.py
| | +--- templates
| | | +--- pizza_club_order
| | | | +--- intervenant.html
| | | | +--- inscription.html
| | | | +--- payement.html
| | | | +--- crediter.html
| | | | +--- accueil.html
| | | | +--- tresorerie.html
| | | | +--- login.html
| | | | +--- commander.html
| | | | +--- profil.html
| | | +--- base.html
| | | +--- .DS_Store
| +--- manage.py
| +--- db.sqlite3
| +--- apache
| +--- db.sql
Everything is here ! (It's quite a small project)
• Do I get it right that your application is installed under /var/www (which is generally a bad idea)?
• Is pizzaclub/settings.py available if you stand in any of those directories? (Ie. try cd <directory>; ls pizzaclub/settings.py)
Best,Gergely
Do you think it's better to install one or another ? Actually, I already tried on Debian 7 and I followed some tutorial but I wasn't able to run the server neither. So if you know a great tutorial which shows how to install&run a django project on one of theses distributions, it would be perfect! :) Thanks again ! Robin. |
--
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...@googlegroups.com.
To post to this group, send email to django...@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/5641A340.5080701%40matthias-runge.de.
For more options, visit https://groups.google.com/d/optout.
I would strongly suggest abandoning trying to fix the import problem until you either a) verify that you have recompiled mod_wsgi with the correct Python version or b) switch to a distribution that uses a supported version of Python by default.
At this point, you are wasting time and you may not even be able to fix it without a supported version of Python being used by Apache/mod_wsgi. It's like trying to fix a flat tire on a car and expecting it to be able to drive when you know the engine is missing.
Also, if you have a virtualenv that has the correct Python version on that system, you'll need to verify that mod_wsgi is using that Python interpreter, but that won't work with your current version of mod_wsgi.
-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...@googlegroups.com.
To post to this group, send email to django...@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/5f9f331a-ad44-48cd-9068-8326212423d2%40googlegroups.com.
Python 3.7 would be quite a feat considering it hasn't been invented yet. ;-P
Take a look at these and focus on the parts pertaining to Apache/httpd and mod_wsgi.
https://github.com/crits/crits/wiki/RHEL-Supplemental-Install-Guide
https://www.webhostpython.com/billing/knowledgebase.php?action=displayarticle&id=33
If you aren't comfortable compiling your own stuff, you should consider switching to a distribution that supports 2.7 by default. RHEL/CentOS is pretty much the last notable holdout due to their extended release schedule.
-James
[Wed Nov 11 12:56:37.525607 2015] [mpm_event:notice] [pid 28089:tid 140367682340736] AH00491: caught SIGTERM, shutting down[Wed Nov 11 12:56:37.635193 2015] [mpm_event:notice] [pid 28192:tid 140578408851328] AH00489: Apache/2.4.7 (Ubuntu) mod_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations[Wed Nov 11 12:56:37.635323 2015] [core:notice] [pid 28192:tid 140578408851328] AH00094: Command line: '/usr/sbin/apache2'[Wed Nov 11 12:56:39.823415 2015] [core:error] [pid 28196:tid 140578239018752] (13)Permission denied: [client 109.10.154.52:50531] AH00035: access to / denied (filesystem path '/root/pizzaclub') because search permissions are missing on a component of the path[Wed Nov 11 12:56:40.046750 2015] [core:error] [pid 28196:tid 140578228528896] (13)Permission denied: [client 109.10.154.52:50531] AH00035: access to /favicon.ico denied (filesystem path '/root/pizzaclub') because search permissions are missing on a component of the path, referer: http://s18710917.domainepardefaut.fr/[Wed Nov 11 12:56:41.625131 2015] [core:error] [pid 28196:tid 140578218039040] (13)Permission denied: [client 109.10.154.52:50531] AH00035: access to / denied (filesystem path '/root/pizzaclub') because search permissions are missing on a component of the path[Wed Nov 11 12:56:41.871027 2015] [core:error] [pid 28196:tid 140578207549184] (13)Permission denied: [client 109.10.154.52:50531] AH00035: access to /favicon.ico denied (filesystem path '/root/pizzaclub') because search permissions are missing on a component of the path, referer: http://s18710917.domainepardefaut.fr/
/root/pizzaclub
)<VirtualHost *:80>
ServerAdmin webmaster@localhost DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/pizzaclub/pizzaclub/static <Directory /home/pizzaclub/pizzaclub/static> Require all granted </Directory>
<Directory /home/pizzaclub/pizzaclub/static> <Files wsgi.py> Require all granted </Files> </Directory>
WSGIDaemonProcess pizzaclub python-path=/home/pizzaclub:/home/pizzaclub/pizzaclubenv/lib/python2.7/site-packages WSGIProcessGroup pizzaclub WSGIScriptAlias / /home/pizzaclub/pizzaclub/wsgi.py
</VirtualHost>
[Wed Nov 11 15:07:26.244727 2015] [mpm_event:notice] [pid 27193:tid 140432722884480] AH00491: caught SIGTERM, shutting down[Wed Nov 11 15:07:26.354982 2015] [mpm_event:notice] [pid 27289:tid 140603486005120] AH00489: Apache/2.4.7 (Ubuntu) mod_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations[Wed Nov 11 15:07:26.355107 2015] [core:notice] [pid 27289:tid 140603486005120] AH00094: Command line: '/usr/sbin/apache2'[Wed Nov 11 15:07:28.461063 2015] [authz_core:error] [pid 27293:tid 140603387373312] [client 109.10.154.52:51815] AH01630: client denied by server configuration: /home/pizzaclub/pizzaclub/wsgi.py[Wed Nov 11 15:07:30.563364 2015] [authz_core:error] [pid 27293:tid 140603376875264] [client 109.10.154.52:51815] AH01630: client denied by server configuration: /home/pizzaclub/pizzaclub/wsgi.py