Giter Club home page Giter Club logo

Comments (21)

dcramer avatar dcramer commented on August 24, 2024

I think we actually serve static (in production) using these and they dont cause any issues. Are you seeing specific problems other than Django 1.3's changes?

from sentry.

evanreiser avatar evanreiser commented on August 24, 2024

No looks good, i just ended up renaming /media/ to /static/ and changing the {% url sentry-media %} to use {{STATIC_URL}} for django 1.3 and that works fine

Maybe a better solution would be to allow the user to override by creating a SENTRY_MEDIA_URL in the settings or something

from sentry.

dcramer avatar dcramer commented on August 24, 2024

Going to add in a SENTRY_MEDIA_PREFIX in the next build

from sentry.

victorhooi avatar victorhooi commented on August 24, 2024

heya,

I'm a bit confused - what is the current status on serving up static media then?

For now, I've just manually copied the static assets for sentry (site-packages/sentry/media) into a folder, and I'm serving it with Nginx:

location /sentry/_media/ {
    alias /sites/mediatracking.au.db.com/sentry/_media/;
}

I'm on Django 1.3, using staticfiles. Will there be integration then with staticfiles in the next release of django-sentry?

Cheers,
Victor

from sentry.

dcramer avatar dcramer commented on August 24, 2024

I forgot about this in the last release. I'll probably do one more minor release with this fix, and then we'll be moving Sentry into Nexus (which handles media in a similar fashion, but has a MEDIA_PREFIX option already)

from sentry.

victorhooi avatar victorhooi commented on August 24, 2024

heya,

Aha, awesome, looking forward to it then =).

So Sentry will be integrated with staticfiles, and it'll get collected with collecstatic? The new way of handling static media in Django 1.3 is so much simpler.

Hmm, I just saw your Nexus project, it seems very cool grins. Definitely going to keep my eyes on this one. Good luck!

Cheers,
Victor

from sentry.

schinckel avatar schinckel commented on August 24, 2024

I solved it by using the following in my settings.py

import sentry
STATICFILES_DIRS = (
    ('sentry', path(sentry.__file__).dirname() / 'media'),
)

from sentry.

wolph avatar wolph commented on August 24, 2024

When installing Sentry I actually had the same issue, I solved it with an (imho clean) workaround.

I have added an extra url to my urls.py:

url(                                                                        
    r'^media/sentry/(?P<path>.*)$',                                         
    'django.views.static.serve',                                            
    {'document_root': os.path.join(sentry_urls.SENTRY_ROOT, 'media')},      
    name='sentry-media',                                                    
),                                                                          

And symlinked <SENTRY_DIR>/media to media/sentry. After that the normal MEDIA_URL setting does the trick.

This way both the developent and normal settings work just fine. When running through Apache/Nginx it will use the Alias I've set. When running the development server it uses the build-in static server.

from sentry.

schinckel avatar schinckel commented on August 24, 2024

WoLpH: I think that's the wrong way to do it, as it uses django's static file serving, rather than whatever static files serving method is used.

from sentry.

wolph avatar wolph commented on August 24, 2024

@schinckel: Actually, it doesn't. With the Alias I have in Apache it overrides the Django url completely. If you don't have the Apache overrides set than it will fallback to Django.

Do note that Django doesn't even allow static media serving with production settings so it wouldn't even work.

from sentry.

schinckel avatar schinckel commented on August 24, 2024

Ah, okay. That makes sense.

from sentry.

bkeating avatar bkeating commented on August 24, 2024

This has my vote. I could allow nginx to fix this issue but i am in favor of doing it right. SENTRY_MEDIA_PREFIX.

from sentry.

zodiak avatar zodiak commented on August 24, 2024

It seems very sad what i learned today about sentry.
It is very wrong solution to use url(r'^_media/(?P.*)$'
Why ? Because some people use django-staticfile, which will be a part of django.contrib in 1.3 (a use it in 1.2)
There are 2 issues:

  1. django-staticfiles command 'collectstatic' puts all media together in e.g 'static' folder. But sentry stores all media not in sentry/media/sentry/js, sentry/media/sentry/css, sentry/media/sentry/img.
    It stores mediafiles in sentry/media/js, etc. This is wrong, because when 'collectstatic' copies media to 'static' folder, it puts media in static/js but not in static/sentry/css
  2. django-staticfiles will serve static files in DEBUG mode. In production web-server should do this

from sentry.

zodiak avatar zodiak commented on August 24, 2024

and ofcourse there should be optional SENTRY_MEDIA_PREFIX in settings

from sentry.

brutasse avatar brutasse commented on August 24, 2024

I just committed a fix for this in my fork:

https://github.com/brutasse/django-sentry/commit/34ec4ed047e811612751424f6b7e942a6fa9e292

This makes sentry compatible with django-staticfiles and contrib.staticfiles. For django < 1.3, people will need to install django-staticfiles. This probably needs to be documented but django-staticfiles shouldn't be in install_requires.

@dcramer: what do you think about moving nexus / sentry's media handling to the django-staticfiles way? This is becoming the standard for app-provided static files and really simplifies the process for users. Let me know if I need to open a pull request, I wanted to discuss it here first.

from sentry.

dcramer avatar dcramer commented on August 24, 2024

Will pull in your patch as soon as I bust out the git-capable machine.

Regarding staticfiles, it will probably happen, but doing it within Nexus as a whole is a bit more complicated. We want to support a bunch of frameworks in Nexus, which means the default way will just be having our own custom static serving code, but ideally falling back to platform-specifics when it can.

from sentry.

brutasse avatar brutasse commented on August 24, 2024

Ok. I realized I forgot to edit the MANIFEST file after the media -> static/sentry change, so there's an additional commit to cherry-pick:

https://github.com/brutasse/django-sentry/commit/22ce7f7f876d6d5a0d5b9e5fcbb1ee731303a9f8

from sentry.

dcramer avatar dcramer commented on August 24, 2024

Added support for staticfiles (without removing default media serving) in dcramer/django-sentry@b286099

from sentry.

bkeating avatar bkeating commented on August 24, 2024

NICE! Thanks David.

from sentry.

digitalpbk avatar digitalpbk commented on August 24, 2024

Hi,

I no longer can find this setting, is this gone again ?

Thanks

from sentry.

blite avatar blite commented on August 24, 2024

I too am basically seeing no way to configure this setting, not to mention that the media just plain doesn't load for me. I'm using the lastest version from cheeseshop and also just tried the github trunk

from sentry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.