我已经部署了我的网站,并希望常规(登录)用户能够上传图片,如何在git主页/自述文件中描述:
将CKEditor URL include添加到项目的urls.py文件中:
(r'^ ckeditor /',include('ckeditor_uploader.urls')), 请注意,通过添加这些网址,您可以添加可以上传和浏览上传图片的视图。由于django-ckeditor 4.4.6,这些视图是staff_member_required。如果你想要不同的权限装饰器(login_required,user_passes_test等),那么手动将ckeditor.urls中定义的视图添加到你的urls.py。
这是我的urls.py文件:
from django.conf.urls import url, include
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
# ex: /reports/5/
url(r'^(?P<report_id>[0-9]+)/$', views.detail, name='detail'),
url(r'^create/$', views.create, name='create'),
url(r'^create2/$', views.reportsparticipants, name='reportsparticipants'),
url(r'^addparticipants/$', views.addparticipants, name='addparticipants'),
url(r'^(?P<report_id>[0-9]+)/like/$', views.like, name='like'),
url(r'^(?P<report_id>[0-9]+)/dislike/$', views.dislike, name='dislike'),
url(r'^deleteparticipant/(?P<part_id>[0-9]+)/$', views.deleteparticipant, name='deleteparticipant'),
url(r'^modify/(?P<report_id>[0-9]+)/$', views.modify, name='modify'),
url(r'^modifyparticipants/(?P<report_id>[0-9]+)/$', views.modifyparticipants, name='modifyparticipants'),
url(r'^deleteparticipantmodify/(?P<part_id>[0-9]+)/(?P<report_id>[0-9]+)/$', views.deleteparticipantmodify, name='deleteparticipantmodify'),
url(r'^reportadded/$', views.reportadded, name='reportadded'),
url(r'^commented/(?P<report_id>[0-9]+)/$', views.commented, name='commented'),
url(r'^ckeditor/', include('ckeditor_uploader.urls')),
#url(r'^liked/(?P<report_id>[0-9]+)/$', views.liked, name='liked'),
url(r'^dc/$', views.dc, name='dc'),
]
我想不出我的urls.py文件对步骤2中描述的所需状态的适当更改
答案 0 :(得分:0)
# urls.py
urlpatterns = [
# Your urlpatterns...
]
from django.contrib.auth.decorators import login_required
from ckeditor_uploader.views import upload
urlpatterns += [
url(r'^ckeditor/upload/', login_required(upload), name='ckeditor_upload'),
url(r'^ckeditor/', include('ckeditor_uploader.urls')),
]
这会起作用