I have an issue with haystack https://stackoverflow.com/q/33669864/4910881 that requires me to uninstall it for now. I commented out haystack from installed apps expecting it will start throwing django import errors or similar errors but it still returning an internal server error.
[Thu Nov 12 15:32:03.579793 2015] [wsgi:error] [pid 191252:tid 139675802625792] [remote 127.0.0.1:196] for conn in connections.all():
[Thu Nov 12 15:32:03.579802 2015] [wsgi:error] [pid 191252:tid 139675802625792] [remote 127.0.0.1:196] File "/home/kbuzz/lib/python2.7/haystack/utils/loading.py", line 112, in all
[Thu Nov 12 15:32:03.579815 2015] [wsgi:error] [pid 191252:tid 139675802625792] [remote 127.0.0.1:196] return [self[alias] for alias in self.connections_info]
[Thu Nov 12 15:32:03.579823 2015] [wsgi:error] [pid 191252:tid 139675802625792] [remote 127.0.0.1:196] File "/home/kbuzz/lib/python2.7/haystack/utils/loading.py", line 100, in __getitem__
[Thu Nov 12 15:32:03.579836 2015] [wsgi:error] [pid 191252:tid 139675802625792] [remote 127.0.0.1:196] self._connections[key] = load_backend(self.connections_info[key]['ENGINE'])(using=key)
[Thu Nov 12 15:32:03.579844 2015] [wsgi:error] [pid 191252:tid 139675802625792] [remote 127.0.0.1:196] File "/home/kbuzz/lib/python2.7/haystack/utils/loading.py", line 53, in load_backend
[Thu Nov 12 15:32:03.579857 2015] [wsgi:error] [pid 191252:tid 139675802625792] [remote 127.0.0.1:196] return import_class(full_backend_path)
[Thu Nov 12 15:32:03.579865 2015] [wsgi:error] [pid 191252:tid 139675802625792] [remote 127.0.0.1:196] File "/home/kbuzz/lib/python2.7/haystack/utils/loading.py", line 23, in import_class
[Thu Nov 12 15:32:03.579878 2015] [wsgi:error] [pid 191252:tid 139675802625792] [remote 127.0.0.1:196] raise ImportError("The Python module '%s' has no '%s' class." % (module_path, class_name))
[Thu Nov 12 15:32:03.579894 2015] [wsgi:error] [pid 191252:tid 139675802625792] [remote 127.0.0.1:196] ImportError: The Python module 'xapian_backend' has no 'XapianEngine' class.
[Thu Nov 12 15:32:03.626881 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] mod_wsgi (pid=191252): Exception occurred processing WSGI script '/home/kbuzz/webapps/revised/kb/kb/wsgi.py'.
[Thu Nov 12 15:32:03.626926 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] Traceback (most recent call last):
[Thu Nov 12 15:32:03.626950 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] File "/home/kbuzz/lib/python2.7/django/core/handlers/wsgi.py", line 175, in __call__
[Thu Nov 12 15:32:03.626989 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] signals.request_started.send(sender=self.__class__)
[Thu Nov 12 15:32:03.627014 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] File "/home/kbuzz/lib/python2.7/django/dispatch/dispatcher.py", line 198, in send
[Thu Nov 12 15:32:03.627041 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] response = receiver(signal=self, sender=sender, **named)
[Thu Nov 12 15:32:03.627057 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] File "/home/kbuzz/lib/python2.7/haystack/__init__.py", line 59, in reset_search_queries
[Thu Nov 12 15:32:03.627082 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] for conn in connections.all():
[Thu Nov 12 15:32:03.627097 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] File "/home/kbuzz/lib/python2.7/haystack/utils/loading.py", line 112, in all
[Thu Nov 12 15:32:03.627123 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] return [self[alias] for alias in self.connections_info]
[Thu Nov 12 15:32:03.627138 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] File "/home/kbuzz/lib/python2.7/haystack/utils/loading.py", line 100, in __getitem__
[Thu Nov 12 15:32:03.627161 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] self._connections[key] = load_backend(self.connections_info[key]['ENGINE'])(using=key)
[Thu Nov 12 15:32:03.627176 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] File "/home/kbuzz/lib/python2.7/haystack/utils/loading.py", line 53, in load_backend
[Thu Nov 12 15:32:03.627199 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] return import_class(full_backend_path)
[Thu Nov 12 15:32:03.627214 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] File "/home/kbuzz/lib/python2.7/haystack/utils/loading.py", line 23, in import_class
[Thu Nov 12 15:32:03.627237 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] raise ImportError("The Python module '%s' has no '%s' class." % (module_path, class_name))
[Thu Nov 12 15:32:03.627263 2015] [wsgi:error] [pid 191252:tid 139675918014208] [remote 127.0.0.1:11720] ImportError: The Python module 'xapian_backend' has no 'XapianEngine' class.
Try removing all related .pyc files
Related
i followed AWS tutorial for django lightsail instance: https://aws.amazon.com/es/getting-started/hands-on/deploy-python-application/
i tried to deploy my own code but apache gives me errors on piped installed modules.
It seems that instance have different paths. Some one has deployed custom django projects on django lightsail instance?
[Sun Aug 16 22:58:29.402644 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] mod_wsgi (pid=4065): Exception occurred processing WSGI script '/opt/bitnami/apps/django/django_projects/orderbot/ordermenu/wsgi.py'.
[Sun Aug 16 22:58:29.403437 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] Traceback (most recent call last):
[Sun Aug 16 22:58:29.403493 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/apps/django/django_projects/orderbot/ordermenu/wsgi.py", line 22, in <module>
[Sun Aug 16 22:58:29.403504 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] application = get_wsgi_application()
[Sun Aug 16 22:58:29.403515 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Sun Aug 16 22:58:29.403521 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] django.setup(set_prefix=False)
[Sun Aug 16 22:58:29.403530 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
[Sun Aug 16 22:58:29.403535 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] apps.populate(settings.INSTALLED_APPS)
[Sun Aug 16 22:58:29.403544 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
[Sun Aug 16 22:58:29.403549 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] app_config = AppConfig.create(entry)
[Sun Aug 16 22:58:29.403558 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/apps/config.py", line 90, in create
[Sun Aug 16 22:58:29.403563 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] module = import_module(entry)
[Sun Aug 16 22:58:29.403571 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
[Sun Aug 16 22:58:29.403578 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] return _bootstrap._gcd_import(name[level:], package, level)
[Sun Aug 16 22:58:29.403587 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
[Sun Aug 16 22:58:29.403596 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "<frozen importlib._bootstrap>", line 991, in _find_and_load
[Sun Aug 16 22:58:29.403606 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
[Sun Aug 16 22:58:29.403626 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] ModuleNotFoundError: No module named 'phonenumber_field'
The problem is that 'python install packages in a directory that apache do not see'.
so: packages get installed in '/home/bitnami/.local/lib/python3.8/site-packages/' and Apache looks in '/opt/bitnami/python/lib/python3.8/site-packages/'.
The temporary solution I followed is copying packages to Apache eyes folder with this command 'cp -r /home/bitnami/.local/lib/python3.8/site-packages/* /opt/bitnami/python/lib/python3.8/site-packages/'
Just needed to use the root user with sudo su command for pip install packages, now are found by apache.
My Django app was working fine, but now I'm getting a server error, the last thing I did was a reboot to my Centos7 Server and now I'm getting this error:
and this are my logs I'm using apache:
[Thu Mar 30 14:04:10.571843 2017] [:error] [pid 11335] [remote 10.221.50.100:24] mod_wsgi (pid=11335): Target WSGI script '/opt/btsystem/BTSystem/wsgi.py' cannot be loaded as Python module.
[Thu Mar 30 14:04:10.571991 2017] [:error] [pid 11335] [remote 10.221.50.100:24] mod_wsgi (pid=11335): Exception occurred processing WSGI script '/opt/btsystem/BTSystem/wsgi.py'.
[Thu Mar 30 14:04:10.572263 2017] [:error] [pid 11335] [remote 10.221.50.100:24] Traceback (most recent call last):
[Thu Mar 30 14:04:10.572544 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/opt/btsystem/BTSystem/wsgi.py", line 16, in <module>
[Thu Mar 30 14:04:10.572795 2017] [:error] [pid 11335] [remote 10.221.50.100:24] application = get_wsgi_application()
[Thu Mar 30 14:04:10.572919 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/usr/lib64/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Thu Mar 30 14:04:10.573054 2017] [:error] [pid 11335] [remote 10.221.50.100:24] django.setup(set_prefix=False)
[Thu Mar 30 14:04:10.573107 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/usr/lib64/python2.7/site-packages/django/__init__.py", line 22, in setup
[Thu Mar 30 14:04:10.573170 2017] [:error] [pid 11335] [remote 10.221.50.100:24] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Thu Mar 30 14:04:10.573261 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/usr/lib64/python2.7/site-packages/django/utils/log.py", line 75, in configure_logging
[Thu Mar 30 14:04:10.573312 2017] [:error] [pid 11335] [remote 10.221.50.100:24] logging_config_func(logging_settings)
[Thu Mar 30 14:04:10.573369 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/usr/lib64/python2.7/logging/config.py", line 803, in dictConfig
[Thu Mar 30 14:04:10.573409 2017] [:error] [pid 11335] [remote 10.221.50.100:24] dictConfigClass(config).configure()
[Thu Mar 30 14:04:10.573455 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/usr/lib64/python2.7/logging/config.py", line 585, in configure
[Thu Mar 30 14:04:10.573501 2017] [:error] [pid 11335] [remote 10.221.50.100:24] '%r: %s' % (name, e))
[Thu Mar 30 14:04:10.573567 2017] [:error] [pid 11335] [remote 10.221.50.100:24] ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/opt/btsystem-logs/btsystem-debug.log'
Any idea?
The last line shows that Django doesn't have permission to write to the configured log file.
[Thu Mar 30 14:04:10.573567 2017] [:error] [pid 11335] [remote 10.221.50.100:24] ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/opt/btsystem-logs/btsystem-debug.log'
Make sure the file /opt/btsystem-logs/btsystem-debug.log is writeable by the user running the Django server.
The main problem was that I needed to do the following to enable the virtual host from Apache:
firewall-cmd --get-active-zones
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
Needed to open the ports.
I am trying to deploy my django project on a windows server, using apache 2.4 with mod_wsgi and pythong 3.4.
Now when I could run apache just fine but I got Internal Server Error when going to localhost, I have this Internal Server Error. Then I looked at the error.log and found the following:
The 'Apache2.4' service is restarting.
The 'Apache2.4' service has restarted.
winnt:notice] [pid 7756:tid 528] AH00424: Parent: Received restart signal -- Restarting the server.
[Thu Sep 29 18:18:19.003503 2016] [wsgi:warn] [pid 7756:tid 528] mod_wsgi: Compiled for Python/3.4.2.
[Thu Sep 29 18:18:19.003503 2016] [wsgi:warn] [pid 7756:tid 528] mod_wsgi: Runtime using Python/3.4.3.
[Thu Sep 29 18:18:19.003503 2016] [mpm_winnt:notice] [pid 7756:tid 528] AH00455: Apache/2.4.23 (Win64) mod_wsgi/4.4.12 Python/3.4.3 configured -- resuming normal operations
[Thu Sep 29 18:18:19.003503 2016] [mpm_winnt:notice] [pid 7756:tid 528] AH00456: Apache Lounge VC10 Server built: Jul 9 2016 11:59:00
[Thu Sep 29 18:18:19.003503 2016] [core:notice] [pid 7756:tid 528] AH00094: Command line: 'C:\\Apache24\\bin\\httpd.exe -d C:/Apache24'
[Thu Sep 29 18:18:19.003503 2016] [mpm_winnt:notice] [pid 7756:tid 528] AH00418: Parent: Created child process 10400
[Thu Sep 29 18:18:19.347246 2016] [wsgi:warn] [pid 10400:tid 456] mod_wsgi: Compiled for Python/3.4.2.
[Thu Sep 29 18:18:19.347246 2016] [wsgi:warn] [pid 10400:tid 456] mod_wsgi: Runtime using Python/3.4.3.
[Thu Sep 29 18:18:19.987923 2016] [mpm_winnt:notice] [pid 10400:tid 456] AH00354: Child: Starting 64 worker threads.
[Thu Sep 29 18:18:21.003576 2016] [mpm_winnt:notice] [pid 7476:tid 460] AH00364: Child: All worker threads have exited.
[Thu Sep 29 18:18:27.175151 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] mod_wsgi (pid=10400): Target WSGI script 'C:/EquipmentCalibration/equipcal/wsgi.py' cannot be loaded as Python module.
[Thu Sep 29 18:18:27.175151 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] mod_wsgi (pid=10400): Exception occurred processing WSGI script 'C:/EquipmentCalibration/equipcal/wsgi.py'.
[Thu Sep 29 18:18:27.175151 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] Traceback (most recent call last):\r
[Thu Sep 29 18:18:27.175151 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "C:/EquipmentCalibration/equipcal/wsgi.py", line 16, in <module>\r
[Thu Sep 29 18:18:27.175151 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] application = get_wsgi_application()\r
[Thu Sep 29 18:18:27.176153 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "C:\\Python34\\lib\\site-packages\\django\\core\\wsgi.py", line 13, in get_wsgi_application\r
[Thu Sep 29 18:18:27.176153 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] django.setup(set_prefix=False)\r
[Thu Sep 29 18:18:27.177153 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "C:\\Python34\\lib\\site-packages\\django\\__init__.py", line 22, in setup\r
[Thu Sep 29 18:18:27.177153 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)\r
[Thu Sep 29 18:18:27.177153 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "C:\\Python34\\lib\\site-packages\\django\\conf\\__init__.py", line 53, in __getattr__\r
[Thu Sep 29 18:18:27.177153 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] self._setup(name)\r
[Thu Sep 29 18:18:27.178128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "C:\\Python34\\lib\\site-packages\\django\\conf\\__init__.py", line 41, in _setup\r
[Thu Sep 29 18:18:27.178128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] self._wrapped = Settings(settings_module)\r
[Thu Sep 29 18:18:27.178128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "C:\\Python34\\lib\\site-packages\\django\\conf\\__init__.py", line 97, in __init__\r
[Thu Sep 29 18:18:27.178128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] mod = importlib.import_module(self.SETTINGS_MODULE)\r
[Thu Sep 29 18:18:27.178128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "C:\\Python34\\Lib\\importlib\\__init__.py", line 109, in import_module\r
[Thu Sep 29 18:18:27.178128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] return _bootstrap._gcd_import(name[level:], package, level)\r
[Thu Sep 29 18:18:27.178128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "<frozen importlib._bootstrap>", line 2254, in _gcd_import\r
[Thu Sep 29 18:18:27.178128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "<frozen importlib._bootstrap>", line 2237, in _find_and_load\r
[Thu Sep 29 18:18:27.179154 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked\r
[Thu Sep 29 18:18:27.179154 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed\r
[Thu Sep 29 18:18:27.179154 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "<frozen importlib._bootstrap>", line 2254, in _gcd_import\r
[Thu Sep 29 18:18:27.179154 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "<frozen importlib._bootstrap>", line 2237, in _find_and_load\r
[Thu Sep 29 18:18:27.179154 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked\r
[Thu Sep 29 18:18:27.179154 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55759] ImportError: No module named 'equipcal'\r
[Thu Sep 29 18:18:27.199128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] mod_wsgi (pid=10400): Target WSGI script 'C:/EquipmentCalibration/equipcal/wsgi.py' cannot be loaded as Python module., referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.199128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] mod_wsgi (pid=10400): Exception occurred processing WSGI script 'C:/EquipmentCalibration/equipcal/wsgi.py'., referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.199128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] Traceback (most recent call last):\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.199128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "C:/EquipmentCalibration/equipcal/wsgi.py", line 16, in <module>\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.199128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] application = get_wsgi_application()\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.199128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "C:\\Python34\\lib\\site-packages\\django\\core\\wsgi.py", line 13, in get_wsgi_application\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.199128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] django.setup(set_prefix=False)\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.199128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "C:\\Python34\\lib\\site-packages\\django\\__init__.py", line 22, in setup\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.199128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.200129 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "C:\\Python34\\lib\\site-packages\\django\\conf\\__init__.py", line 53, in __getattr__\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.200129 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] self._setup(name)\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.200129 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "C:\\Python34\\lib\\site-packages\\django\\conf\\__init__.py", line 41, in _setup\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.200129 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] self._wrapped = Settings(settings_module)\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.200129 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "C:\\Python34\\lib\\site-packages\\django\\conf\\__init__.py", line 97, in __init__\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.200129 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] mod = importlib.import_module(self.SETTINGS_MODULE)\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.201128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "C:\\Python34\\Lib\\importlib\\__init__.py", line 109, in import_module\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.201128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] return _bootstrap._gcd_import(name[level:], package, level)\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.201128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "<frozen importlib._bootstrap>", line 2254, in _gcd_import\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.201128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "<frozen importlib._bootstrap>", line 2237, in _find_and_load\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.201128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.201128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.201128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "<frozen importlib._bootstrap>", line 2254, in _gcd_import\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.201128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "<frozen importlib._bootstrap>", line 2237, in _find_and_load\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.201128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked\r, referer: http://localhost:8090/calbase
[Thu Sep 29 18:18:27.201128 2016] [wsgi:error] [pid 10400:tid 1108] [client ::1:55760] ImportError: No module named 'equipcal'\r, referer: http://localhost:8090/calbase
Apparently it is calling problem with my wsgi.py inside of my project. Currently I am just using the default wsgi.py file created when startproject. So it is just this:
"""
WSGI config for equipcal project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "equipcal.settings")
application = get_wsgi_application()
And my current https.conf is like this:
# Change Python path used by the server.
WSGIPythonPath “/EquipmentCalibration”
# Make calls to http://localhost/ refer to the Python/WSGI-script located at the specified location.
WSGIScriptAlias / /EquipmentCalibration/equipcal/wsgi.py
# Make calls to http://localhost/static refer to the specified folder.
Alias /static/ /EquipmentCalibration/static
Alias /media/ /EquipmentCalibration/media
<Directory /EquipmentCalibration/static>
Require all granted
</Directory>
<Directory /EquipmentCalibration/media>
Require all granted
</Directory>
<Directory /EquipmentCalibration/equipcal>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
I tried to do a bit of research around but didn't seem to find how should I configure it. Could somebody please shed some light on this please?
I uploaded the httpd.conf file for the staging django server to the live server and restarted it and that brought the site down. After returning the right file restarting it and stopping staging server I get internal server error roughly once for every 5 refreshes on the page that shows missing info for top_menu
[Fri Nov 13 11:38:41.793432 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] result = block.nodelist.render(context)
[Fri Nov 13 11:38:41.793440 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] File "/home/kbuzz/lib/python2.7/django/template/base.py", line 844, in render
[Fri Nov 13 11:38:41.793452 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] bit = self.render_node(node, context)
[Fri Nov 13 11:38:41.793461 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] File "/home/kbuzz/lib/python2.7/django/template/base.py", line 858, in render_node
[Fri Nov 13 11:38:41.793473 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] return node.render(context)
[Fri Nov 13 11:38:41.793481 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] File "/home/kbuzz/webapps/django/lib/python2.7/mptt/templatetags/mptt_tags.py", line 284, in render
[Fri Nov 13 11:38:41.793495 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] queryset = self.queryset_var.resolve(context)
[Fri Nov 13 11:38:41.793504 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] File "/home/kbuzz/lib/python2.7/django/template/base.py", line 734, in resolve
[Fri Nov 13 11:38:41.793516 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] value = self._resolve_lookup(context)
[Fri Nov 13 11:38:41.793524 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] File "/home/kbuzz/lib/python2.7/django/template/base.py", line 780, in _resolve_lookup
[Fri Nov 13 11:38:41.793537 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] (bit, current)) # missing attribute
[Fri Nov 13 11:38:41.793580 2015] [wsgi:error] [pid 130327:tid 139718655588096] [remote 127.0.0.1:25256] VariableDoesNotExist: Failed lookup for key [top_menu] in u"[{'False': False, 'None': None, 'True': True}, {}]"
which goes to this context proccessor 'top_menu':Page.objects.filter(top_menu=True, visible=True), and returns the info correctly when I run it from the shell.
>>> from pages.models import *
>>> Page.objects.filter(top_menu=True, visible=True)
[<Page: Home>, <Page: What’s On>, <Page: What’s On :: Today>, <Page: What’s On :
: This Weekend>, <Page: What’s On :: This Month>, <Page: Movies>, <Page: Movies
:: Now Showing>, <Page: Lifestyle>, <Page: Biz Directory>, <Page: Buy&Sell >, <P
age: Galleries>, <Page: Newsletters>]
>>>
I want to reset the apache server to start working correctly now.
I found the error was with the sys path in the wsgi it was pointing to the wrong path and restarting the server made the error to start coming.
I'm trying to do the deploy at my project with django1.8, using apache 2.x and mod_wsgi, the structure of my project is (pd: mi proyect is in /var/www)
projectdjango
apps -- (my django-apps)
....
projectdjango
settings
local.py
staging.py
url.py
static
templates
....
manage.py
projectdjango.wsgi
the code I'm using for the httpd.conf is
<VirtualHost *:80>
ServerName projectdjango.com
DocumentRoot /var/www/projectdjango
<Directory /var/www/ >
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess projectdjango.com processes=2 threads=15
WSGIProcessGroup projectdjango.com
WSGIScriptAlias / /var/www/projectdjango/projectdjango.wsgi
</VirtualHost>
and the code for projectdjango.wsgi is
import os
import sys
sys.path.append('/var/www')
sys.path.append('/var/www/projectdjango')
os.environ['DJANGO_SETTINGS_MODULE'] = 'projectdjango.settings.staging'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
error.log
[Thu Apr 23 16:44:48.540206 2015] [core:notice] [pid 21662:tid 140482308327296] AH00094: Command line: '/usr/sbin/apache2'
[Thu Apr 23 16:45:43.715053 2015] [mpm_event:notice] [pid 21662:tid 140482308327296] AH00491: caught SIGTERM, shutting down
[Thu Apr 23 16:45:44.907958 2015] [mpm_event:notice] [pid 21779:tid 140246657443712] AH00489: Apache/2.4.7 (Ubuntu) mod_wsgi/3.4 Python/2.7.6 configured -- resuming n$
[Thu Apr 23 16:45:44.908339 2015] [core:notice] [pid 21779:tid 140246657443712] AH00094: Command line: '/usr/sbin/apache2'
[Thu Apr 23 16:48:31.071450 2015] [mpm_event:notice] [pid 21779:tid 140246657443712] AH00491: caught SIGTERM, shutting down
[Thu Apr 23 16:48:32.282889 2015] [mpm_event:notice] [pid 21909:tid 140394885306240] AH00489: Apache/2.4.7 (Ubuntu) mod_wsgi/3.4 Python/2.7.6 configured -- resuming n$
[Thu Apr 23 16:48:32.283273 2015] [core:notice] [pid 21909:tid 140394885306240] AH00094: Command line: '/usr/sbin/apache2'
[Thu Apr 23 21:49:47.620133 2015] [:error] [pid 21911:tid 140394723014400] No handlers could be found for logger "django.request"
[Thu Apr 23 21:49:47.842564 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] mod_wsgi (pid=21911): Exception occurred processing WSGI script '/$
[Thu Apr 23 21:49:47.842699 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] Traceback (most recent call last):
[Thu Apr 23 21:49:47.842771 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/core/handler$
[Thu Apr 23 21:49:47.844350 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] response = self.get_response(request)
[Thu Apr 23 21:49:47.844455 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/core/handler$
[Thu Apr 23 21:49:47.844851 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] response = self.handle_uncaught_exception(request, resolver, s$
[Thu Apr 23 21:49:47.844904 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/core/handler$
[Thu Apr 23 21:49:47.844979 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return debug.technical_500_response(request, *exc_info)
[Thu Apr 23 21:49:47.845023 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/views/debug.$
[Thu Apr 23 21:49:47.846871 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] html = reporter.get_traceback_html()
[Thu Apr 23 21:49:47.846981 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/views/debug.$
[Thu Apr 23 21:49:47.847070 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return t.render(c)
[Thu Apr 23 21:49:47.847112 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/template/bas$
[Thu Apr 23 21:49:47.848209 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return self._render(context)
[Thu Apr 23 21:49:47.848293 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/template/bas$
[Thu Apr 23 21:49:47.848394 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return self.nodelist.render(context)
[Thu Apr 23 21:49:47.850682 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/encodi$
[Thu Apr 23 21:49:47.851014 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] s = six.text_type(s)
[Thu Apr 23 21:49:47.851063 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/functi$
[Thu Apr 23 21:49:47.851538 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return func(*self.__args, **self.__kw)
[Thu Apr 23 21:49:47.851600 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.851879 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return _trans.ugettext(message)
[Thu Apr 23 21:49:47.851963 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.852729 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return do_translate(message, 'ugettext')
[Thu Apr 23 21:49:47.852805 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.852891 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] _default = _default or translation(settings.LANGUAGE_CODE)
[Thu Apr 23 21:49:47.852933 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.852997 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] _translations[language] = DjangoTranslation(language)
[Thu Apr 23 21:49:47.853037 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.853102 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] self._add_installed_apps_translations()
[Thu Apr 23 21:49:47.853143 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.853208 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] "The translation infrastructure cannot be initialized before t$
[Thu Apr 23 21:49:47.853392 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] AppRegistryNotReady: The translation infrastructure cannot be init$
I hope someone can help me what i'm doing wrong