所以我有这个Django / Angular项目,我被抛弃了,我在新服务器上安装它时遇到了麻烦。我安装了apache / python / pip / django和所有需要的reqs,此时我试图让Django与MongoDB服务器通信。
编辑:该项目使用Django作为AppServer,Apache / mod_wsgi作为Web服务器使用AngularJS作为客户端/前端部分。
UNIX环境 CentOS 7,SELinux = yes
仅仅是为了测试,我没有在MongoDB端为数据库/集合设置任何身份验证。
这是我的settings.py文件的一部分:
# Django settings for my_proj project.
from mongoengine import connect
connect('CoreRubrics',host='<url>',port=27017)
我也是这样试过的:
#DATABASES = {
# 'default': {
# 'ENGINE': 'django_mongodb_engine',
# 'NAME': 'CoreRubrics',
# 'HOST': '<url>'
# }
#}
这是我得到的错误。
[Thu Apr 09 16:30:07.195577 2015] [:error] [pid 27781] [client 172.16.75.12:49593] mod_wsgi (pid=27781): Exception occurred processing WSGI script '/var/www/CoreRubrics/DjangoBackend/apache/django.wsgi'.
[Thu Apr 09 16:30:07.195677 2015] [:error] [pid 27781] [client 172.16.75.12:49593] Traceback (most recent call last):
[Thu Apr 09 16:30:07.195722 2015] [:error] [pid 27781] [client 172.16.75.12:49593] File "/usr/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 168, in __call__
[Thu Apr 09 16:30:07.196110 2015] [:error] [pid 27781] [client 172.16.75.12:49593] self.load_middleware()
[Thu Apr 09 16:30:07.196154 2015] [:error] [pid 27781] [client 172.16.75.12:49593] File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 43, in load_middleware
[Thu Apr 09 16:30:07.196405 2015] [:error] [pid 27781] [client 172.16.75.12:49593] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Thu Apr 09 16:30:07.196442 2015] [:error] [pid 27781] [client 172.16.75.12:49593] File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 46, in __getattr__
[Thu Apr 09 16:30:07.196607 2015] [:error] [pid 27781] [client 172.16.75.12:49593] self._setup(name)
[Thu Apr 09 16:30:07.196670 2015] [:error] [pid 27781] [client 172.16.75.12:49593] File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
[Thu Apr 09 16:30:07.196712 2015] [:error] [pid 27781] [client 172.16.75.12:49593] self._wrapped = Settings(settings_module)
[Thu Apr 09 16:30:07.196826 2015] [:error] [pid 27781] [client 172.16.75.12:49593] File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 94, in __init__
[Thu Apr 09 16:30:07.196953 2015] [:error] [pid 27781] [client 172.16.75.12:49593] mod = importlib.import_module(self.SETTINGS_MODULE)
[Thu Apr 09 16:30:07.196997 2015] [:error] [pid 27781] [client 172.16.75.12:49593] File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
[Thu Apr 09 16:30:07.197123 2015] [:error] [pid 27781] [client 172.16.75.12:49593] __import__(name)
[Thu Apr 09 16:30:07.197165 2015] [:error] [pid 27781] [client 172.16.75.12:49593] File "/var/www/CoreRubrics/DjangoBackend/my_proj/settings.py", line 3, in <module>
[Thu Apr 09 16:30:07.198018 2015] [:error] [pid 27781] [client 172.16.75.12:49593] connect('CoreRubrics',host='<url>',port=27017)
[Thu Apr 09 16:30:07.198059 2015] [:error] [pid 27781] [client 172.16.75.12:49593] File "/usr/lib/python2.7/site-packages/mongoengine/connection.py", line 164, in connect
[Thu Apr 09 16:30:07.198206 2015] [:error] [pid 27781] [client 172.16.75.12:49593] return get_connection(alias)
[Thu Apr 09 16:30:07.198237 2015] [:error] [pid 27781] [client 172.16.75.12:49593] File "/usr/lib/python2.7/site-packages/mongoengine/connection.py", line 126, in get_connection
[Thu Apr 09 16:30:07.198271 2015] [:error] [pid 27781] [client 172.16.75.12:49593] raise ConnectionError("Cannot connect to database %s :\\n%s" % (alias, e))
[Thu Apr 09 16:30:07.198312 2015] [:error] [pid 27781] [client 172.16.75.12:49593] ConnectionError: Cannot connect to database default :
[Thu Apr 09 16:30:07.198321 2015] [:error] [pid 27781] [client 172.16.75.12:49593] [Errno 13] Permission denied
由于它说权限被拒绝且没有身份验证,我只能假设某处存在文件权限错误?