> On 24 Sep 2016, at 5:28 AM, Roger Wayne <[email protected]> wrote: > > I have returned. It seemed like all was working well when I ran into trouble > trying to parse HTML data from my Python script. I just assumed it was maybe > my script or my front-end code that was the problem. In my Python script, I > set the running instance of it on port 8080 and when I tried to connect there > via my web browser, it could not connect. So somehow it is not starting up in > the first place. I assume this maybe has something to do with the > configuration of mod_wsgi, but I could be wrong. > > The part that starts my WSGI application is: > > if __name__ == '__main__': > try: > from wsgiref.simple_server import make_server > httpd = make_server('localhost', 8080, app) > print('Serving on port 8080...') > httpd.serve_forever() > except KeyboardInterrupt: > print('Goodbye.') > > And what I used to load mod_wsgi and my application into the Apache server is: > > LoadModule wsgi_module modules/mod_wsgi.so > WSGIScriptAlias /wsgi "C:/xampp/htdocs/wsgi/app.py" > > <Directory "C:/xampp/htdocs/wsgi"> > Order allow,deny > Allow from all > </Directory> > > I thought all was well but I'm going wrong somewhere I guess. Any help would > be appreciated.
The snippet you provided is not a WSGI application, it is the startup code for a standalone web application which you would run from the command line. That could would not be executed under Apache/mod_wsgi. You can see an example of a WSGI application in the documentation at: * http://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html#wsgi-application-script-file <http://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html#wsgi-application-script-file> Importantly, the WSGI application entry point needs to be called ‘application’ and not ‘app’ as your snippet was using. You would connect with the URL ‘http://localhost' <http://localhost'> from your browser if Apache is running on your own machine. No port number is required as Apache would be listening on the standard port. Once you get that hello world application running, I would very much suggest you go look at using a WSGI framework such as Flask as it will set you down the right path, ensuring you don’t try and do everything form scratch, which with WSGI is hard and a large waste of time when all you want to do is write a web application. You can find Flask at: * http://flask.pocoo.org <http://flask.pocoo.org/> Make sure you get that simple WSGI hello world working first though so you verify your server setup works. Graham -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/d/optout.
