当我启动crossbar 0.12.1时,我得到了一个错误,这是版本0.11所没有的
[Controller 210] crossbar.error.invalid_configuration:
WSGI app module 'myproject.wsgi' import failed: No module named django -
Python search path was [u'/myproject', '/opt/crossbar/site-packages/crossbar/worker', '/opt/crossbar/bin', '/opt/crossbar/lib_pypy/extensions', '/opt/crossbar/lib_pypy', '/opt/crossbar/lib-python/2.7', '/opt/crossbar/lib-python/2.7/lib-tk', '/opt/crossbar/lib-python/2.7/plat-linux2', '/opt/crossbar/site-packages']我没有改变任何其他的东西,纵横交错更新。
我的config.json仍然是一样的,我的项目的option路径在选项中:
{
"workers": [
{
"type": "router",
"options": {
"pythonpath": ["/myproject"]
},
"realms": [
{
"name": "realm1",
"roles": [
{
"name": "anonymous",
"permissions": [
{
"uri": "*",
"publish": true,
"subscribe": true,
"call": true,
"register": true
}
]
}
]
}
],
"transports": [
{
"type": "web",
"endpoint": {
"type": "tcp",
"port": 80
},
"paths": {
"/": {
"type": "wsgi",
"module": "myproject.wsgi",
"object": "application"
},
etc...你有什么想法吗?谢谢。
发布于 2016-02-09 20:12:50
似乎"pythonpath": ["/myproject"]替换了您的dist包中的其他python路径配置。查找添加 /myproject且不替换当前路径设置的选项。
或者-将项目的路径添加到机器python路径中,并且不为crossbar提供任何python路径,因此它将选择现有的路径。
类似于(取决于操作系统):
$ sudo nano /usr/lib/python2.7/dist-packages/myproject.pth然后:
/home/username/path/to/myproject 发布于 2016-02-16 23:04:51
我和Docker一起工作是为了有一个干净的环境。这里的broken文件:http://crossbar.io/docs/Installation-on-Docker/似乎坏了:
ImportError: No module named setuptools_ext
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-VfPnRU/pynacl
Storing debug log for failure in /root/.pip/pip.log
The command '/bin/sh -c pip install crossbar[all]' returned a non-zero code: 1它似乎可以通过以下方式解决:
RUN pip install --upgrade cffi在运行pip之前,安装crossbarall
有了这个环境,我的问题就解决了:)我不知道为什么我以前会得到这个错误,但这是工作。
非常感谢这里的所有人和indexerror,“法语python stackoverflow”:)
http://indexerror.net/3380/crossbar-0-12-1-wsgi-error-no-module-named-django?show=3415
附注:
下面是我使用的干净的Dockerfile:
FROM ubuntu
ENV APPNAME="monappli"
ADD requirements.txt /tmp/
RUN apt-get update
RUN apt-get install -y gcc build-essential python-dev python2.7-dev libxslt1-dev libssl-dev libxml2 libxml2-dev tesseract-ocr python-imaging libffi-dev libreadline-dev libbz2-dev libsqlite3-dev libncurses5-dev python-mysqldb python-pip
RUN cd /tmp/ && pip install -r requirements.txt
RUN pip install -U crossbar[all]
WORKDIR $APPNAME
CMD cd / && cd $APPNAME && python manage.py makemigrations && python manage.py migrate && crossbar start使用Django、flask和/或你想要的所有依赖项,在与Docker文件相同的文件夹中名为"requirements.txt“的文件中:
requirements.txt ex:
ipython
django
djangorestframework
djangorestframework-jwt
django-cors-headers
bottlenose
python-amazon-simple-product-api
python-dateutil
beautifulsoup4
datetime
mechanize
pytesseract
requestshttps://stackoverflow.com/questions/35290280
复制相似问题