Re: [modwsgi] hello world - object not found

73 views
Skip to first unread message

Joonas Lehtolahti

unread,
Oct 22, 2012, 12:12:37 PM10/22/12
to mod...@googlegroups.com
Hello, my responses inline.

> Hello!
>
> Please give me a hand.
>
> I am trying to do the configuration as described on:
> http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
> I have installed python, mod_wsgi.so is in the modules folder,
> "LoadModule
> wsgi_module modules/mod_wsgi.so" is in the httpd.conf file.
>
> I have added :
> ********************************
> <VirtualHost *:80>
>
> ServerName www.example.com
> ServerAlias example.com
> ServerAdmin webm...@example.com
>
> DocumentRoot /usr/local/www/documents
>
> <Directory /usr/local/www/documents>
> Order allow,deny
> Allow from all
> </Directory>
>
> WSGIScriptAlias /ante /usr/local/www/wsgi-scripts/ante.wsgi
>
> <Directory /usr/local/www/wsgi-scripts>
> Order allow,deny
> Allow from all
> </Directory>
>
> </VirtualHost>
> **********************************
> in .conf file,

Really like that? With www.example.com as the virtualhost?

> and finally: myapp.wsgi as written in the guide is in
> the /usr/local/www/wsgi-scripts/ folder.

Your configuration above is referring to ante.wsgi.

> However, when i do: http://localhost/myapp i get:
> *********************************
> object not found!

Is your virtualhost for localhost or www.example.com? What about ante vs
myapp?

> The requested URL was not found on this server. If you entered the URL
> manually please check your spelling and try again.If you think this is a
> server error, please contact the webmaster.
> Error 404localhost
> 10/22/12 15:17:23
> Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e mod_wsgi/3.4
> Python/3.2.3 PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
> **********************
>
> when i do: http://localhost/usr/local/www/wsgi-scripts/myapp.wsgi
> i get the code on the screen....

That would be if access is allowed everywhere on the system in Apache
config, and you have not specified any specific handler for that path, so
it gets handled as any file.

> Please help me execute the hello world script, pleeease!!!

Please first double check your configuration, since the config you posted
and the tests you listed you did conflict with each other a lot.

And what is particularly interesting is the server signature:
Apache/2.2.21 (Win32). Are you on Windows environment? Then all those
/usr/ paths seem weird in the least as that's typical file hierarchy in
Unix based systems, while Windows uses drive letters...


Regards,

Joonas L.

Chip Munk

unread,
Oct 23, 2012, 3:50:32 AM10/23/12
to mod...@googlegroups.com
On Monday, October 22, 2012 6:12:50 PM UTC+2, Joonas Lehtolahti wrote:

Really like that? With www.example.com as the virtualhost?

yes, but I have changed that now. Here is the new configuration:
*************************************************************************************************************************
WSGIScriptAlias /myapp "D:/Research/09-BuildingARecommender/xampp/htdocs/script/myapp.wsgi

 <Directory "D:/Research/09-BuildingARecommender/xampp/htdocs/script">
 Order allow,deny
 Allow from all
 </Directory>
*************************************************************************************************************************
 
> and finally: myapp.wsgi as written in the guide is in
> the  /usr/local/www/wsgi-scripts/ folder.

Your configuration above is referring to ante.wsgi.

yes, sorry it was a long day, so i messed quite a lot.
I will be more precise now. so the script's name is:  myapp.wsgi
and here is the code:
*************************************************************************************************************************
def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World!'

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)
return [output]
*************************************************************************************************************************
 
> However, when i do: http://localhost/myapp i get:
> *********************************
> object not found!

Is your virtualhost for localhost or www.example.com? What about ante vs  
myapp?

i am not using virtualhost now. Should i?
there is no ante now, only myapp.wsgi. 

 
> when i do: http://localhost/usr/local/www/wsgi-scripts/myapp.wsgi 
> i get the code on the screen....

That would be if access is allowed everywhere on the system in Apache  
config, and you have not specified any specific handler for that path, so  
it gets handled as any file.

ok i see.
 
Please first double check your configuration, since the config you posted   
and the tests you listed you did conflict with each other a lot.

yes, sorry, i have fixed that now (to the best of my knowledge)
 
And what is particularly interesting is the server signature:  
Apache/2.2.21 (Win32). Are you on Windows environment? Then all those  
/usr/ paths seem weird in the least as that's typical file hierarchy in  
Unix based systems, while Windows uses drive letters...

yes, I am on Windows, I have corrected that now

 a few more things:
1) is there anything else I should have added into the configuration file? other than what i have entered above, and the
LoadModule wsgi_module modules/mod_wsgi.so

2) does using windows cause any other issues that are unclear to me at the moment?

thank you both for your help, and sorry for double threads!

Best



Chip Munk

unread,
Oct 23, 2012, 3:52:30 AM10/23/12
to mod...@googlegroups.com
So, here is the current error massage:


Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.

Error 500

localhost
10/23/12 09:40:54
Apache/2.2.21 (Win32) mod_ss



Chip Munk

unread,
Oct 23, 2012, 4:10:17 AM10/23/12
to mod...@googlegroups.com
Ok, I have solved it!

The problem was: TabError: inconsistent use of tabs and spaces in indentation\r
I was dumb enough to c/p the code from the configuration guide.. and i did not fix
the tabs and spaces (since it appeared ok)... 

Anyway, thank you all for your help!

Graham Dumpleton

unread,
Oct 23, 2012, 4:43:21 AM10/23/12
to mod...@googlegroups.com
So did you eventually actually look in the Apache error log file where
it would have given the error message indicating that was the case?

It is the Apache error log where you will see tracebacks and
additional detail to explain what may have caused Apache to serve up a
specific error page.

Graham
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/Ni36_-vzAFEJ.
>
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.

Chip Munk

unread,
Oct 23, 2012, 5:08:39 AM10/23/12
to mod...@googlegroups.com
On Tuesday, October 23, 2012 10:43:23 AM UTC+2, Graham Dumpleton wrote:
So did you eventually actually look in the Apache error log file where
it would have given the error message indicating that was the case?

It is the Apache error log where you will see tracebacks and
additional detail to explain what may have caused Apache to serve up a
specific error page.

Graham

yes I have.

so basically the whole problem was solved by the correct path definitions, and later
by checking the error log.. 

Thanks for all the help!
Reply all
Reply to author
Forward
0 new messages