On Apr 1, 3:12 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Wed, Apr 1, 2009 at 2:52 PM, Dan Jewett <solidet...@gmail.com> wrote:
>
> > I'm using the following settings:
>
> > MEDIA_ROOT = '/Users/dan/projects/some_project/files/'
>
> > # static files
> >        (r'^files/(?P<path>.*)$', 'django.views.static.serve',
> > {'document_root': '/Users/dan/projects/some_project/files'}),
>
> > In an app called 'collaborate' I have a model that looks like this:
> > class Resource(models.Model):
> >    topic = models.ForeignKey('Topic')
> >    name = models.CharField(max_length=150)
> >    description = models.CharField(blank=True, max_length=250)
> >    resource_file = models.FileField(upload_to='resource_files')
>
> > The file uploads properly but the link to it in the admin looks like
> > this:
> >http://localhost:8000/admin/collaborate/resource/1/resource_files/rhi...
>
> > But this is where it lives:
> >http://localhost:8000/files/resource_files/rhino.png
>
> > Is this only an issue in development with serving static files? If
> > not, do I have a settings error?
>
> You need to set MEDIA_URL 
> (http://docs.djangoproject.com/en/dev/ref/settings/#media-url) to match the
> url prefix you've chosen for serving up your uploaded files.  That is:
>
> MEDIA_URL = '/files/'
>
> in your case.
> .
> Karen

Oh for Pete's sake, of course. Thank you Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to