这是我的问题:我在 OSQA 中集成了 PyBBM,并且软件包管理部分中的所有链接都“损坏”
因此,例如,当我单击“添加”时,URL 来自
http://localhost:8080/osqa/nimda/
变成了
http://localhost:8080/osqa/nimda/(.*)pybb/category/add/
无需更改页面。
这是我项目的主要 urls.py 文件
from django.conf.urls.defaults import *
from django.utils.translation import ugettext as _
from django.conf import settings
urlpatterns = patterns('',
(r'', include('forum.urls')),
(r'^groups/', include('pybb.urls', namespace='pybb')), # PYBBM
)
if 'rosetta' in settings.INSTALLED_APPS:
urlpatterns = patterns('',
url(r'^rosetta/', include('rosetta.urls')),
) + urlpatterns
handler404 = 'forum.views.meta.page'
handler500 = 'forum.views.meta.error_handler'
这是 OSQA 的应用程序 'forum' 的 urls.py 的一部分
import startup
import os.path
from forum import settings
from django.conf.urls.defaults import *
from django.conf import settings as djsettings
from django.contrib import admin
from forum import views as app
from forum.sitemap import OsqaSitemap
from django.utils.translation import ugettext as _
import logging
admin.autodiscover()
sitemaps = {
'questions': OsqaSitemap
}
APP_PATH = os.path.dirname(__file__)
try:
admin_url = url(r'^%s(.*)' % _('nimda/'), admin.site.root)
except AttributeError:
admin_url = url(r'^%s(.*)' % _('nimda/'), admin.site.urls)
# Choose the user urls pattern
if bool(settings.INCLUDE_ID_IN_USER_URLS.value):
core_user_urls_prefix = r'^%s(?P<id>\d+)/(?P<slug>.*)'
else:
core_user_urls_prefix = r'^%s(?P<slug>.*)'
core_urls = (
url(r'^$', app.readers.index, name='index'), admin_url,
[...]
url(r'^%s$' % _('admin/'), app.admin.dashboard, name='admin_index'),
url(r'^%s%s$' % (_('admin/'), _('switch_interface/')), app.admin.interface_switch, name='admin_switch_interface'),
url(r'^%s%s$' % (_('admin/'), _('statistics/')), app.admin.statistics, name='admin_statistics'),
url(r'^%s%s$' % (_('admin/'), _('denormalize/')), app.admin.recalculate_denormalized, name='admin_denormalize'),
url(r'^%s%s$' % (_('admin/'), _('go_bootstrap/')), app.admin.go_bootstrap, name='admin_go_bootstrap'),
url(r'^%s%s$' % (_('admin/'), _('go_defaults/')), app.admin.go_defaults, name='admin_go_defaults'),
url(r'^%s%s(?P<set_name>\w+)/(?P<var_name>\w+)/$' % (_('admin/'), _('settings/')), app.admin.get_default, name='admin_default'),
url(r'^%s%s$' % (_('admin/'), _('maintenance/')), app.admin.maintenance, name='admin_maintenance'),
url(r'^%s%s$' % (_('admin/'), _('flagged_posts/')), app.admin.flagged_posts, name='admin_flagged_posts'),
url(r'^%s%s$' % (_('admin/'), _('static_pages/')), app.admin.static_pages, name='admin_static_pages'),
url(r'^%s%s%s$' % (_('admin/'), _('static_pages/'), _('new/')), app.admin.edit_page, name='admin_new_page'),
url(r'^%s%s%s(?P<id>\d+)/$' % (_('admin/'), _('static_pages/'), _('edit/')), app.admin.edit_page, name='admin_edit_page'),
url(r'^%s%s%s(?P<id>\d+)/$' % (_('admin/'), _('static_pages/'), _('delete/')), app.admin.delete_page, name='admin_delete_page'),
url(r'^%s%s(?P<name>\w+)/$' % (_('admin/'), _('tools/')), app.admin.tools_page, name='admin_tools'),
url(r'^%s%s(?P<set_name>\w+)/$' % (_('admin/'), _('settings/')), app.admin.settings_set, name='admin_set'),
url(r'%s%s' % (_('admin/'), _('test_email_settings/')), app.admin.test_email_settings, name='test_email_settings'),
如您所见,有两个管理部分,可通过两个不同的 URL 访问。
1) 对于 OSQA 的主管理页面:http://localhost:8080/osqa/admin/
2) 对于 PyBBM 包的管理页面(在文章的开头)http://localhost:8080/osqa/nimda/
断开的链接可能是什么问题?