我已经在centos 7上设置了django服务器。当我启动服务器时,我遇到了这个错误
Unhandled exception in thread started by <function wrapper at 0x32b6ed8>
Traceback (most recent call last):
File "/root/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(*args, **kwargs)
File "/root/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/root/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/root/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/root/venv/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/root/venv/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/root/venv/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named sslserver
答案 0 :(得分:1)
在Python发行版或virtualenv中安装模块:
$ pip install django-sslserver
将应用程序添加到INSTALLED_APPS:
INSTALLED_APPS = (...
"sslserver",
...
)
启动启用SSL的调试服务器:
$ python manage.py runsslserver
并访问https://localhost:8000上的应用或在指定端口上启动服务器:
$ python manage.py runsslserver 127.0.0.1:8000