Re: [modwsgi] Re: Configuring mod_wsgi with Apache

2016-09-23 Thread Roger Wayne
Will do. Thanks for all the help again.

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] Re: Configuring mod_wsgi with Apache

2016-09-23 Thread Graham Dumpleton
How you make web requests depends on the client you are using. Go read those 
posts and you will leant more about how URLs work and how to address your web 
application. You will save your own time and ours by learning about it rather 
than fiddling around trying to make it work by trial and error.

Graham

> On 24 Sep 2016, at 10:06, Roger Wayne  wrote:
> 
> I apologize. Maybe an example would help clarify. For CGI, when using 
> POST/GET requests, you refer to the actual file itself.
> 
> xhttp.open("POST","filename.py",true);
> 
> Is it the same deal with a WSGI application?
> 
> And thanks for the additional resources. When I get the basics running, I 
> will look into it.
> -- 
> 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 modwsgi+unsubscr...@googlegroups.com.
> To post to this group, send email to modwsgi@googlegroups.com.
> Visit this group at https://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] Re: Configuring mod_wsgi with Apache

2016-09-23 Thread Roger Wayne
I apologize. Maybe an example would help clarify. For CGI, when using
POST/GET requests, you refer to the actual file itself.

xhttp.open("POST","filename.py",true);

Is it the same deal with a WSGI application?

And thanks for the additional resources. When I get the basics running, I
will look into it.

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] Re: Configuring mod_wsgi with Apache

2016-09-23 Thread Graham Dumpleton

> On 24 Sep 2016, at 9:56 AM, Roger Wayne  wrote:
> 
> Thank you. I would have never came to that conclusion. If that is the case, 
> would you happen to know when referencing the program, what do I actually 
> refer to? The program itself (the file) or where it is running on your 
> localhost? I mean this in a way towards using POST requests with AJAX in a 
> JavaScript.

Don’t understand what you are asking. You will need to clarify what you are 
wanting to know.

You also might want to go read about how web servers work in general so you 
understand more about using them.

https://ruslanspivak.com/lsbaws-part1/ 
https://ruslanspivak.com/lsbaws-part2/ 
https://ruslanspivak.com/lsbaws-part3/ 

Not saying you should build your own web server, but if you don’t understand 
how they work and about addressing functionality of a web application using 
URLs, it may help.

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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] Re: Configuring mod_wsgi with Apache

2016-09-23 Thread Roger Wayne
Thank you. I would have never came to that conclusion. If that is the case,
would you happen to know when referencing the program, what do I actually
refer to? The program itself (the file) or where it is running on your
localhost? I mean this in a way towards using POST requests with AJAX in a
JavaScript.

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] Re: Configuring mod_wsgi with Apache

2016-09-23 Thread Graham Dumpleton

> On 24 Sep 2016, at 9:31 AM, Roger Wayne  wrote:
> 
> Thanks for the advice, Graham! But I am still a little bit confused though. 
> If you set your application to run on port 8080, shouldn't there be something 
> there when you try to connect to http:localhost:8080? Well at least able to 
> connect to the application running there? I am able to print "Hello World" 
> out jut fine in my main directory but when I try go to port 8080, I can not 
> connect.

The section in the __main__ is not run under mod_wsgi because your script is 
not being run like a main program on the command line. The code is loaded like 
a module. It is then Apache that is accepting requests, on port 80, processes 
the request and then hands it off to a WSGI application by calling the WSGI 
application entrypoint (function or other callable object) called ‘application’ 
in the WSGI script file.

So port 8080 never comes into the picture as it isn’t using the wsgiref web 
server to do anything.

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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


[modwsgi] Re: Configuring mod_wsgi with Apache

2016-09-23 Thread Roger Wayne
Thanks for the advice, Graham! But I am still a little bit confused though. 
If you set your application to run on port 8080, shouldn't there be 
something there when you try to connect to http:localhost:8080? Well at 
least able to connect to the application running there? I am able to print 
"Hello World" out jut fine in my main directory but when I try go to port 
8080, I can not connect.

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] Re: Configuring mod_wsgi with Apache

2016-09-23 Thread Graham Dumpleton

> On 24 Sep 2016, at 5:28 AM, Roger Wayne  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"
> 
> 
> Order allow,deny
> Allow from all
> 
> 
> 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
 


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'  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 

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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


[modwsgi] Re: Configuring mod_wsgi with Apache

2016-09-23 Thread Roger Wayne
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"*

**
*Order allow,deny*
*Allow from all*
**

I thought all was well but I'm going wrong somewhere I guess. Any help 
would be appreciated.

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] mod wsgi versions

2016-09-23 Thread Graham Dumpleton
I meant to use:

http://site1.me 
http://site2.me 

in the browser when making the request, not in ServerName. ServerName should be 
just the hostname.

Are their symlinks in the sites-enabled directory to the files in the 
sites-available directory?

Just because they are in sites-available doesn’t mean Apache will read them. On 
your Linux distro the sites have to be enabled, using s2enable, which results 
in a symlink being put in sites-enabled to same site in sites-available.

Graham

> On 23 Sep 2016, at 10:02 PM, Jaqen Nki  wrote:
> 
> Heres
> 
> /etc/apache2/sites-available$ ls
> 000-default.conf  default-ssl.conf  site1.conf  site2.conf
> 
> 
> config files:
> 
> etchost:
> 
> ##
> # Host Database
> #
> # localhost is used to configure the loopback interface
> # when the system is booting.  Do not change this entry.
> ##
> 127.0.0.1   localhost
> 255.255.255.255 broadcasthost
> ::1 localhost
> 
> 
> 192.168.1.10site1.me http://site1.me 
> 
> 192.168.1.10site2.me http://site2.me 
> 
> 
> 
> 
> 
> ServerName http://site1.me 
> ServerAdmin ad...@mywebsite.com 
> 
> WSGIDaemonProcess site1 
> python-home=/var/www/site1/FlaskApp/FlaskApp/venv
> WSGIProcessGroup site1
> WSGIApplicationGroup %{GLOBAL}
> WSGIScriptAlias / /var/www/site1/FlaskApp/flaskapp.wsgi
> 
> Order allow,deny
> Allow from all
> 
> Alias /static /var/www/site1/FlaskApp/FlaskApp/static
> 
> Order allow,deny
> Allow from all
> 
> ErrorLog /var/www/site1/logs/error.log
> LogLevel warn
> CustomLog /var/www/site1/logs/access.log combined
> 
> 
> 
> 
> ServerName http://site2.me 
> ServerAdmin ad...@mywebsite.com 
> 
> WSGIDaemonProcess site2 
> python-home=/var/www/site2/FlaskApp/FlaskApp/venv
> WSGIProcessGroup site2
> WSGIApplicationGroup %{GLOBAL}
> WSGIScriptAlias / /var/www/site2/FlaskApp/flaskapp.wsgi
> 
> Order allow,deny
> Allow from all
> 
> Alias /static /var/www/site2/FlaskApp/FlaskApp/static
> 
> Order allow,deny
> Allow from all
> 
> ErrorLog /var/www/site2/logs/error.log
> LogLevel warn
> CustomLog /var/www/site2/logs/access.log combined
> 
> 
> 
> cat /etc/apache2/mods-available/wsgi.load
> 
> LoadModule wsgi_module 
> /usr/lib/apache2/modules/mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so
> WSGIRestrictEmbedded On
> 
> Im now getting 500 error at site2.me .  site1 still works.
> 
> 
> 
> 
> On Friday, September 23, 2016 at 4:40:07 AM UTC-7, Graham Dumpleton wrote:
> If you have it with ServerName as I suggest, and there ate /etc/hosts entries 
> mapping the host names to the local system IP, then using:
> 
> http://site1.me 
> http://site2.me 
> 
> should result in them going to the correct VirtualHost and being handled by 
> respective applications.
> 
> If they aren’t it would suggest the VirtualHost’s aren’t being read by Apache.
> 
> What file are they in?
> 
> If you put a syntax error in the VirtualHost definitions, does Apache fail to 
> start.
> 
> Just add a line with:
> 
>
> 
> and it should fail.
> 
> Graham
> 
>> On 23 Sep 2016, at 9:33 PM, Jaqen Nki gmail.com 
>> > wrote:
>> 
>> Hmm I had the DaemonProcess correct just not in the above post, and I 
>> changed the ServerName to site1.me  and site2.me 
>> , the etc/hosts file has them both at 192.168.1.10.  Not 
>> sure if/how to resolve the DNS figured that was automatic.  My network 
>> settings say using DHCP, and I use openDNS.  Would I have to add other DNS 
>> entries for each vhost?
>> 
>> On Friday, September 23, 2016 at 4:11:24 AM UTC-7, Graham Dumpleton wrote:
>> 
>>> On 23 Sep 2016, at 9:07 PM, Jaqen Nki gmail.com 
>>> > wrote:
>>> 
>>> yeah my bad:
>>> 
>>> 
>>> ServerName 192.168.1.10
>>> ServerAlias site1.me 
>> 
>> Only use:
>> 
>> ServerName site1.me 
>> 
>> Don’t use ServerAlias and don’t use the IP.
>> 
>>> ServerAdmin ad...@ <>mywebsite. com 
>>> 
>>> 
>>>