I have created a Django 1.3 application on Openshift. I wanted to upgrade to Django 1.5. So I updated setup.py to install Django 1.5
我在Openshift上创建了一个Django 1.3应用程序。我想升级到Django 1.5。所以我更新了setup.py来安装Django 1.5
#!/usr/bin/env python
from setuptools import setup
setup(
name='<Application name>',
version='1.0',
description='',
author='',
author_email='',
url='http://www.python.org/sigs/distutils-sig/',
install_requires=['Django>=1.5'],
)
The server returns http 500.
服务器返回http 500。
If setup.py has install_requires=['Django<=1.4']
it works fine.
如果setup.py有install_requires = ['Django <= 1.4'],它可以正常工作。
How can I install Django 1.5 on Openshift?
如何在Openshift上安装Django 1.5?
Update: I can see a github commit where in the install_requires for Django is changed from >=1.3 to <=1.4 for the handling this same issue. But I still cannot figure out what caused that server 500 and how can we install Django 1.5 on openshift
更新:我可以看到一个github提交,其中在Django的install_requires中,从> = 1.3变为<= 1.4,以处理同样的问题。但我仍然无法弄清楚导致服务器500的原因以及如何在openshift上安装Django 1.5
3 个解决方案
#1
1
It might come from your code, did you check the backwards incompatibilities mentioned in the release notes (mainly ALLOWED_HOSTS required in your settings.py)
它可能来自您的代码,您是否检查了发行说明中提到的向后不兼容性(主要是您在settings.py中需要的ALLOWED_HOSTS)
It could also come from the {% url %}
tag syntax change, see here.
它也可能来自{%url%}标记语法更改,请参见此处。
#2
0
When i installed Django app on OpenShift, Django version was 1.5.1. I think OpenShift install last version Django, because the condition Django >= 1.4, that is no lower this version.
当我在OpenShift上安装Django应用程序时,Django版本为1.5.1。我认为OpenShift安装了最后一个版本的Django,因为条件Django> = 1.4,这个版本没有降低。
That is screenshot, when i installed app
这是截图,当我安装应用程序
#3
0
I had the same issue : from your screenshot you're using python2.6 ?
我有同样的问题:从你的截图你使用python2.6?
Try to use python2.7 with this configurations put on the application file:
尝试使用python2.7将此配置放在应用程序文件中:
#!/usr/bin/env python
import os
import sys
sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR']))
os.environ['DJANGO_SETTINGS_MODULE'] = 'mywebsite.settings'
virtenv = os.environ['OPENSHIFT_HOMEDIR'] + 'python/virtenv/'
os.environ['PYTHON_EGG_CACHE'] = os.path.join(virtenv, 'lib/python2.7/site-packages')
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
pass
#
# IMPORTANT: Put any additional includes below this line. If placed above this
# line, it's possible required libraries won't be in your searchable path
#
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
And as refered by @Charles L try to set the settings using allowed host
并且如@Charles L所述,尝试使用允许的主机设置设置
#1
1
It might come from your code, did you check the backwards incompatibilities mentioned in the release notes (mainly ALLOWED_HOSTS required in your settings.py)
它可能来自您的代码,您是否检查了发行说明中提到的向后不兼容性(主要是您在settings.py中需要的ALLOWED_HOSTS)
It could also come from the {% url %}
tag syntax change, see here.
它也可能来自{%url%}标记语法更改,请参见此处。
#2
0
When i installed Django app on OpenShift, Django version was 1.5.1. I think OpenShift install last version Django, because the condition Django >= 1.4, that is no lower this version.
当我在OpenShift上安装Django应用程序时,Django版本为1.5.1。我认为OpenShift安装了最后一个版本的Django,因为条件Django> = 1.4,这个版本没有降低。
That is screenshot, when i installed app
这是截图,当我安装应用程序
#3
0
I had the same issue : from your screenshot you're using python2.6 ?
我有同样的问题:从你的截图你使用python2.6?
Try to use python2.7 with this configurations put on the application file:
尝试使用python2.7将此配置放在应用程序文件中:
#!/usr/bin/env python
import os
import sys
sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR']))
os.environ['DJANGO_SETTINGS_MODULE'] = 'mywebsite.settings'
virtenv = os.environ['OPENSHIFT_HOMEDIR'] + 'python/virtenv/'
os.environ['PYTHON_EGG_CACHE'] = os.path.join(virtenv, 'lib/python2.7/site-packages')
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
pass
#
# IMPORTANT: Put any additional includes below this line. If placed above this
# line, it's possible required libraries won't be in your searchable path
#
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
And as refered by @Charles L try to set the settings using allowed host
并且如@Charles L所述,尝试使用允许的主机设置设置