On Jan 31, 4:46 am, PF4Pylons <ultimulunic...@gmail.com> wrote: > Hi guys > > Here is what I have manged to get working: > > =========HelloWorld.fcgi====working, OK==================== > > #!$HOME/html/Others/PVE/bin/python > import sys > sys.path.insert(0, '$HOME/html/Others/PVE/lib/python2.5')
You cannot use '$HOME' in Python variable strings like that. List the path explicitly. > def myapp(environ, start_response): > start_response('200 OK', [('Content-Type', 'text/plain')]) > return ['Hello World!\n'] > > if __name__ == '__main__': > from flup.server.fcgi import WSGIServer > WSGIServer(myapp).run() If this work when you had $HOME above, they must already have flup installed. > ====================================================== > > =========HelloWorld.cgi====working, OK===================== > > #!$HOME/Others/PVE/bin/python > > import sys > from paste.deploy import loadapp > import wsgiref.handlers > > sys.path = ['$HOME/html/Others/HelloWorld'] + sys.path > wsgi_app = loadapp('config:$HOME/html/Others/HelloWorld/ > development.ini') > wsgiref.handlers.CGIHandler().run(wsgi_app) > ====================================================== > > =========MyApp.cgi====working, with errors, see > below===================== > > #!$HOME/html/Others/PVE/bin/python > > import sys > from paste.deploy import loadapp > import wsgiref.handlers > #os.chdir("$HOME/html/Others/Anki/MyAppweb") > sys.path = ['$HOME/html/Others/PVE/lib/'] + sys.path > sys.path = ['$HOME/html/Others/MyApp/MyAppweb'] + sys.path > > sys.path.insert(0, "$HOME/html/Others/MyApp/libMyApp") > wsgi_app = loadapp('config:$HOME/html/Others/MyApp/MyAppweb/ > production.ini') > wsgiref.handlers.CGIHandler().run(wsgi_app) > > ====================================================== > Sat Jan 30 09:29:06 2010] [error] [client 121.1.1.1] File does not > exist: $HOME/html/css/app.css > [Sat Jan 30 09:29:06 2010] [error] [client 121.1.1.1] File does not > exist: $HOME/html/study/getCSS > [Sat Jan 30 09:29:06 2010] [error] [client 121.1.1.1] File does not > exist: $HOME/html/js/other/jquery-1.2.6.min.js > [Sat Jan 30 09:29:06 2010] [error] [client 121.1.1.1] File does not > exist: $HOME/html/js/other/jquery.hotkeys-0.7.8-packed.js > [Sat Jan 30 09:29:06 2010] [error] [client 121.1.1.1] File does not > exist: $HOME/html/js/other/MochiKit/MochiKit.js > [Sat Jan 30 09:29:06 2010] [error] [client 121.1.1.1] File does not > exist: $HOME/html/js/other/MochiKit/MochiKit.js > [Sat Jan 30 09:29:07 2010] [error] [client 121.1.1.1] File does not > exist: $HOME/html/activity.gif > > These files are all rooted in the public folder of the application. > How can I fix this please? > > However the my application is slow, so is the HelloWorld aplication > athough this one has no errors in the log. > I believe this is because of the cgi approach. > > ==============Myapp.fcgi ==Lightning fast===BUT WITH ERRORS see > below===== > > #!/home/content/c/r/i/cristip/html/Others/PVE/bin/python > import os, sys > sys.path = ['$HOME/html/Others/PVE/lib/'] + sys.path > sys.path = ['$HOME/html/Others/MyApp/MyAppweb'] + sys.path > sys.path.insert(0, "$HOME/html/Others/MyApp/libMyApp") > > from paste.deploy import loadapp > wsgi_app = loadapp('config:$HOME/html/Others/MyApp/MyAppweb/ > development.ini') > > # Deploy it using FastCGI > if __name__ == '__main__': > from flup.server.fcgi import WSGIServer > WSGIServer(wsgi_app).run() > > ====================The problems that I have with FCGI================ > > On top of the errors listed above (the app is not able to find > javascript files, css files and gif files I also have > the following problem: > > The address of the application is: > > http://www.mydomain.com/cgi/MyApp.fcgi/ (doesn't work without "/" at > the end, I found that out accidentally) You need some mod_rewrite magic, but they have to have allowed .htaccess file usage and required overrides to allow you to use mod_rewrite directives. Do you have that access? Graham > The application has some menus which are all pointed to a shortest > path, see below: > > "Login" should be > > http://www.mydomain.com/cgi/MyApp.fcgi/account/login > > but the application is pointing to > > http://www.mydomain.com/cgi/account/login > > ans so on. As you can see MyApp.fcgi seems to be eliminated > automatically and I believe that is because the application > was not designed to work this way. How can I fix this? > > Thank you all > PF > > On Jan 28, 11:28 pm, Graham Dumpleton <graham.dumple...@gmail.com> > wrote: > > > > > On Jan 29, 2:02 pm, PF4Pylons <ultimulunic...@gmail.com> wrote: > > > > The provider is Godaddy > > > Here is all they say about fastcgi in their help section > > > >http://help.godaddy.com/search?q=fastcgi&x=0&y=0 > > > > Quite cryptic sometimes. > > > > I will get back to this after I configure the HelloWorld app. > > > I did mention the provider in the other thread I started here, I had > > > the impression you replied there too. > > > > I will also update that thread, I have made some progress there but I > > > run into an other roadblock. > > > Under their Perl FAQ entry they say: > > > """NOTE: This will need to be done in any directory outside of /cgi in > > which you want to run .fcgi scripts.""" > > > So, they mention .fcgi files. > > > It would be quite silly if they were using .fcgi files and the only > > thing you can stick in it is Perl. If that were the case they should > > have used a specific Perl extension. > > > As such, it looks a good bet that if you can get flup installed into > > your account and can set up sys.path to reference where flup is, it > > may work. > > > Thus, install flup under lib/python in your home directory. Presuming > > your home directory is '/home/pf4pylons', then use following in file > > called 'hello.fcgi'. > > > #!/usr/bin/env python > > > import sys > > sys.path.insert(0, '/home/pf4pylons/lib/python') > > > def myapp(environ, start_response): > > start_response('200 OK', [('Content-Type', 'text/plain')]) > > return ['Hello World!\n'] > > > if __name__ == '__main__': > > from flup.server.fcgi import WSGIServer > > WSGIServer(myapp).run() > > > Get that going and then you can work out getting Pylons installed as > > well. > > > Graham > > > > Thanks > > > PF > > > > On Jan 28, 9:57 pm, PF4Pylons <ultimulunic...@gmail.com> wrote: > > > > > 010/1/29 PF4Pylons <ultimulunic...@gmail.com>: > > > > > > Hi Graham > > > > > > According with the > > > > > documentationhttp://www.fastcgi.com/docs/faq.html#typical_httpd.conf > > > > > they can configure some specific file extensions only to be executed > > > > > via the fastcgi module. > > > > > >http://www.fastcgi.com/docs/faq.html#typical_httpd.conf > > > > > No, as I understand the configuration in that specific section, that > > > > does not restrict it to a specific language. This is because that > > > > configuration would rely on the #! line in the .fcgi file to know what > > > > interpreter to run. > > > > > If you look down further at the PHP example however, that does > > > > restrict the language. This is because for .php it has been configured > > > > to execute a wrapper or helper script instead of the target resource. > > > > That wrapper will then read in the resource file and interpret it > > > > specifically as PHP code, ignoring the #! line. > > > > > > As the web hosting company mentioned in their documentation they only > > > > > support perl and ruby for > > > > > fastcgi. They don't mention any extension to be specifically used for > > > > > fastcgi. > > > > > > In general if, according with the documentation you specify fcgi or > > > > > fpl as extesions these will be executed via > > > > > fastcgi. Does the fastcgi module care for the shebang line you put in > > > > > your file? Can that be restricted only to > > > > > specific script interpreters? > > > > > As I said before, it really depends on how the hosting company has > > > > configured it. The default way people usually set up fastcgi however, > > > > ie., that typical configuration, would be such that .fcgi would be > > > > executed per the #! line. > > > > > > I am thinking about just pointing the shebang line to Python but > > > > > use .pl extension for my files. Would that work? > > > > > Try it. You haven't as far as I remember even pointed at which hosting > > > > company it is or where there documentation is describing their setup, > > > > so I am not going to know. Just try and make sure you have a working > > > > Python fastcgi hello world first by testing it on your own computer > > > > system somehow because any mistake in the code will yield a 500 error > > > > and you may not know whether it is a coding error in your program or > > > > lack of flup, of whether it just isn't honouring the #! line. > > > > > Graham > > > > > > On Jan 26, 10:48 pm, Graham Dumpleton <graham.dumple...@gmail.com> > > > > > wrote: -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.