我正在尝试设置一个Django 1.7项目来推送到openshift。我正在关注https://github.com/jfmatth/openshift-django17。我成功地将初始项目转移到本地,现在我正在尝试将本地项目移动到此文件结构中,以便我可以部署它。
我可以在本地运行该项目。推到openshift后,我看到:
remote: Starting Python 2.7 cartridge (Apache+mod_wsgi)
remote: Application directory "wsgi/" selected as DocumentRoot
remote: $OPENSHIFT_PYTHON_WSGI_APPLICATION ENV VAR detected
remote: Application "mysite/wsgi.py" selected as default WSGI entry point
remote: --> ACTION HOOK: post_deploy <--
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://54***00003f@***-***.rhcloud.com/~/git/**.git/
0a488d3..5af95ee master -> master
mysite.urls.py包含:
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^index/', 'app1.views.index', name='index'),
url(r'^contact/$', 'app1.views.contact', name='contact'),
url(r'^admin/', include(admin.site.urls)),
)
mysite.views包含:
from django.views.generic import View
from django.http import HttpResponse
class Index(View):
def get(self, request, *args, **kwargs):
return HttpResponse('django 1.7 on Openshift')
当我打开openshift网址时,我得到了!:
Not Found . The requested URL / was not found on this server.
模板都在模板文件夹中(在屏幕截图中)。我从静态根目录下复制了它。
如何让项目在openshift部署中运行?
答案 0 :(得分:1)
比尔,你有这个托管在github上的回购吗?如果是这样,请在此处粘贴链接,我可以查看所有文件以查找您的问题。
如果没有,请发布您的URLs.py和dViews.py
在添加您想要更改的任何内容之前,您是否首先使用基本仓库?意思是,按照我的指示,在repo上写信,让它在本地运行,然后在OS上运行?
当人们首先运行基本安装,然后添加他们的逻辑时,我有几个问题/问题。