tags:

views:

187

answers:

1

I'm interested in learning some python, and thought Pylons would be a good starting point (after spending 2 days trying to get django working -- to no avail).

I have an Amazon EC2 instance with Fedora 8 on it. It is a bare-bones install. I am halfway through my second day of trying to get it to work. I have mod_wsgi installed. I have Apache (though that's a later task to tackle). I have easy_install, paster is working fine; basically all of the pre-requisites mentioned throughout the Pylons docs.

I can't for the life of me get the thing to work. And I can't seem to find a coherent walkthough anywhere that lists all the steps necessary. There is tons of info out there, but it is all scattered. Wsgi this, python that. Google, google, google... "47 million results found for 'socket.error:(lol, 'Yous a goofs')".

So, this is my latest attempt:

apachectl -k stop

cd /home/

paster create -t pylons test

[blah blah.. ok]

cd test

nano development.ini

[hmm, last time I changed the host from 127.0.0.1 to my domain name or url, it threw an error like socket.error: (99, 'Cannot assign requested address')... I'll just leave it]

[open port 5000 on firewall]

paster serve development.ini

[firefox->url:5000]

Firefox can't establish a connection to the server


Doing these steps locally works as expected.

This is just a test to see if I can get it to work at all, which I can't. If I get it to work, then is the task of getting it to work with apache.

My madness is that I'd like to play around a little developing and deploying before diving into a full-fledged project. So far: self, I am dissapoint.

+1  A: 
[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 5000

If you leave it as 127.0.0.1, you'll only be able to surf the site from the ECS instance. By putting in the IP of your ECS instance, or 0.0.0.0 which will listen to all available IPs, it should work.

Unless you have something else listening on port 5000, it should work.

If you are using the hostname, and the hostname resolves to an IP address on your machine it should work. If you use a URL, paster won't be able to resolve the domain name properly. I'm guessing that when you used the domain name, it didn't properly resolve it which generated the error you received. 0.0.0.0 or the IP address in that case should fix it.

I'm not 100% sure whether you used a virtualenv for your pylons installation, but, it is generally a good idea since you don't need to alter the server's environment to install new libraries.

http://pylonshq.com/docs/en/1.0/gettingstarted/#installing

Haha. I *just* made the change you noted about a minute ago, and voila! I am not using a virtualenv. I was planning on it, but when walking through the steps, I came to an impasse because I plan on using sqlalchemy and I couldn't figure out how to install it into the virtualenv. I had initially set up the virtualenv with --no-site-packages, and got an error about not having MySQLdb. A little google later, and I re-installed the virtualenv sans --no-site-packages option (I knew I had MySQLdb installed), but again was thwarted by another error. I will re-examine it though. Much thanks.
stormdrain
If I may ask another question: when working in an apache environsment, it is still necessary to run paster serve, right? I suppose I'm confused because it seems that paster serve creates it's own http server instance... that isn't suitable for production. Is that correct? So then would apache/mod_wsgi be a sort of proxy to the paster serve? How about multiple apps with virtualhosts? How would one go about mapping different hosts to different apps? Thanks again.
stormdrain
paster is a simple wsgi compatible server. You could run paster behind apache using proxypass. Most of the time you'll run mod_wsgi with apache or uwsgi under nginx or some other implementation which replaces paster. Each virtualhost config in apache can point to specific .wsgi script for each application/virtualenv.