Re: Lazy Registration

2010-01-26 Thread jgard...@jonathangardner.net
A better idea might be to map carts to sessions, and then sessions to
customers.

Each session has a cart. Each cart may belong to more than one
session.

A customer can identify with more than one session, although each
session can only identify with up to one customer.

This way, the customer can put stuff in their cart at home, go to
work, add some more stuff, and then come home, and have everything in
their cart. The customer has two active sessions because the browser
at work and the browser at home don't share cookies. Plus, your logs
will have a more realistic picture of what's really going on, since
each session maps to exactly one browser.

On Jan 25, 9:54 pm, Matt Woolnough m...@woolnough.com.au wrote:
 Thanks guys for your input.

 I found a couple of threads on stackoverflow on similar questions:

 http://stackoverflow.com/questions/1969711/best-way-to-place-temporar...http://stackoverflow.com/questions/964476/store-in-session-data-vs-st...

 Although it seems there will be a performance penalty for this type of
 arrangement, I think I'll attempt to implement something like what
 Jonathan suggests.  Hopefully the decision doesn't turn out to be a
 bad one...  Oh well it's all just a learning experience eh?

 cheers again


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



Re: Using session in new thread

2010-01-26 Thread sniipe
Any idea?

On Jan 22, 1:21 pm, sniipe sni...@gmail.com wrote:
 Hi!

 Is it possible to use session in created thread in my action, like:

 ...
 from pylons import session
 import thread
 ...

 class UsersController(BaseController):
     def _check_user(self, user):
         # do something with session object
         ...

     def some_action(self, user):
         ...
         thread.start_new_thread(self._check_user, (user,))
         ...

 When I try to do it this way I received exception:

 TypeError: No object (name: session) has been registered for this
 thread

 Do I need to register session in thread? How? :)

 I will create thread because I don't want to wait for some code to
 finish job.

 Thanks in advance for your help :)

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



Re: Using session in new thread

2010-01-26 Thread DD

I think the session is StackedObjectProxy.

session._current_obj() will get you the actual instance that you can 
then pass on to your thread.


I am really not sure on the thread-safety of this, may be someone else 
can chime in.


DD.

sniipe wrote:

Any idea?

On Jan 22, 1:21 pm, sniipesni...@gmail.com  wrote:

Hi!

Is it possible to use session in created thread in my action, like:

...
from pylons import session
import thread
...

class UsersController(BaseController):
 def _check_user(self, user):
 # do something with session object
 ...

 def some_action(self, user):
 ...
 thread.start_new_thread(self._check_user, (user,))
 ...

When I try to do it this way I received exception:

TypeError: No object (name: session) has been registered for this
thread

Do I need to register session in thread? How? :)

I will create thread because I don't want to wait for some code to
finish job.

Thanks in advance for your help :)




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



Fastcgi and performance

2010-01-26 Thread PF4Pylons
Hi all

I was told by a programmer (I am not one :D ) that an application that
runs Pylons  via CGI is not going to be performant in a shared hosting
environment and I may not be allowed to use it. As reason for poor
performance the programmer indicated the fact the the server will have
to spawn a new process each  time a request comes.

Is that so?


Thank you
PF

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



Beginner questions:Pylons and fastCGI -performance issue and some errors

2010-01-26 Thread PF4Pylons
Hi all

I am beginner with pylons and Python and I am trying to move an
Appweblication from a server to a shared host environment. The
Appweblication was developed by somebody else, I am not programmer and
I am trying to learn what it takes to just do the move.

Here is what I am running:

-Python 2.5 installed in a virutal environment because I needed to add
some more modules that were not allowed by the hosting company. They
also run a older version. The provider is Godaddy so if anyone managed
to install Pylons Appweblication there I would be glad to hear about
their experiences.
Python is the ActivePerl version because this version comes with all
the modules that I needed included. I needed sqlite2 but ActivePerl
has sqlite3 I hope that is good. I haven't reach the point to run the
Appweblication

-Pylons 0.9.6.2
-I had to remove Routes Routes-1.10.3-py2.5.egg and to install
routes==1.9

my fastcgi script looks like this

#!/bin/sh
exec /usr/bin/env  \
PYTHONPATH=myhomedir/html/Others/Appweb/libAppweb \
LD_LIBRARY_PATH=myhomedir/html/Others/PVE/lib/ \
:myhomedir/html/Others/App/libApp/  \
myhomedir/html/Others/PVE/bin/python /myhomedir/html/Others/Appweb/
Appweb.py

I also tried

#!/bin/sh
exec /usr/bin/env  \
myhomedir/html/Others/Appweb/libAppweb \
LD_LIBRARY_PATH=myhomedir/html/Others/PVE/lib/ \
:myhomedir/html/Others/Appweb/libAppweb \
:myhomedir/html/Others/App/libApp/  \
myhomedir/html/Others/PVE/bin/python /myhomedir/html/Others/Appweb/
Appweb.py



The file Appweb.py looks like this

#!/myhomedirhtml/Others/PVE/bin/python

from paste.deploy import loadAppweb
wsgi_Appweb = loadAppweb('config:myhomedir/html/Others/Appweb/Appweb/
production.ini')
import wsgiref.handlers
wsgiref.handlers.CGIHandler().run(wsgi_Appweb)


If I run the Appweblication in the hosted environment using the
command line and paste I am receiving the same warnings as in my
vmware test engine but the Appweblication is starting fine. Obviously
I can not use it this way because the host if firewalled and I can get
to the port that I am using no matter what I am changing it to.

The solution was to try fastcgi with the above files because Godaddy
doesn't support mod_wsgi and anything else.

And now the problems

1. the webser seems to be takind a while to respon (10 seconds?)
2. I am receiving these errors (quting the apache log below). Could
you please help me to figure out what is wrong here?

Thank you
PF

/myhomedirhtml/Others/PVE/lib/python2.5/site-packages/Pylons-0.9.6.2-
py2.5.egg/pylons/middleware.py:11: DeprecationWarning: The
webhelpers.rails package is deprecated.
- Please begin migrating to the new helpers in webhelpers.html,
  webhelpers.text, webhelpers.number, etc.
- Import url_for() directly from routes, and redirect_to() from
  pylons.controllers.util (if using Pylons) or from routes.
- All Javascript support has been deprecated.  You can write
link_to_remote()
  yourself or use one of the third-party Javascript libraries.
  from webhelpers.rails.asset_tag import javascript_path
Traceback (most recent call last):
  File /myhomedirhtml/Others/App/App.py, line 4, in module
wsgi_Appweb = loadAppweb('config:/myhomedirhtml/Others/App/
Appweb/production.ini')
  File /myhomedirhtml/Others/PVE/lib/python2.5/site-packages/
PasteDeploy-1.3.3-py2.5.egg/paste/deploy/loadwsgi.py, line 204, in
loadAppweb
return loadobj(Appweb, uri, name=name, **kw)
  File /myhomedirhtml/Others/PVE/lib/python2.5/site-packages/
PasteDeploy-1.3.3-py2.5.egg/paste/deploy/loadwsgi.py, line 225, in
loadobj
return context.create()
  File /myhomedirhtml/Others/PVE/lib/python2.5/site-packages/
PasteDeploy-1.3.3-py2.5.egg/paste/deploy/loadwsgi.py, line 625, in
create
return self.object_type.invoke(self)
  File /myhomedirhtml/Others/PVE/lib/python2.5/site-packages/
PasteDeploy-1.3.3-py2.5.egg/paste/deploy/loadwsgi.py, line 110, in
invoke
return fix_call(context.object, context.global_conf,
**context.local_conf)
  File /myhomedirhtml/Others/PVE/lib/python2.5/site-packages/
PasteDeploy-1.3.3-py2.5.egg/paste/deploy/util/fixtypeerror.py, line
57, in fix_call
val = callable(*args, **kw)
  File /home/resolve/Lib/code/Appweb/Appweb/config/middleware.py,
line 34, in make_Appweb
  File /home/resolve/Lib/code/Appweb/Appweb/config/environment.py,
line 27, in load_environment
  File /home/resolve/Lib/code/Appweb/Appweb/lib/Appweb_globals.py,
line 17, in __init__
  File /myhomedirhtml/Others/App/App.py, line 4, in module
wsgi_Appweb = loadAppweb('config:/myhomedirhtml/Others/App/
Appweb/production.ini')
  File /myhomedirhtml/Others/PVE/lib/python2.5/site-packages/
PasteDeploy-1.3.3-py2.5.egg/paste/deploy/loadwsgi.py, line 204, in
loadAppweb
return loadobj(Appweb, uri, name=name, **kw)
  File /myhomedirhtml/Others/PVE/lib/python2.5/site-packages/
PasteDeploy-1.3.3-py2.5.egg/paste/deploy/loadwsgi.py, line 225, in
loadobj
return context.create()
  File /myhomedirhtml/Others/PVE/lib/python2.5/site-packages/

Re: Fastcgi and performance

2010-01-26 Thread Mike Orr
On Tue, Jan 26, 2010 at 11:39 AM, PF4Pylons ultimulunic...@gmail.com wrote:
 Hi all

 I was told by a programmer (I am not one :D ) that an application that
 runs Pylons  via CGI is not going to be performant in a shared hosting
 environment and I may not be allowed to use it. As reason for poor
 performance the programmer indicated the fact the the server will have
 to spawn a new process each  time a request comes.

 Is that so?

That's why people don't use CGI in production. But FastCGI was
designed specifically to overcome this. Pylons has several deployment
options: ProxyPass, mod_wsgi, FastCGI, etc. These are all similar in
performance (maybe not identical, but certainly better than CGI).  I
would start with ProxyPass because it's the most straightforward
(just connect Apache to your existing PasteHTTPServer), but it's worth
exploring all of them and seeing which one best meets your needs.

I haven't used FastCGI so I can't answer your specific questions on it.

-- 
Mike Orr sluggos...@gmail.com

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



Re: Fastcgi and performance

2010-01-26 Thread PF4Pylons
Hi Mike

I am using a hosted environment and the hosting company doesn't give
me access to the apache confing files
and as far as I know neither the option to use include client
httpd.conf sections so the proxy solution is
not for me

Thank you for your reply
PF

On Jan 26, 5:04 pm, Mike Orr sluggos...@gmail.com wrote:
 On Tue, Jan 26, 2010 at 11:39 AM, PF4Pylons ultimulunic...@gmail.com wrote:
  Hi all

  I was told by a programmer (I am not one :D ) that an application that
  runs Pylons  via CGI is not going to be performant in a shared hosting
  environment and I may not be allowed to use it. As reason for poor
  performance the programmer indicated the fact the the server will have
  to spawn a new process each  time a request comes.

  Is that so?

 That's why people don't use CGI in production. But FastCGI was
 designed specifically to overcome this. Pylons has several deployment
 options: ProxyPass, mod_wsgi, FastCGI, etc. These are all similar in
 performance (maybe not identical, but certainly better than CGI).  I
 would start with ProxyPass because it's the most straightforward
 (just connect Apache to your existing PasteHTTPServer), but it's worth
 exploring all of them and seeing which one best meets your needs.

 I haven't used FastCGI so I can't answer your specific questions on it.

 --
 Mike Orr sluggos...@gmail.com

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



Re: Fastcgi and performance

2010-01-26 Thread Alec Lyons
Assume your host supports mod_python (so you can upload python files,
execute them and have the results returned)? If so,
http://wiki.pylonshq.com/display/pylonscookbook/Production+deployment+using+mod_pythonmight
help.

My suggestion though would be to look for a hosting partner that support
mod_wsgi...I don't know of any though, and i you find one please share!

On Tue, Jan 26, 2010 at 10:40 PM, PF4Pylons ultimulunic...@gmail.comwrote:

 Hi Mike

 I am using a hosted environment and the hosting company doesn't give
 me access to the apache confing files
 and as far as I know neither the option to use include client
 httpd.conf sections so the proxy solution is
 not for me

 Thank you for your reply
 PF

 On Jan 26, 5:04 pm, Mike Orr sluggos...@gmail.com wrote:
  On Tue, Jan 26, 2010 at 11:39 AM, PF4Pylons ultimulunic...@gmail.com
 wrote:
   Hi all
 
   I was told by a programmer (I am not one :D ) that an application that
   runs Pylons  via CGI is not going to be performant in a shared hosting
   environment and I may not be allowed to use it. As reason for poor
   performance the programmer indicated the fact the the server will have
   to spawn a new process each  time a request comes.
 
   Is that so?
 
  That's why people don't use CGI in production. But FastCGI was
  designed specifically to overcome this. Pylons has several deployment
  options: ProxyPass, mod_wsgi, FastCGI, etc. These are all similar in
  performance (maybe not identical, but certainly better than CGI).  I
  would start with ProxyPass because it's the most straightforward
  (just connect Apache to your existing PasteHTTPServer), but it's worth
  exploring all of them and seeing which one best meets your needs.
 
  I haven't used FastCGI so I can't answer your specific questions on it.
 
  --
  Mike Orr sluggos...@gmail.com

 --
 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.compylons-discuss%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/pylons-discuss?hl=en.



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



Re: Fastcgi and performance

2010-01-26 Thread Richard Rosenberg
I have pylons running behind Apache/FastCGI on a hostmonster.com shared server 
and it seems to work well and perform just fine. I have yet to move any logic 
(controllers, templates, etc.) over from my dev server to the shared host, so 
pylons is serving static stuff at the moment, but it definitely works and 
performs reasonably well so far.

Say the word and I'll pull some of the config files down from the shared 
machine and post 'em to the list. Sorry. . .But I got it going a while ago and 
have not really done much with it yet, so the Apache configuration and other 
steps have faded from memory. Should be at least similar to what would be 
required for godaddy.com. 

Richard

-Original Message-
From: PF4Pylons ultimulunic...@gmail.com
Sent: Jan 26, 2010 5:40 PM
To: pylons-discuss pylons-discuss@googlegroups.com
Subject: Re: Fastcgi and performance

Hi Mike

I am using a hosted environment and the hosting company doesn't give
me access to the apache confing files
and as far as I know neither the option to use include client
httpd.conf sections so the proxy solution is
not for me

Thank you for your reply
PF

On Jan 26, 5:04 pm, Mike Orr sluggos...@gmail.com wrote:
 On Tue, Jan 26, 2010 at 11:39 AM, PF4Pylons ultimulunic...@gmail.com wrote:
  Hi all

  I was told by a programmer (I am not one :D ) that an application that
  runs Pylons  via CGI is not going to be performant in a shared hosting
  environment and I may not be allowed to use it. As reason for poor
  performance the programmer indicated the fact the the server will have
  to spawn a new process each  time a request comes.

  Is that so?

 That's why people don't use CGI in production. But FastCGI was
 designed specifically to overcome this. Pylons has several deployment
 options: ProxyPass, mod_wsgi, FastCGI, etc. These are all similar in
 performance (maybe not identical, but certainly better than CGI).  I
 would start with ProxyPass because it's the most straightforward
 (just connect Apache to your existing PasteHTTPServer), but it's worth
 exploring all of them and seeing which one best meets your needs.

 I haven't used FastCGI so I can't answer your specific questions on it.

 --
 Mike Orr sluggos...@gmail.com

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


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



Re: Fastcgi and performance

2010-01-26 Thread Jonathan Gardner
On Tue, Jan 26, 2010 at 2:04 PM, Mike Orr sluggos...@gmail.com wrote:
 On Tue, Jan 26, 2010 at 11:39 AM, PF4Pylons ultimulunic...@gmail.com wrote:
 Hi all

 I was told by a programmer (I am not one :D ) that an application that
 runs Pylons  via CGI is not going to be performant in a shared hosting
 environment and I may not be allowed to use it. As reason for poor
 performance the programmer indicated the fact the the server will have
 to spawn a new process each  time a request comes.

 Is that so?

 That's why people don't use CGI in production. But FastCGI was
 designed specifically to overcome this. Pylons has several deployment
 options: ProxyPass, mod_wsgi, FastCGI, etc. These are all similar in
 performance (maybe not identical, but certainly better than CGI).  I
 would start with ProxyPass because it's the most straightforward
 (just connect Apache to your existing PasteHTTPServer), but it's worth
 exploring all of them and seeing which one best meets your needs.

 I haven't used FastCGI so I can't answer your specific questions on it.



ProxyPass will get you setup very quickly. However, FastCGI is
actually the preferred method where I work. It ends up being pretty
much like ProxyPass except instead of an HTTP request being sent to
the process, it's a set of CGI parameters. That translates to a bit of
savings due to HTTP being a bit complicated to negotiate.

You can also do things like manage how many FastCGI processes are
running and such which makes management nicer as you need to scale up.

In a shared hosting environment, I am pretty certain they will want
you to use FastCGI. That's because they see which processes are out
there and connected to the web server, versus various web servers that
are targets for proxy requests and otherwise unconnected.

-- 
Jonathan Gardner
jgard...@jonathangardner.net

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



Re: Beginner questions:Pylons and fastCGI -performance issue and some errors

2010-01-26 Thread Jonathan Gardner
On Tue, Jan 26, 2010 at 11:34 AM, PF4Pylons ultimulunic...@gmail.com wrote:

 1. the webser seems to be takind a while to respon (10 seconds?)

This is because your FastCGI process won't start.

 2. I am receiving these errors (quting the apache log below). Could
 you please help me to figure out what is wrong here?


This is why your FastCGI process won't start.


My recommendation:

Take a couple of steps back. Take notes along the way, and pay
attention to any warning signs. This isn't something you can do ad hoc
unless you've done it a million times, and even then, you would want
to follow some sort of checklist.

I'm assuming you're in a Linux environment. If that's not the case,
you should switch your hosting provider. I suggest HostMonster. Others
are OK as well.

My Python is whatever I build on the box from the latest sources. If
you can't run gcc, you can't build python. Use the OS provided Python
if necessary, but these are usually ancient so I avoid them. It also
introduces a problem when they upgrade their Python.

I setup a virtualenv where I install everything, including the code
for my site, usually under ~/env/TheSite. Get familiar with virtualenv
since it is nice. I've heard there's a replacement for it, but I don't
use it yet.

I write the script and test it by running it from the command line. If
it doesn't run, I tweak it until it does. It shouldn't throw any
exceptions at all. If it does throw an exception, I'm either missing a
dependency (in your case, fonts) or something else is broken. It
shouldn't spit our warning messages like you've seen above either.
Resolve those before continuing.

Then I configure the web server to point to the FCGI script I just
wrote. I test that this is starting up by looking at the logs after
hitting the URL. I also use ps -efwww | grep 'python' to find my
FastCGI process. If it isn't there, something's broke and the logs
should tell me what.

-- 
Jonathan Gardner
jgard...@jonathangardner.net

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



Re: Fastcgi and performance

2010-01-26 Thread PF4Pylons

Hi guys

Thanks for your replies.
Godaddy doesn't support mod_wsgi and they support FastCGI only for
Perl and Ruby.
I just opened a ticket a support ticket with them to verify if the
ProxyPass which I understand is the same with Reverse Proxy is allowed
and installed.


What other options do I have? For various reasons I can't change the
provider.
Thank you
PF

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



Re: Beginner questions:Pylons and fastCGI -performance issue and some errors

2010-01-26 Thread PF4Pylons
After paying more attention to the docs I realized that I am actually
running in CGI mode not in FastCGI.
FastCGI is supported only for Perl and Ruby :(
So this is why it is slow (see my other post from today) and I don't
think I have chances to improve that.
It was slow even with the HelloWord application.

Regarding your advice: I have done most of the thinks you mentioned.
Don't forget that I am not a programmer, all I want is just to move
the application.
I can't understand why when I run the aplication using paster via
command line everythig is fine but
when I try to start it as CGI there are some dependencies missing.
That is where I need some help

Thanks
PF





On Jan 26, 6:04 pm, Jonathan Gardner jgard...@jonathangardner.net
wrote:
 On Tue, Jan 26, 2010 at 11:34 AM, PF4Pylons ultimulunic...@gmail.com wrote:

  1. the webser seems to be takind a while to respon (10 seconds?)

 This is because your FastCGI process won't start.

  2. I am receiving these errors (quting the apache log below). Could
  you please help me to figure out what is wrong here?

 This is why your FastCGI process won't start.

 My recommendation:

 Take a couple of steps back. Take notes along the way, and pay
 attention to any warning signs. This isn't something you can do ad hoc
 unless you've done it a million times, and even then, you would want
 to follow some sort of checklist.

 I'm assuming you're in a Linux environment. If that's not the case,
 you should switch your hosting provider. I suggest HostMonster. Others
 are OK as well.

 My Python is whatever I build on the box from the latest sources. If
 you can't run gcc, you can't build python. Use the OS provided Python
 if necessary, but these are usually ancient so I avoid them. It also
 introduces a problem when they upgrade their Python.

 I setup a virtualenv where I install everything, including the code
 for my site, usually under ~/env/TheSite. Get familiar with virtualenv
 since it is nice. I've heard there's a replacement for it, but I don't
 use it yet.

 I write the script and test it by running it from the command line. If
 it doesn't run, I tweak it until it does. It shouldn't throw any
 exceptions at all. If it does throw an exception, I'm either missing a
 dependency (in your case, fonts) or something else is broken. It
 shouldn't spit our warning messages like you've seen above either.
 Resolve those before continuing.

 Then I configure the web server to point to the FCGI script I just
 wrote. I test that this is starting up by looking at the logs after
 hitting the URL. I also use ps -efwww | grep 'python' to find my
 FastCGI process. If it isn't there, something's broke and the logs
 should tell me what.

 --
 Jonathan Gardner
 jgard...@jonathangardner.net

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



Re: Fastcgi and performance

2010-01-26 Thread Graham Dumpleton


On Jan 27, 1:56 pm, PF4Pylons ultimulunic...@gmail.com wrote:
 Hi guys

 Thanks for your replies.
 Godaddy doesn't support mod_wsgi and they support FastCGI only for
 Perl and Ruby.

There is nothing special that has to be done to FASTCGI setup to
support a particular language. If they already have Python installed
for CGI scripts, you should be able to use it with FASTCGI. The only
dependency is that you may have to install flup into an area in your
own account and use it from there instead of it being installed in
main Python installation. In worst case you could even install your
own Python installation so you can use any version you want instead of
any antiquated version they supply.

That they say they don't support Python either means they just don't
want anyone running Python at all, or they don't understand how
FASTCGI works which leaves the question of why you would want to use
them if their technical knowledge is so limited.

As such, you may want to go find a web host that actually knows about
Python and how to host web applications using Python properly. That
company doesn't seem to be a very good choice.

Graham

 I just opened a ticket a support ticket with them to verify if the
 ProxyPass which I understand is the same with Reverse Proxy is allowed
 and installed.

 What other options do I have? For various reasons I can't change the
 provider.
 Thank you
 PF

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



Re: Beginner questions:Pylons and fastCGI -performance issue and some errors

2010-01-26 Thread Mike Orr
I took a closer look at your original messages since the problem is
more than just FastCGI.  But I'm not sure we'll be able to solve your
problem definitively for reasons described below.

On Tue, Jan 26, 2010 at 11:34 AM, PF4Pylons ultimulunic...@gmail.com wrote:
 Hi all

 I am beginner with pylons and Python and I am trying to move an
 Appweblication from a server to a shared host environment. The
 Appweblication was developed by somebody else, I am not programmer and
 I am trying to learn what it takes to just do the move.

Well first, what's an Appweblication? Is this something specific to
GoDaddy or your previous server? Or do you just mean a web
application.

 Here is what I am running:

 -Python 2.5 installed in a virutal environment because I needed to add
 some more modules that were not allowed by the hosting company. They
 also run a older version. The provider is Godaddy so if anyone managed
 to install Pylons Appweblication there I would be glad to hear about
 their experiences.

I can't understand why when I run the aplication using paster via
command line everythig is fine but
when I try to start it as CGI there are some dependencies missing.

I'm pasting in parts of two messages here. It's possible that the
webserver is not running the Python in your virtualenv but the system
Python.  In that case, it won't have access to the modules in your
virtualenv.

If you can get a simple Pylons application running in debug mode, you
can insert raise RuntimeError and look through the variables in the
interactive traceback.  If that doesn't work, just make a simple CGI
script that prints the Python path:

import sys, pprint
print Content-type: text/plain
print
print sys.executable
pprint.pprint(sys.path)
import somemodule
print somemodule

That'll show which Python is running and where it can load modules
from.  Printing a module object shows which directory it was imported
from.


 Python is the ActivePerl version because this version comes with all
 the modules that I needed included.

I take it you meant ActivePython.

 I needed sqlite2 but ActivePerl
 has sqlite3 I hope that is good.

I've always used 3. I haven't heard of any compatibility problems
between the versions.

 I haven't reach the point to run the
 Appweblication

 -Pylons 0.9.6.2

So it's a pretty old application, more than a year old I guess.

 -I had to remove Routes Routes-1.10.3-py2.5.egg and to install
 routes==1.9

Routes has some new defaults, so it's possible these are incompatible
with  your older application. Older apps often depend on minimization
and implicit defaults. (Not that that means anything to you, but it
would be the first place to look if you wanted to upgrade the app.)

 /myhomedirhtml/Others/PVE/lib/python2.5/site-packages/Pylons-0.9.6.2-
 py2.5.egg/pylons/middleware.py:11: DeprecationWarning: The
 webhelpers.rails package is deprecated.
 - Please begin migrating to the new helpers in webhelpers.html,
  webhelpers.text, webhelpers.number, etc.
 - Import url_for() directly from routes, and redirect_to() from
  pylons.controllers.util (if using Pylons) or from routes.
 - All Javascript support has been deprecated.  You can write
 link_to_remote()
  yourself or use one of the third-party Javascript libraries.
  from webhelpers.rails.asset_tag import javascript_path

These are due to version changes in WebHelpers. You can ignore these,
or downgrade WebHelpers until they disappear. I think the rails
warning was added in version 0.6.  WebHelpers 0.3.4 is still on PyPI
but it's hidden so you'll have to go to the exact URL:
http://pypi.python.org/pypi/WebHelpers/0.3.4 . Otherwise you can use
0.6.4 and ignore the messages.  Don't use any of the WebHelpers 1.0
betas, because they don't have the deprecated code.

  File /home/resolve/Lib/code/Appweb/Appweb/config/middleware.py,
 line 34, in make_Appweb
  File /home/resolve/Lib/code/Appweb/Appweb/config/environment.py,
 line 27, in load_environment
  File /home/resolve/Lib/code/Appweb/Appweb/lib/Appweb_globals.py,
 line 17, in __init__
 ImportError: No module named fonts

I don't think there's a 'fonts' module among Pylons' dependencies, so
it must be something the application is using.

I'm also surprised at those 'make_appweb' and 'Appweb_globals.py'
names, and 'Appweb/Appweb' (instead of 'Appweb/appweb'). Current
Pylons applications have a 'make_app' function and a
'myapp/lib/app_globals.py' file. Perhaps 0.9.6 was more different than
I thought, or perhaps the traceback is corrupted.

 [Tue Jan 26 12:27:15 2010] [error] [client 199.43.172.9] Premature end
 of script headers: /var/chroot/myhomedirhtml/cgi/test.cgi

This always happens when a CGI script aborts without outputing a
Content-type header.

I don't know if any of us use GoDaddy or have tried to run a Pylons
application on it. I had a GoDaddy domain years ago but have not done
webhosting on it. So I don't know if we can offer any specific advice
about your import errors.

I'm also puzzled by your insistance on