Thank you for your guide in troubleshooting. After enabling DEBUG in
django, I found out that the cause of this issue is in falsely configured
TEMPLATES_DIR. So it's comming from django. I have since fixed the issue.
As a first time developer, I am really thankful for your help and your
guidance in configuring apache.
On Saturday, 24 October 2020 at 04:04:59 UTC+2 Graham Dumpleton wrote:
> You need to work out, or indicate whether the 500 error is from Apache or
> Django.
>
> Use:
>
> LogLevel info
>
> not "warn", so you can see whether mod_wsgi is even loading your WSGI
> script file or whether you issue is with your Apache configuration.
>
> If it is loading the Django application, then temporarily enable DEBUG in
> Django settings file so that Django reports the error in the browser. This
> is necessary as Django will not log errors to the log unless you have set
> up Django logging to do that.
>
> If you believe the Apache configuration is fine, replace the WSGI script
> file with a WSGI hello world application instead of Django to see if you
> get a response from that.
>
> def application(environ, start_response):
> status = '200 OK'
> output = b'Hello World!'
>
> response_headers = [('Content-type', 'text/plain'),
> ('Content-Length', str(len(output)))]
> start_response(status, response_headers)
>
> return [output]
>
>
> Finally, you also are putting the config in Apache config in the wrong
> place.
>
> The LoadModule line should go after other LoadModule lines.
>
> The mod_wsgi configuration directives would then usually go at the end of
> the configuration, or inside the VirtualHost the need to apply to if one is
> defined. I am actually surprised that Apache even starts with where you
> have put the configuration.
>
> Graham
>
> On 24 Oct 2020, at 12:41 pm, Olaf Yang <[email protected]> wrote:
>
>
> I am trying to get a django app to run on amazon linux 2. After installing
> apache server by yum and compiling mod_wsgi from source. I configured
> mod_wsgi according to the quick installation guide
> <https://modwsgi.readthedocs.io/en/develop/user-guides/quick-installation-guide.html>on
>
> the documentation. I've also followed this guide from django
> <https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/modwsgi/>.
> There is also a " Apache/2.4.46 () mod_wsgi/4.7.1 Python/3.9 configured
> -- resuming normal operations" entry in error_log. However, every time I
> visit the ip address it gives me a "Server Error(500)". There are no other
> significant entries in error_log to indicate the issue.
>
> I will post my apache server configuration bellow:
> I have only added from line 33 to 55
>
> https://pastebin.com/N7pvEvzx
>
> the / switchsnap .net/ is my project root (where manage.py is) and wsgi.py
> is stored in switchsnap .net/switchsnap
>
> I wish someone can help me pin down the issue.
> Thanks in advance.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/modwsgi/666fe9af-16ff-4815-8e83-72996bf6190bn%40googlegroups.com
>
> <https://groups.google.com/d/msgid/modwsgi/666fe9af-16ff-4815-8e83-72996bf6190bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/modwsgi/c540eb53-0bf4-40c0-935a-b1514a13d7a2n%40googlegroups.com.