scipy-latinamerica / scipyla2016

13 stars 14 forks source link

Bug on server send empty address for sponsor logo #78

Closed rgaiacs closed 8 years ago

rgaiacs commented 8 years ago

On the production server we are getting

<a href="http://github.com/">
<img src="" alt="GitHub" style="display: block;margin: 1em auto;">
</a>

when we should get

<a href="http://github.com/">
<img src="/scipyla2016/site_media/media/sponsor_files/GitHub_Logo.png.250x90_q85.png" alt="GitHub" style="display: block;margin: 1em auto;">
</a>

@xmnlab @leliel12 @knabben Could you help debug this and provide a solution?

How to reproduce

  1. Go to http://conf.scipyla.org/scipyla2016/.
  2. Log in with a administrator account.
  3. Go to http://conf.scipyla.org/scipyla2016/admin/sponsorship/sponsor/5/.
  4. Active the sponsor.
rgaiacs commented 8 years ago

More info: from the admin panel, the address of the log is http://conf.scipyla.org/scipyla2016/site_media/media/sponsor_files/GitHub_Logo_a073ntR.png but we get "Page not found" from it.

rgaiacs commented 8 years ago

@codersquid Sorry to disturb you, but do you have any idea of what could be the origin of this problem? Thanks in advance.

rgaiacs commented 8 years ago

@xmnlab If anyone solve this problem today, February 17th, I will hard code the logos as a workaround.

xmnlab commented 8 years ago

@knabben vc poderia nos dar uma força com essa issue?

rgaiacs commented 8 years ago

website-scipyla2016/scipyla2016/settings.py has

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.join(PACKAGE_ROOT, "site_media", "media")

If we look at website-scipyla2016/scipyla2016/site_media/media/sponsor_files/ we will have

Github_7iP29kZ.png
Github_7iP29kZ.png.250x90_q85.png
Github_fCzc55T.png
GitHub_Logo_a073ntR.png
GitHub_Logo_a073ntR.png.250x90_q85.png
GitHub_Logo.png
Github.png
Github.png.250x90_q85.png

So http://conf.scipyla.org/scipyla2016/site_media/media/sponsor_files/GitHub_Logo_a073ntR.png should return the correct image like http://conf.scipyla.org/scipyla2016/site_media/static/img/logo2-scipyla-path.svg.

rgaiacs commented 8 years ago

The bug is because of

if settings.DEBUG:
    urlpatterns += patterns(
        '',
        url(r'^site_media/media/(?P<path>.*)$',
            'django.views.static.serve',
            {'document_root': settings.MEDIA_ROOT}),
    )

on website-scipyla2016/scipyla2016/_urls.py.

rgaiacs commented 8 years ago

screen shot 2016-02-25 at 08 54 34

screen shot 2016-02-25 at 08 55 08