配置Django FileBrowser

时间:2018-09-06 12:58:26

标签: python django

为了通过管理员上传图像或其他媒体文件,我安装了filebrowser。此外,我需要Tinymce的文件浏览器。但是我有以下问题。顺便说一下,我安装的文件浏览器不包含grapelli。

settings.py:

STATIC_URL = '/static/'

MEDIA_URL = '/media/'

STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_cdn")

SITE_ROOT = os.path.realpath(os.path.dirname(__file__))

MEDIA_ROOT = os.path.join(SITE_ROOT, "media_cdn")

STATICFILES_DIRS =[
   os.path.join(BASE_DIR, "static"),
]

和url.py如下:

from django.conf import settings
from django.conf.urls.static import static
from filebrowser.sites import site

urlpatterns = [
    path('admin/', admin.site.urls),
    path('admin/filebrowser/', site.urls),
    path('tinymce/', include('tinymce.urls')),
    path('', views.home, name='home'),
    path('products/', include('insuranceProducts.urls', namespace='insurance')),
    path('about_us/', include('aboutUs.urls', namespace='about_us')),
    path('paparazzi/', include('paparazzi.urls', namespace='paparazzi')),

]

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root = settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)

除了我正在使用Django 2.0和django-tinymce4-lite

0 个答案:

没有答案