这是我的问题: 我已经在OSQA中集成了PyBBM,并且程序包管理部分中的所有链接都是“已损坏”
所以例如当我点击“添加”时,来自
的网址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'
这是“论坛”的urls.py的一部分,是OSQA的应用程序
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/
链接断开可能会出现什么问题?
答案 0 :(得分:0)
更改Pybmm的管理网址解决了问题
try:
admin_url = url(r'^adminbb/', include(admin.site.root))#url(r'^%s(.*)' % _('nimda/'), admin.site.root)
except AttributeError:
admin_url = url(r'^adminbb/', include(admin.site.urls))#url(r'^%s(.*)' % _('nimda/'), admin.site.urls)