当我gunicorn wsgi
时,我得到PermissionError: [Errno 13] Permission denied: '/home/valachio/salvation/config/settings.py'
(救赎是项目的名称)。
我用this answer做了大部分麻烦,这是我最接近我的问题。
当我执行ls -lash
时,我的wsgi和设置文件的结果如下所示:
8.0K ---------- 1 valachio valachio 4.7K Jan 2 17:33 settings.py
0 -rw-rw-rw- 1 valachio valachio 385 Jan 2 13:56 wsgi.py
当我ps aux | grep gunicorn
时,我明白了:
valachio 3568 0.0 0.0 182924 1108 pts/0 S 11:35 0:00 grep --color=auto gunicorn
valachio是我的用户名。似乎当前用户与settings.py文件的所有者相同。
为什么这不起作用?我该怎么办?
我在Windows 10上使用Linux 16.04 LTS子系统。
运行gunicorn wsgi
-
[2018-01-03 11:28:54 -0500] [3561] [INFO] Starting gunicorn 19.7.1
[2018-01-03 11:28:54 -0500] [3561] [INFO] Listening at: http://127.0.0.1:8000 (3561)
[2018-01-03 11:28:54 -0500] [3561] [INFO] Using worker: sync
[2018-01-03 11:28:54 -0500] [3564] [INFO] Booting worker with pid: 3564
[2018-01-03 11:28:54 -0500] [3564] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
worker.init_process()
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/gunicorn/util.py", line 352, in import_app
__import__(module)
File "/home/valachio/salvation/config/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/django/__init__.py", line 19, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/site-packages/django/conf/__init__.py", line 106, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/home/valachio/.local/share/virtualenvs/salvation-uBeePQVz/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 661, in exec_module
File "<frozen importlib._bootstrap_external>", line 766, in get_code
File "<frozen importlib._bootstrap_external>", line 818, in get_data
PermissionError: [Errno 13] Permission denied: '/home/valachio/salvation/config/settings.py'
[2018-01-03 11:28:54 -0500] [3564] [INFO] Worker exiting (pid: 3564)
[2018-01-03 11:28:55 -0500] [3561] [INFO] Shutting down: Master
[2018-01-03 11:28:55 -0500] [3561] [INFO] Reason: Worker failed to boot.