如何将第三方可重用应用程序添加到 django 并在 openshift 中部署?
How do you add a third party reusable app to django and deploy in openshift?
我使用部署在 openshift 上的 django 构建了一个网络应用程序。我正在尝试添加第三方可重复使用的应用程序 markdown-deux。我已经按照安装说明(使用 pip)进行操作,它在本地主机开发服务器上运行良好。
我已将 'markdown_deux' 添加到我的 settings.py 中,并尝试使用和不使用 requirements.txt。但是,我仍然收到 500 错误,并且 rhc tail 错误 "Import error: no module named markdown_deux".
我已经尝试重新启动我的应用程序并重新同步数据库,但我仍然遇到同样的错误。我有 RTFM 但无济于事。
您已经使用 pip 在本地安装它,但实际上您还需要在您的服务器上安装它。通常您会通过将其添加到 requirements.txt
文件并确保您的部署过程包括服务器上的 运行 pip install -r requirements.txt
。
Openshift 具有在每个 git push
之后自动检查和添加依赖项的机制,具体取决于您的应用程序类型。所以你不需要手动安装依赖。
对于 python 个应用程序修改项目 setup.py
。
Python application owners should modify setup.py
in the root of the git repository with the list of dependencies that will be installed using easy_install
. The setup.py
should look something like this:
from setuptools import setup
setup(name='YourAppName',
version='1.0',
description='OpenShift App',
author='Your Name',
author_email='example@example.com',
url='http://www.python.org/sigs/distutils-sig/',
install_requires=['Django>=1.3', 'CloudMade'],
)
阅读 Openshift Help Center 中的所有详细信息。
我使用部署在 openshift 上的 django 构建了一个网络应用程序。我正在尝试添加第三方可重复使用的应用程序 markdown-deux。我已经按照安装说明(使用 pip)进行操作,它在本地主机开发服务器上运行良好。
我已将 'markdown_deux' 添加到我的 settings.py 中,并尝试使用和不使用 requirements.txt。但是,我仍然收到 500 错误,并且 rhc tail 错误 "Import error: no module named markdown_deux".
我已经尝试重新启动我的应用程序并重新同步数据库,但我仍然遇到同样的错误。我有 RTFM 但无济于事。
您已经使用 pip 在本地安装它,但实际上您还需要在您的服务器上安装它。通常您会通过将其添加到 requirements.txt
文件并确保您的部署过程包括服务器上的 运行 pip install -r requirements.txt
。
Openshift 具有在每个 git push
之后自动检查和添加依赖项的机制,具体取决于您的应用程序类型。所以你不需要手动安装依赖。
对于 python 个应用程序修改项目 setup.py
。
Python application owners should modify
setup.py
in the root of the git repository with the list of dependencies that will be installed usingeasy_install
. Thesetup.py
should look something like this:
from setuptools import setup
setup(name='YourAppName',
version='1.0',
description='OpenShift App',
author='Your Name',
author_email='example@example.com',
url='http://www.python.org/sigs/distutils-sig/',
install_requires=['Django>=1.3', 'CloudMade'],
)
阅读 Openshift Help Center 中的所有详细信息。