Josh's approach works for me - nevertheless the improvement of the runserver command also is a cool idea. Thanks very much!
Am Dienstag, 4. Februar 2014 21:44:16 UTC+1 schrieb Stephen McDonald: > > Mezzanine, and actually Django itself, normally doesn't serve files under > the project's STATIC_ROOT directory during development - files in that > location typically aren't expected to be part of the version controlled > project. The recommended approach is for all static files to be contained > within the "static" directory of their relevant app (as per INSTALLED_APP), > which might be as simple as a "theme" app. As you might know already, all > these files then get copied to STATIC_ROOT when the collectstatic > management command is run, as part of your deployment process. > > As for files under MEDIA_URL (user uploaded files), Django will happily > serve these during development, but actively blocks the questionable > practise of having MEDIA_URL fall under STATIC_URL, as Mezzanine does by > default (more info here: > https://code.djangoproject.com/ticket/15199).Tired, beaten down, yet > still refusing to submit to every peculiar whim of Django, Mezzanine > defiantly works around this by providing its own shadowed version of > runserver, which restores the ability to serve up files under MEDIA_URL > during development. > > Given all that, I've just modified Mezzanine's runserver to also serve up > files under STATIC_ROOT, so while it's probably not an ideal location to > store files, it'll work locally now as it would when deployed. > > > https://github.com/stephenmcd/mezzanine/commit/67aaae401fe47c55960236c8f3472f2d4c16e3d0 > > > > > > On Wed, Feb 5, 2014 at 4:26 AM, Sebastian Clemens < > [email protected] <javascript:>> wrote: > >> Ok, I made a new default project. Than I created a new file >> /static/css/test.css >> Than at http://127.0.0.1:8080/static/css/test.css >> I get 'css/test.css' could not be found. >> >> As you see it removes the /static/ >> >> Can you reproduce this? >> >> >> Am 04.02.2014 18:17, schrieb Josh Cartmell: >> >> I would compare your settings.py to the default one ( >> https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/project_template/settings.py) >> >> and see if there are any differences. If you start a new Mezzanine project >> does it work? >> >> >> On Tue, Feb 4, 2014 at 9:10 AM, Sebastian Clemens < >> [email protected] <javascript:>> wrote: >> >>> Oh, of course >>> >>> Traceback (most recent call last): >>> File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run >>> self.result = application(self.environ, self.start_response) >>> File >>> "/home/basti/Dokumente/websites/virtualenv/local/lib/python2.7/site-packages/Django-1.6.1-py2.7.egg/django/contrib/staticfiles/handlers.py", >>> >>> line 68, in __call__ >>> return super(StaticFilesHandler, self).__call__(environ, >>> start_response) >>> File >>> "/home/basti/Dokumente/websites/virtualenv/local/lib/python2.7/site-packages/Django-1.6.1-py2.7.egg/django/core/handlers/wsgi.py", >>> >>> line 206, in __call__ >>> response = self.get_response(request) >>> File >>> "/home/basti/Dokumente/websites/virtualenv/src/mezzanine/mezzanine/core/management/commands/runserver.py", >>> >>> line 15, in get_response >>> return serve(request, path, document_root=settings.STATIC_ROOT) >>> File >>> "/home/basti/Dokumente/websites/virtualenv/local/lib/python2.7/site-packages/Django-1.6.1-py2.7.egg/django/views/static.py", >>> >>> line 55, in serve >>> raise Http404(_('"%(path)s" does not exist') % {'path': fullpath}) >>> Http404: "media/car_images/hirn25_1.png" ist nicht vorhanden >>> [04/Feb/2014 18:06:57] "GET /static/media/car_images/hirn25_1.png >>> HTTP/1.1" 500 59 >>> >>> Here you can see the given url is /static/media/, but it's looking for >>> /media/ >>> My settings are like this: >>> >>> # URL prefix for static files. >>> # Example: >>> "http://media.lawrence.com/static/"<http://media.lawrence.com/static/> >>> STATIC_URL = "/static/" >>> >>> # Absolute path to the directory static files should be collected to. >>> # Don't put anything in this directory yourself; store your static files >>> # in apps' "static/" subdirectories and in STATICFILES_DIRS. >>> # Example: "/home/media/media.lawrence.com/static/" >>> # STATIC_ROOT = os.path.join(PROJECT_ROOT, STATIC_URL.strip("/")) >>> >>> STATICFILES_DIRS = ( >>> os.path.join(PROJECT_ROOT, "static"), >>> ) >>> >>> # URL that handles the media served from MEDIA_ROOT. Make sure to use a >>> # trailing slash. >>> # Examples: >>> "http://media.lawrence.com/media/"<http://media.lawrence.com/media/>, >>> "http://example.com/media/" <http://example.com/media/> >>> MEDIA_URL = STATIC_URL + "media/" >>> >>> # Absolute filesystem path to the directory that will hold user-uploaded >>> files. >>> # Example: "/home/media/media.lawrence.com/media/" >>> MEDIA_ROOT = os.path.join(PROJECT_ROOT, *MEDIA_URL.strip("/").split("/")) >>> >>> What's wrong here? >>> >>> Am Dienstag, 4. Februar 2014 18:05:59 UTC+1 schrieb Josh Cartmell: >>>> >>>> Is a traceback displayed in the terminal that is running the dev >>>> server? I've seen errors like that when an error occurred and then Django >>>> created another error trying to produce the debug error page. >>>> >>>> >>>> On Tue, Feb 4, 2014 at 5:56 AM, Sebastian Clemens < >>>> [email protected]> wrote: >>>> >>>>> Hey, >>>>> >>>>> I'm using Ubuntu 13.10 and build sites on the development server >>>>> (manage.py runserver), but it doesn't serve media files. I tried it with >>>>> STATICFILES_DIR, but that changed nothing. On my productiv Debian 6 >>>>> Server, >>>>> everything works perfect. But locally I just get an "A server error >>>>> occurred. Please contact the administrator." >>>>> >>>>> What else can I try to solve this? >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Mezzanine Users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, >>>>> send an email to [email protected]. >>>>> >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Mezzanine Users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected] <javascript:>. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Mezzanine Users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/mezzanine-users/SnSEsx0g3lo/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Mezzanine Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > Stephen McDonald > http://jupo.org > -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
