Graceful error handling

pull/1/head
Rui Carmo 2016-03-29 20:38:48 +01:00
rodzic 2b2f08a3d4
commit 0bb6e79f88
2 zmienionych plików z 20 dodań i 3 usunięć

Wyświetl plik

@ -0,0 +1,12 @@
# Python example
To publish this app to `piku`, make a copy of this folder and run the following commands:
```bash
cd python_copy
git init .
git remote add piku piku@your_server:python_example
git add .
git commit -a -m "initial commit"
git push piku master
```

11
piku.py
Wyświetl plik

@ -53,9 +53,14 @@ def parse_procfile(filename):
return None
with open(filename, 'r') as procfile:
for line in procfile:
kind, command = map(lambda x: x.strip(), line.split(":", 1))
if kind in ['web', 'worker', 'wsgi']:
workers[kind] = command
try:
kind, command = map(lambda x: x.strip(), line.split(":", 1))
if kind in ['web', 'worker', 'wsgi']:
workers[kind] = command
except:
echo("Warning: unrecognized Procfile declaration '%s'" % line, fg='yellow')
if not len(workers):
return None
# WSGI trumps regular web workers
if 'wsgi' in workers:
if 'web' in workers: