我在http://opencalaccess.org/ccdc/latest/部署了一个应用程序
这是一个运行 Ubuntu 14.04 LTS 的主机。
如果你点击这个,你可能会得到一个空白页,上面写着“服务器错误(500)”,没有别的。您可能会收到 NoReverseMatch 异常。如果您继续在该 URL 上获取,它将起作用。可能需要 3 次,但似乎不超过 5 次尝试。它总是有效的,最终。
诡异的。
我依赖于我正在构建的两个包。我将它们移动了几次,现在位于:
/usr/local/lib/python2.7/dist-packages
和
$ cat wsgi.py
import os
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ccdc.settings")
sys.path.append('/var/www/opencalaccess_org/ccdc')
sys.path.append('/var/www/opencalaccess_org')
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
我不必更改我的 settings.py 文件。
$ cat urls.py
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^', include('calaccess_campaign_browser.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.STATIC_ROOT,
'show_indexes': True,
}),
)
我应该在这里看什么?有什么建议么?其他入口点也有同样的问题。然后他们也工作。
来自 /var/www/opencalaccess_org/ccdc/settings.py 文件:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'calaccess_raw',
'calaccess_campaign_browser',
'tastypie',
)
和
$ cat /usr/local/lib/python2.7/dist-packages/calaccess_campaign_browser/urls.py
from django.conf.urls import patterns, include, url
from tastypie.api import Api
from django.views.generic.base import RedirectView
from calaccess_campaign_browser.api import FilerResource, FilingResource
from calaccess_campaign_browser import views
from calaccess_campaign_browser.views import search
from calaccess_campaign_browser.views import identities
from django.views.generic import TemplateView
# Set up the endpoints for the REST service.
#
# Usage:
#
# http://<hostname>:<port>//api/v1/
# http://<hostname>:<port>//api/v1/filer/
# http://<hostname>:<port>//api/v1/filing/?filing_id_raw=1852192'
#
v1_api = Api(api_name='v1')
v1_api.register(FilerResource())
v1_api.register(FilingResource())
# Set up the endpoints for the web application.
#
urlpatterns = patterns(
'',
url(r'^$', RedirectView.as_view(url='/latest/', permanent=False)),
url(
r'^latest/$',
views.LatestFilingView.as_view(),
name='latest_list'
),
url(
r'^filers/$',
RedirectView.as_view(url='/filers/1/', permanent=False),
name="filer_list"
),
url(
r'^filers/(?P<page>[\d+]+)/$',
views.FilerListView.as_view(),
name='filer_page'
),
url(
r'^filer/(?P<pk>\d+)/$',
views.FilerDetailView.as_view(),
name='filer_detail'
),
url(
r'^committee/(?P<pk>\d+)/contributions/(?P<page>[\d+]+)/$',
views.CommitteeContributionView.as_view(),
name='committee_contribution_list',
),
url(
r'^committee/(?P<pk>\d+)/expenditures/(?P<page>[\d+]+)/$',
views.CommitteeExpenditureView.as_view(),
name='committee_expenditure_list',
),
url(
r'^committee/(?P<pk>\d+)/filings/(?P<page>[\d+]+)/$',
views.CommitteeFilingView.as_view(),
name='committee_filing_list',
),
url(
r'^committee/(?P<pk>\d+)/$',
views.CommitteeDetailView.as_view(),
name='committee_detail'
),
url(
r'^filing/(?P<pk>\d+)/$',
views.FilingDetailView.as_view(),
name='filing_detail'
),
url(
r'^contribution/(?P<pk>\d+)/$',
views.ContributionDetailView.as_view(),
name='contribution_detail'
),
url(
r'^expenditure/(?P<pk>\d+)/$',
views.ExpenditureDetailView.as_view(),
name='expenditure_detail',
),
url(r'^search/$', search.SearchList.as_view(), name='search-list'),
url(
r'^search/contribs-by-name/$',
search.search_contribs_by_name,
name='search-contribs-by-name'
),
url(
r'^parties/$',
views.PartyListView.as_view(),
name='party_list'
),
url(
r'^identities/$',
identities.IdentitiesList.as_view(),
name='identities-list'
),
url(
r'^identities/identities-by-name/$',
identities.search_identities_by_name,
name='search-identities-by-name'
),
# API
url(r'^api/', include(v1_api.urls)),
url(
r'^robots\.txt$',
TemplateView.as_view(
template_name='robots.txt',
content_type='text/plain')
),
)