Discussion:
[modwsgi] mod_wsgi compiles but can not get test script to run
Chris Reedy
2016-07-05 22:11:19 UTC
Permalink
I followed the instructions to compile python from source and then mod_wsgi
and both of those succeeded. And I read over the troubleshooting in
http://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html
and the QuickConfiguration Guide here:
https://code.google.com/archive/p/modwsgi/wikis/QuickConfigurationGuide.wiki.
However, I still get mod_wsgi to work. Below, are the things that I have
done to configure the module after compiling it:

On the WHM, I added mod_wsgi to my pre virtualhost include. Using the
following lines:

LoadModule wsgi_module /usr/lib64/apache2/modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
LogLevel info wsgi_module:info

The process succeeded and then I restarted the server. When I type
apachectl -t -D DUMP_MODULES, I can see that wsgi_module (shared) appears.

I added the following lines to my httpd.conf file following the process for
userdata includes and it passed without any errors:


WSGIScriptAlias /myapp /home/chris/public_html/wsgi-scripts/myapp.wsgi


<Directory /home/chris/public_html/wsgi-scripts>

Require all granted

</Directory>


I added the following into the myapp.wsgi file and placed it in:
/home/chris/public_html/wsgi-scripts/myapp.wsgi:


def application(environ, start_response):

status = '200 OK'

output = 'Hello World!'

response_headers = [('Content-type', 'text/plan'),
('Content-Length', str(len(output)))]

start_response(status, response_headers)

return [output]

When I go to http://roventure.com/myapp, I get a: This Site Can't Be
Reached error. roventure.com’s server DNS address could not be found.

However, this is not an issue of the DNS settings. I put an index.html
test file at /home/chris/public_html/ so that if you go to:
http://roventure.com/ you will see: Happy 4th of July.

I can't figure out why this is not working. Any help would be greatly
appreciated!

Best,

Chris

The following are the versions that I am running:
OS: CentOS 6.8

Apache Version: 2.4.20 (cPanel)

mod_wsgi: 4.5.3

Python: 3.5.2

WHM: 56.0 (Build 24)
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.
Graham Dumpleton
2016-07-06 00:19:47 UTC
Permalink
Try:

www.roventure.com <http://www.roventure.com/>

It is uncommon, especially on hosted service, for roventure.com <http://roventure.com/> to resolve.

$ nslookup roventure.com
Server: 192.168.0.1
Address: 192.168.0.1#53

Non-authoritative answer:
*** Can't find roventure.com: No answer

$ nslookup www.roventure.com
Server: 192.168.0.1
Address: 192.168.0.1#53

Non-authoritative answer:
Name: www.roventure.com
Address: 104.31.83.7
Name: www.roventure.com
Address: 104.31.82.7

When using correct host and URL:

http://www.roventure.com/myapp <http://www.roventure.com/myapp>

I see a 500 error.

Try that and then see Apache error logs as to reason.

Graham
Post by Chris Reedy
LoadModule wsgi_module /usr/lib64/apache2/modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
LogLevel info wsgi_module:info
The process succeeded and then I restarted the server. When I type apachectl -t -D DUMP_MODULES, I can see that wsgi_module (shared) appears.
WSGIScriptAlias /myapp /home/chris/public_html/wsgi-scripts/myapp.wsgi
<Directory /home/chris/public_html/wsgi-scripts>
Require all granted
</Directory>
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plan'), ('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
When I go to http://roventure.com/myapp, I get a: This Site Can't Be Reached error. roventure.com’s server DNS address could not be found.
However, this is not an issue of the DNS settings. I put an index.html test file at /home/chris/public_html/ so that if you go to: http://roventure.com/ you will see: Happy 4th of July.
I can't figure out why this is not working. Any help would be greatly appreciated!
Best,
Chris
OS: CentOS 6.8
Apache Version: 2.4.20 (cPanel)
mod_wsgi: 4.5.3
Python: 3.5.2
WHM: 56.0 (Build 24)
--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
Visit this group at https://groups.google.com/group/modwsgi <https://groups.google.com/group/modwsgi>.
For more options, visit https://groups.google.com/d/optout <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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.
Chris Reedy
2016-07-06 03:10:38 UTC
Permalink
Thanks Graham. That did give me some more information but it still is not
clear why the wsgi script is failing. Does this mean anything to you? I
tried a number of things with the script but can't get it to output what
type of Exception occurred so that I can figure out how to resolve it or
what line resulted in the Exception:

[Tue Jul 05 20:07:29.760429 2016] [core:info] [pid 22095] [client
198.89.121.156:38166] AH00128: File does not exist:
/home/chris/public_html/500.shtml
[Tue Jul 05 20:07:29.760173 2016] [wsgi:error] [pid 22095] [client
198.89.121.156:38166] mod_wsgi (pid=22095): Exception occurred processing
WSGI script '/home/chris/public_html/wsgi-scripts/myapp.wsgi'.
[Tue Jul 05 20:07:29.759813 2016] [wsgi:info] [pid 22095] [client
198.89.121.156:38166] mod_wsgi (pid=22095, process='',
application='roventure.com|/myapp'): Loading WSGI script
'/home/chris/public_html/wsgi-scripts/myapp.wsgi'

Thanks again for all of your help,

Chris
Post by Graham Dumpleton
www.roventure.com
It is uncommon, especially on hosted service, for roventure.com to
resolve.
$ nslookup roventure.com
Server: 192.168.0.1
Address: 192.168.0.1#53
*** Can't find roventure.com: No answer
$ nslookup www.roventure.com
Server: 192.168.0.1
Address: 192.168.0.1#53
Name: www.roventure.com
Address: 104.31.83.7
Name: www.roventure.com
Address: 104.31.82.7
http://www.roventure.com/myapp
I see a 500 error.
Try that and then see Apache error logs as to reason.
Graham
I followed the instructions to compile python from source and then
mod_wsgi and both of those succeeded. And I read over the troubleshooting
in
http://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html
https://code.google.com/archive/p/modwsgi/wikis/QuickConfigurationGuide.wiki.
However, I still get mod_wsgi to work. Below, are the things that I have
LoadModule wsgi_module /usr/lib64/apache2/modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
LogLevel info wsgi_module:info
The process succeeded and then I restarted the server. When I type
apachectl -t -D DUMP_MODULES, I can see that wsgi_module (shared) appears.
I added the following lines to my httpd.conf file following the process
WSGIScriptAlias /myapp /home/chris/public_html/wsgi-scripts/myapp.wsgi
<Directory /home/chris/public_html/wsgi-scripts>
Require all granted
</Directory>
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plan'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
When I go to http://roventure.com/myapp, I get a: This Site Can't Be
Reached error. roventure.com’s server DNS address could not be found.
However, this is not an issue of the DNS settings. I put an index.html
http://roventure.com/ you will see: Happy 4th of July.
I can't figure out why this is not working. Any help would be greatly appreciated!
Best,
Chris
OS: CentOS 6.8
Apache Version: 2.4.20 (cPanel)
mod_wsgi: 4.5.3
Python: 3.5.2
WHM: 56.0 (Build 24)
--
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
.
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.
Graham Dumpleton
2016-07-06 07:30:19 UTC
Permalink
When you get an exception loading the WSGI script there should be a Python exception logged after what you provided. What else is in the Apache error log file?

The error about file does not exist is because you have extended error documents enabled in Apache but don't actually have the files for that. You need to disable extended error documents.

So you have two separate issues.

Graham
[Tue Jul 05 20:07:29.760429 2016] [core:info] [pid 22095] [client 198.89.121.156:38166] AH00128: File does not exist: /home/chris/public_html/500.shtml
[Tue Jul 05 20:07:29.760173 2016] [wsgi:error] [pid 22095] [client 198.89.121.156:38166] mod_wsgi (pid=22095): Exception occurred processing WSGI script '/home/chris/public_html/wsgi-scripts/myapp.wsgi'.
[Tue Jul 05 20:07:29.759813 2016] [wsgi:info] [pid 22095] [client 198.89.121.156:38166] mod_wsgi (pid=22095, process='', application='roventure.com|/myapp'): Loading WSGI script '/home/chris/public_html/wsgi-scripts/myapp.wsgi'
Thanks again for all of your help,
Chris
Post by Graham Dumpleton
www.roventure.com
It is uncommon, especially on hosted service, for roventure.com to resolve.
$ nslookup roventure.com
Server: 192.168.0.1
Address: 192.168.0.1#53
*** Can't find roventure.com: No answer
$ nslookup www.roventure.com
Server: 192.168.0.1
Address: 192.168.0.1#53
Name: www.roventure.com
Address: 104.31.83.7
Name: www.roventure.com
Address: 104.31.82.7
http://www.roventure.com/myapp
I see a 500 error.
Try that and then see Apache error logs as to reason.
Graham
Post by Chris Reedy
LoadModule wsgi_module /usr/lib64/apache2/modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
LogLevel info wsgi_module:info
The process succeeded and then I restarted the server. When I type apachectl -t -D DUMP_MODULES, I can see that wsgi_module (shared) appears.
WSGIScriptAlias /myapp /home/chris/public_html/wsgi-scripts/myapp.wsgi
<Directory /home/chris/public_html/wsgi-scripts>
Require all granted
</Directory>
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plan'), ('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
When I go to http://roventure.com/myapp, I get a: This Site Can't Be Reached error. roventure.com’s server DNS address could not be found.
However, this is not an issue of the DNS settings. I put an index.html test file at /home/chris/public_html/ so that if you go to: http://roventure.com/ you will see: Happy 4th of July.
I can't figure out why this is not working. Any help would be greatly appreciated!
Best,
Chris
OS: CentOS 6.8
Apache Version: 2.4.20 (cPanel)
mod_wsgi: 4.5.3
Python: 3.5.2
WHM: 56.0 (Build 24)
--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
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.
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.
Chris Reedy
2016-07-06 07:38:55 UTC
Permalink
Graham,

As an update, I was finally able to get the Hello World test script to run.
The issue was mutli-fold and including it here in case someone else has
this issue. I was able to look at the detailed log file at
/usr/local/apache/logs/error_log and saw an error that indicated that I had
to display my output as bytes rather than str. I simply changed this line
in my wsgi.py script: output = 'Hello World!' to output = b'Hello World!'
and it worked like a charm.

Now, I am working on step 2 of actually getting Django to work with a
damoen process. I had almost the exact same issue as this person:
https://groups.google.com/forum/#!topic/modwsgi/CYW0YotOAN4.

I am now having trouble with sass compiling and giving me an error Invalid
US-ASCII character "\xE2" but that is probably outside the scope of this
support thread. I am hoping that after I fix the SASS error, everything
will work great.

Thanks again,

Chris
Post by Chris Reedy
Thanks Graham. That did give me some more information but it still is not
clear why the wsgi script is failing. Does this mean anything to you? I
tried a number of things with the script but can't get it to output what
type of Exception occurred so that I can figure out how to resolve it or
[Tue Jul 05 20:07:29.760429 2016] [core:info] [pid 22095] [client
/home/chris/public_html/500.shtml
[Tue Jul 05 20:07:29.760173 2016] [wsgi:error] [pid 22095] [client
198.89.121.156:38166] mod_wsgi (pid=22095): Exception occurred processing
WSGI script '/home/chris/public_html/wsgi-scripts/myapp.wsgi'.
[Tue Jul 05 20:07:29.759813 2016] [wsgi:info] [pid 22095] [client
198.89.121.156:38166] mod_wsgi (pid=22095, process='', application='
roventure.com|/myapp'): Loading WSGI script
'/home/chris/public_html/wsgi-scripts/myapp.wsgi'
Thanks again for all of your help,
Chris
Post by Graham Dumpleton
www.roventure.com
It is uncommon, especially on hosted service, for roventure.com to
resolve.
$ nslookup roventure.com
Server: 192.168.0.1
Address: 192.168.0.1#53
*** Can't find roventure.com: No answer
$ nslookup www.roventure.com
Server: 192.168.0.1
Address: 192.168.0.1#53
Name: www.roventure.com
Address: 104.31.83.7
Name: www.roventure.com
Address: 104.31.82.7
http://www.roventure.com/myapp
I see a 500 error.
Try that and then see Apache error logs as to reason.
Graham
I followed the instructions to compile python from source and then
mod_wsgi and both of those succeeded. And I read over the troubleshooting
in
http://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html
https://code.google.com/archive/p/modwsgi/wikis/QuickConfigurationGuide.wiki.
However, I still get mod_wsgi to work. Below, are the things that I have
LoadModule wsgi_module /usr/lib64/apache2/modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
LogLevel info wsgi_module:info
The process succeeded and then I restarted the server. When I type
apachectl -t -D DUMP_MODULES, I can see that wsgi_module (shared) appears.
I added the following lines to my httpd.conf file following the process
WSGIScriptAlias /myapp /home/chris/public_html/wsgi-scripts/myapp.wsgi
<Directory /home/chris/public_html/wsgi-scripts>
Require all granted
</Directory>
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plan'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
When I go to http://roventure.com/myapp, I get a: This Site Can't Be
Reached error. roventure.com’s server DNS address could not be found.
However, this is not an issue of the DNS settings. I put an index.html
http://roventure.com/ you will see: Happy 4th of July.
I can't figure out why this is not working. Any help would be greatly appreciated!
Best,
Chris
OS: CentOS 6.8
Apache Version: 2.4.20 (cPanel)
mod_wsgi: 4.5.3
Python: 3.5.2
WHM: 56.0 (Build 24)
--
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
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.
Graham Dumpleton
2016-07-06 07:48:42 UTC
Permalink
In daemon mode set the options lang and locale to a UTF8 encoding.

I can't easily look up details exactly right now, but if search:

site:blog.dscpl.com.au lang locale

on Google you hopefully will find my blog post about encoding issues.

Graham
Post by Chris Reedy
Graham,
As an update, I was finally able to get the Hello World test script to run. The issue was mutli-fold and including it here in case someone else has this issue. I was able to look at the detailed log file at /usr/local/apache/logs/error_log and saw an error that indicated that I had to display my output as bytes rather than str. I simply changed this line in my wsgi.py script: output = 'Hello World!' to output = b'Hello World!' and it worked like a charm.
Now, I am working on step 2 of actually getting Django to work with a damoen process. I had almost the exact same issue as this person: https://groups.google.com/forum/#!topic/modwsgi/CYW0YotOAN4.
I am now having trouble with sass compiling and giving me an error Invalid US-ASCII character "\xE2" but that is probably outside the scope of this support thread. I am hoping that after I fix the SASS error, everything will work great.
Thanks again,
Chris
[Tue Jul 05 20:07:29.760429 2016] [core:info] [pid 22095] [client 198.89.121.156:38166] AH00128: File does not exist: /home/chris/public_html/500.shtml
[Tue Jul 05 20:07:29.760173 2016] [wsgi:error] [pid 22095] [client 198.89.121.156:38166] mod_wsgi (pid=22095): Exception occurred processing WSGI script '/home/chris/public_html/wsgi-scripts/myapp.wsgi'.
[Tue Jul 05 20:07:29.759813 2016] [wsgi:info] [pid 22095] [client 198.89.121.156:38166] mod_wsgi (pid=22095, process='', application='roventure.com|/myapp'): Loading WSGI script '/home/chris/public_html/wsgi-scripts/myapp.wsgi'
Thanks again for all of your help,
Chris
Post by Graham Dumpleton
www.roventure.com
It is uncommon, especially on hosted service, for roventure.com to resolve.
$ nslookup roventure.com
Server: 192.168.0.1
Address: 192.168.0.1#53
*** Can't find roventure.com: No answer
$ nslookup www.roventure.com
Server: 192.168.0.1
Address: 192.168.0.1#53
Name: www.roventure.com
Address: 104.31.83.7
Name: www.roventure.com
Address: 104.31.82.7
http://www.roventure.com/myapp
I see a 500 error.
Try that and then see Apache error logs as to reason.
Graham
Post by Chris Reedy
LoadModule wsgi_module /usr/lib64/apache2/modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
LogLevel info wsgi_module:info
The process succeeded and then I restarted the server. When I type apachectl -t -D DUMP_MODULES, I can see that wsgi_module (shared) appears.
WSGIScriptAlias /myapp /home/chris/public_html/wsgi-scripts/myapp.wsgi
<Directory /home/chris/public_html/wsgi-scripts>
Require all granted
</Directory>
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plan'), ('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
When I go to http://roventure.com/myapp, I get a: This Site Can't Be Reached error. roventure.com’s server DNS address could not be found.
However, this is not an issue of the DNS settings. I put an index.html test file at /home/chris/public_html/ so that if you go to: http://roventure.com/ you will see: Happy 4th of July.
I can't figure out why this is not working. Any help would be greatly appreciated!
Best,
Chris
OS: CentOS 6.8
Apache Version: 2.4.20 (cPanel)
mod_wsgi: 4.5.3
Python: 3.5.2
WHM: 56.0 (Build 24)
--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
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.
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.
Loading...