0

this is my urls:

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 )

this is my settings:

# 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/"

my media files are all in:

C:\wamp64\www\mooimom_django\mooimom_id\user_uploads\folder_name\file_names

static files are mostly in: C:\wamp64\www\mooimom_django\mooimom_id\static\folder_names

When debug is True, the images works fine, but when i turn it into False, only images from {% static %} shows up. The rest gets 404.

RaR
  • 193
  • 1
  • 13

1 Answers1

0

As the documentation for the static helper clearly states, this works only when DEBUG is True.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
  • 1
    but my static files are working fine, it's files from Media folders that are not showing up / 404 – RaR May 16 '17 at 09:07
  • 1
    This does not work on DEBUG false: http://127.0.0.1:8000/media/filer_public/93/3e/933e7635-4f20-42d4-aee9-8f9233989ab2/v-neck-maternity-nursing-bra-top.jpg – RaR May 16 '17 at 09:08
  • But you're using the static helper. It does not work when DEBUG is false. Why won't you set it to true? You should have it set in development anyway as it helps debugging. – Daniel Roseman May 16 '17 at 09:11
  • 1
    because i want to upload the files to the webserver. – RaR May 16 '17 at 09:14
  • What? That sentence seems to have no relation to any previous comment. If you want this to work in development, set DEBUG to True. – Daniel Roseman May 16 '17 at 09:17
  • 1
    sorry, i am quite new with django, what i was trying to do is to make sure my website works even when DEBUG is False, my site is already working when DEBUG is true. – RaR May 16 '17 at 09:18
  • 1
    but when DEBUG is false, the media files all get 404, but the images from {% static %} works. – RaR May 16 '17 at 09:18