【发布时间】:2017-10-15 06:17:31
【问题描述】:
这是我的网址:
urlpatterns = [
url(r'^', include('my_website.urls')),
url(r'^tinymce/', include('tinymce.urls')),
url(r'^filer/', include('filer.urls')),
url(r'^ckeditor/', include('ckeditor_uploader.urls')),
url(r'^admin/', admin.site.urls),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT + os.path.altsep )
这是我的设置:
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
MEDIA_ROOT = os.path.join(BASE_DIR, "mooimom_id", "user_uploads")
MEDIA_URL = "/media/"
我的媒体文件都在:
C:\wamp64\www\mooimom_django\mooimom_id\user_uploads\folder_name\file_names
静态文件主要位于: C:\wamp64\www\mooimom_django\mooimom_id\static\folder_names
当 debug 为 True 时,图像工作正常,但当我将其变为 False 时,仅显示来自 {% static %} 的图像。其余的得到 404。
【问题讨论】:
-
这是本地主机(我自己的计算机),还没有在实时服务器中
-
对不起,我不明白你的问题,我对 Django 很陌生
-
我不明白,我需要做什么?
-
谢谢,不过我的 django 不使用 wamp,我只是将所有项目都放在那个文件夹中,我的网络服务器是 pycharm 2017
-
我在pycharm上使用“运行”和“调试”,
标签: django