Permalink
Browse files

Merge pull request #21 from jonashaag/fix/#20

tools/quickstart.py PYTHONPATH fix
  • Loading branch information...
jonashaag committed May 15, 2012
2 parents 5fb43eb + 8752ed2 commit 45dbd409fdd0024534765c1b3f59d4772f4bc677
Showing with 11 additions and 1 deletion.
  1. +11 −1 tools/quickstart.py
View
@@ -3,10 +3,16 @@
import sys, os
import argparse
+
+PROJECT_ROOT = os.path.join(os.path.dirname(__file__), os.pardir)
+
+sys.path.append(PROJECT_ROOT)
+
+
try:
import nano
except ImportError:
- sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'nano'))
+ sys.path.append(os.path.join(PROJECT_ROOT, 'nano'))
try:
import nano
except ImportError:
@@ -16,18 +22,21 @@
"or copy the 'nano.py' into the klaus root directory by hand."
)
+
try:
from bjoern import run
except ImportError:
from wsgiref.simple_server import make_server
def run(app, host, port):
make_server(host, port, app).serve_forever()
+
def valid_directory(path):
if not os.path.exists(path):
raise argparse.ArgumentTypeError('%r: No such directory' % path)
return path
+
def main():
parser = argparse.ArgumentParser(epilog='Gemüse kaufen!')
parser.add_argument('host', help='(without http://)')
@@ -44,5 +53,6 @@ def main():
run(app, args.host, args.port)
+
if __name__ == '__main__':
main()

0 comments on commit 45dbd40

Please sign in to comment.