You need to go learn about what WSGI is. Start with: http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
for getting something simple working, but then also look through: http://webpython.codepoint.net/wsgi_tutorial Overall though, you would be much better off using a Python framework that starting from scratch as the frameworks do lots of stuff for you that you are likely to get wrong. Go look at Flask. http://flask.pocoo.org/ Just use Flask's inbuilt development server while you learn. You do not need to use mod_wsgi if you are only getting started in Python web programming. You only need that when going to proper production deployment. Graham On 30 June 2011 10:28, coolesting <[email protected]> wrote: > My index.wsgi file content , > > #!/usr/bin/python > # Filename: hello > > '''my first app about the python .''' > > print "Testing successful !" > > > 2011/6/30 coolesting <[email protected]> >> >> Yes, i did as you said, but i got another question , >> >> [Thu Jun 30 08:23:04 2011] [error] Testing successful ! >> [Thu Jun 30 08:23:04 2011] [error] [client 127.0.1.1] mod_wsgi (pid=3075): >> Target WSGI script '/var/www/index.wsgi' does not contain WSGI application >> 'application'. >> >> >> >> >> 2011/6/30 Graham Dumpleton <[email protected]> >>> >>> I already said that this is covered in the documentation: >>> >>> >>> http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Writing_To_Standard_Output >>> >>> Also read: >>> >>> >>> http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output.html >>> >>> Do what the documentation says, setting: >>> >>> WSGIRestrictStdout Off >>> >>> in Apache configuration. >>> >>> Graham >>> >>> On 30 June 2011 10:06, coolesting <[email protected]> wrote: >>> > Thanks Graham. >>> > I disabled the mod_python, then got this log as following , >>> > i think the wsgi that is out of date >>> > >>> > [Thu Jun 30 07:52:27 2011] [warn] mod_wsgi: Compiled for Python/2.6.2. >>> > [Thu Jun 30 07:52:27 2011] [warn] mod_wsgi: Runtime using Python/2.6.4. >>> > [Thu Jun 30 07:52:27 2011] [warn] mod_wsgi: Python module path >>> > >>> > '/usr/lib/python2.6/:/usr/lib/python2.6/plat-linux2:/usr/lib/python2.6/lib-tk:/usr/lib/python2.6/lib-old:/usr/lib/python2.6/lib-dynload'. >>> > [Thu Jun 30 07:52:27 2011] [notice] Apache/2.2.12 (Ubuntu) DAV/2 >>> > SVN/1.6.5 >>> > PHP/5.2.10-2ubuntu6.10 with Suhosin-Patch mod_ruby/1.2.6 >>> > Ruby/1.8.7(2009-06-12) mod_wsgi/2.5 Python/2.6.4 configured -- resuming >>> > normal operations >>> > [Thu Jun 30 07:57:40 2011] [error] [client 127.0.1.1] mod_wsgi >>> > (pid=1613): >>> > Target WSGI script '/var/www/index.wsgi' cannot be loaded as Python >>> > module. >>> > [Thu Jun 30 07:57:40 2011] [error] [client 127.0.1.1] mod_wsgi >>> > (pid=1613): >>> > Exception occurred processing WSGI script '/var/www/index.wsgi'. >>> > [Thu Jun 30 07:57:40 2011] [error] [client 127.0.1.1] Traceback (most >>> > recent >>> > call last): >>> > [Thu Jun 30 07:57:40 2011] [error] [client 127.0.1.1] File >>> > "/var/www/index.wsgi", line 6, in <module> >>> > [Thu Jun 30 07:57:40 2011] [error] [client 127.0.1.1] print "good" >>> > [Thu Jun 30 07:57:40 2011] [error] [client 127.0.1.1] IOError: >>> > sys.stdout >>> > access restricted by mod_wsgi >>> > [Thu Jun 30 07:57:40 2011] [error] [client 127.0.1.1] File does not >>> > exist: >>> > /var/www/favicon.ico >>> > [Thu Jun 30 07:57:43 2011] [error] [client 127.0.1.1] File does not >>> > exist: >>> > /var/www/favicon.ico >>> > >>> > >>> > >>> > >>> > >>> > 2011/6/30 Graham Dumpleton <[email protected]> >>> >> >>> >> I some what doubt you are using Python 3.1 as mod_python doesn't work >>> >> with Python 3.X and loading mod_python compiled for Python 2.X and >>> >> mod_wsgi compiled for Python 3.X at same time would likely cause a >>> >> crash at startup. >>> >> >>> >> If you are not using mod_python you should really disable it. >>> >> >>> >> Graham >>> >> >>> >> On 30 June 2011 02:05, coolesting <[email protected]> wrote: >>> >> > I still installed the mod_python, >>> >> > and my python is 3.1 version >>> >> > >>> >> > On Jun 29, 11:48 pm, coolesting <[email protected]> wrote: >>> >> >> My log on apache >>> >> >> >>> >> >> [Wed Jun 29 23:42:02 2011] [error] [client 127.0.1.1] mod_wsgi >>> >> >> (pid=2187): Target WSGI script '/var/www/index.wsgi' cannot be >>> >> >> loaded >>> >> >> as Python module. >>> >> >> [Wed Jun 29 23:42:02 2011] [error] [client 127.0.1.1] mod_wsgi >>> >> >> (pid=2187): Exception occurred processing WSGI script '/var/www/ >>> >> >> index.wsgi'. >>> >> >> [Wed Jun 29 23:42:02 2011] [error] [client 127.0.1.1] Traceback >>> >> >> (most >>> >> >> recent call last): >>> >> >> [Wed Jun 29 23:42:02 2011] [error] [client 127.0.1.1] File >>> >> >> "/var/www/ >>> >> >> index.wsgi", line 6, in <module> >>> >> >> [Wed Jun 29 23:42:02 2011] [error] [client 127.0.1.1] print >>> >> >> "good" >>> >> >> [Wed Jun 29 23:42:02 2011] [error] [client 127.0.1.1] IOError: >>> >> >> sys.stdout access restricted by mod_wsgi >>> >> >> [Wed Jun 29 23:42:05 2011] [error] [client 127.0.1.1] File does not >>> >> >> exist: /var/www/favicon.ico >>> >> >> >>> >> >> and my configuration file, wsgi.conf >>> >> >> >>> >> >> <IfModule mod_wsgi.c> >>> >> >> AddType text/html .py >>> >> >> AddHandler wsgi- >>> >> >> script .wsgi >>> >> >> >>> >> >> <Directory "/var/www"> >>> >> >> Order allow,deny >>> >> >> Allow from all >>> >> >> </Directory> >>> >> >> <IfModule> >>> >> >> >>> >> >> and wsgi.load file >>> >> >> LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so >>> >> >> >>> >> >> Anybody know what is wrong with my installation problem ? >>> >> >> thanks for all of help >>> >> > >>> >> > -- >>> >> > You received this message because you are subscribed to the Google >>> >> > Groups "modwsgi" group. >>> >> > To post to this group, send email to [email protected]. >>> >> > To unsubscribe from this group, send email to >>> >> > [email protected]. >>> >> > For more options, visit this group at >>> >> > http://groups.google.com/group/modwsgi?hl=en. >>> >> > >>> >> > >>> >> >>> >> -- >>> >> You received this message because you are subscribed to the Google >>> >> Groups >>> >> "modwsgi" group. >>> >> To post to this group, send email to [email protected]. >>> >> To unsubscribe from this group, send email to >>> >> [email protected]. >>> >> For more options, visit this group at >>> >> http://groups.google.com/group/modwsgi?hl=en. >>> >> >>> > >>> > -- >>> > You received this message because you are subscribed to the Google >>> > Groups >>> > "modwsgi" group. >>> > To post to this group, send email to [email protected]. >>> > To unsubscribe from this group, send email to >>> > [email protected]. >>> > For more options, visit this group at >>> > http://groups.google.com/group/modwsgi?hl=en. >>> > >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "modwsgi" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/modwsgi?hl=en. >>> >> > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
