I get an internal 500 error trying to get Apache to serve my static files.
The application will be locally hosted (not facing WWW). There will be no DNS to resolve the name "www.domain.com". I want to have access to the application by entering the IP address of the server when I am on this network.
This is my httpd.conf file (I am on RHEL):
<Directory /var/www/testapp> Order allow,deny Allow from all </Directory> WSGIScriptAlias / /var/www/testapp/service.wsgi
If I changed WSGIScriptAlias ββto WGSIScriptAlias /test /var/www/testapp/service.wsgi , then I can view my static files when entering IP, but I still canβt access the service.py script from [IP ] / test.
In any case, I want to be able to serve all GET / POST requests using service.py script, so I want my alias to start with / , and not elsewhere.
All my static files are in / var / www / html (Apache automatically displayed these files before I messed up with httpd.conf, now I just get 500).
This is my service.wsgi:
import sys sys.path.insert(0, '/var/www/testapp') from service import app as application
This is my service.py:
from flask import Flask app = Flask(__name__) @app.route("/") def hello(environ, start_response): status = '200 OK' output = "Hello" response_headers = [('Content-type', 'text/plain'), ('Content-length', str(len(output)))] start_response(status, response_headers) return output if __name__=='__main__' app.run()
Do I need to store my .wsgi files in the / var / www / html directory? Or can they go to another folder? I see that there may be a conflict between the message that I send to the server ("Hello") and the static files that are already in the / var / www / html / directory. So I tried setting the alias to /test , but that didn't work either.
I just want my Flask application to serve GET / POST requests and require apache to serve all static files.