python - Flask Passenger WSGI on Dreamhost -


first followed instructions in tutorial on matt carrier's blog (although assumed making subdirectory on domain, when i'm not). erased , started on instructions on dreamhost wiki page flask. each time, message in browser reading: "an error occurred importing passenger_wsgi.py". answer topic on stackoverflow did not work me.

my passenger_wsgi.py file is:

import sys, os interp = os.path.join(os.environ['home'], 'flask_env', 'bin', 'python') if sys.executable != interp:     os.execl(interp, interp, *sys.argv) sys.path.append(os.getcwd())  flask import flask application = flask(__name__)  sys.path.append('penguicon-trax') penguicon-trax.penguicontrax import app application 

penguicon-trax name of directory git creates when clone app virtualenv installed flask (not in public dir). app penguicontrax.py without dash.

i made sure indent on fourth line of passenger_wsgi.py tab, not spaces.

i used dreamhost webpanel (where i'm hosted) make /home/username/flask_env/public , marked "passenger (ruby/python apps only)" checkbox , clicked "change settings" button.

i ftp'ed passenger_wsgi.py directly flask_env directory on dreamhost. when ssh dreamhost, ls on command line gives me:

bin  lib            passenger_wsgi.pyc  public include  passenger_wsgi.py  penguicon-trax 

when run passenger_wsgi.py through ssh, gives me:

file "passenger_wsgi.py", line 11   penguicon-trax.penguicontrax import app application                 ^ syntaxerror: invalid syntax 

it when use "from penguicon-trax import app application".

when change line remove dash: "penguicontrax.penguicontrax" , run it, gives me "importerror: no module named penguicontrax".

if change line "from penguicontrax import app application" , run through ssh, gives me no error message or other output. however, domain gives 404.

can tell me i'm doing wrong?

if passenger_wsgi.py has following code @ end of it:

from foo.bar import app application 

... need sub-directory named "foo" 2 files in it: 1 file named bar.py , file named __init__.py python recognizes directory contains module code.

in example, remove dash folder name (penguicon-trax), since modules should have short, all-lowercase names. then, flask application code in file in $home/flask_env/penguicontrax/penguicontrax.py lastly, run following try out:

touch $home/flask_env/penguicontrax/__init__.py python $home/flask_env/passenger_wsgi.py 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -