Saturday, February 19, 2022

[SOLVED] Internal Server Error Django/apache

Issue

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: href="https://i.stack.imgur.com/FRlUG.png" rel="nofollow noreferrer">enter image description here 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?


Solution

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.



Answered By - Deluq
Answer Checked By - Katrina (WPSolving Volunteer)