Skip to content

Commit 739957b

Browse files
rnwstrsa33
authored andcommitted
Set PYTHONPATH to avoid ModuleNotFoundError
The script ran fine from the console, but not when run as a systemd service, causing the following error: `ModuleNotFound error: No module named 'main'` when launching gunicorn. Set `PYTHONPATH` before launching gunicorn to avoid this.
1 parent 1ce2af2 commit 739957b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

content/tutorials/websites/deploy-a-web-app.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ The scripts provided here are just examples and won't necessarily be perfect for
258258
#!/bin/bash -e
259259
260260
. ~/myapp/venv/bin/activate
261+
export PYTHONPATH='/home/crsid/myapp'
261262
exec gunicorn -w 2 -b unix:/home/crsid/myapp/web.sock \
262263
--log-file - main:app
263264
```

0 commit comments

Comments
 (0)