kopia lustrzana https://github.com/piku/piku
Graceful error handling
rodzic
2b2f08a3d4
commit
0bb6e79f88
|
@ -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
11
piku.py
|
@ -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:
|
||||
|
|
Ładowanie…
Reference in New Issue