WebFaction
Community site: login faq

Hi.

I've just joined Webfaction, and to be honest also quite new to CherryPy. I've made a simple application in Python/CherryPy, which works fine on my local machine, but which I can't make working on WebFaction.

I think my problem has something to do with the autostart.cgi script, without being totally sure.

The pre-made sample CherryPy application which is created when you make a CherryPy application works fine, but my application doesn't seem to work.

This is what I did:

  • I uploaded my application files to the webapps/appname directory.
  • I then opened the autostart.cgi and changed the line:

spawn("/usr/local/bin/python3.2 /home/xirov/webapps/_appname_/site.py")

according to my own information

  • I then logged into the server using SSH, and killed the process and launched autostart.cgi according to this QA ..

My current state is that page is returning "502 Bad Gateway", which is as far as I could get after fiddling around with it most of the night.

I hope that someone is able to help. As said, I'm pretty new to both Webfaction and CherryPy, so if you can explain to me in an easy-to-understand way, what I've misunderstod or done wrong, I will be grateful.

Also if you could explain to me more about this autostart.cgi script, and how to use it/best practice. I haven't been able to find much in the documentation.

asked 06 Feb '14, 19:53

xiroV
134
accept rate: 0%


I signed in as your user and attempted to run the site.py file directly, the reason it is failing is it is missing a library,

[you@server *****]$ /usr/local/bin/python3.2 /home/*****/webapps/*****/site.py
Traceback (most recent call last):
  File "*******/site.py", line 3, in <module>
    from jinja2 import Environment, FileSystemLoader
ImportError: No module named jinja2

The autostart.cgi script basically checks if a PID exists, if it does than the server is running and it does nothing, if it does not it will start the app on the given port. A 502 error means nothing is listening on the assigned port, you can confirm it by trying to use wget on localhost:port and than attempting to manually start the server and checking its output.

permanent link

answered 07 Feb '14, 07:40

johns
5.4k312
accept rate: 23%

Thanks a lot! This made things a bit more clear, even though I'm still struggling to make it work, it definitely pointed me in the right direction.

(07 Feb '14, 13:53) xiroV
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×32
×21
×3

question asked: 06 Feb '14, 19:53

question was seen: 2,141 times

last updated: 07 Feb '14, 13:53

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM