Where is media being served from?

I'm running Windows XP and the latest released version of PyCharm.  I have virtualenv set up and I've put my Django specific items in there. When I run the development server from PyCharm, it can obviously find the admin media files, but I'm not sure where to put MY media files. I looked in the settings area and didn't see anywhere to modify the path that is being passed to runserver.py. I'm assuming it's just using http://docs.djangoproject.com/en/dev/ref/django-admin/#djadminopt---adminmedia and not some other funky pathing hacks.

I tried to change the MEDIA_ROOT setting and copy the admin media into it, but I got a permission denied message because Django's server tries to serve up a /favicon.ico/ path. I may just not be familiar enough with Windows+Django, but any help would be awesome.

0

Hello Daniel,

In the latest PyCharm build, the Django run configuration has an "Additional

options" field where you can specify the --adminmedia or other parameters

that you need. We don't do any pathing hacks ourselves.

I'm running Windows XP and the latest released version of PyCharm.  I

have virtualenv set up and I've put my Django specific items in there.

When I run the development server from PyCharm, it can obviously find

the admin media files, but I'm not sure where to put MY media files. I

looked in the settings area and didn't see anywhere to modify the path

that is being passed to runserver.py. I'm assuming it's just using

http://docs.djangoproject.com/en/dev/ref/django-admin/#djadminopt---ad

minmedia and not some other funky pathing hacks.

I tried to change the MEDIA_ROOT setting and copy the admin media into

it, but I got a permission denied message because Django's server

tries to serve up a /favicon.ico/ path. I may just not be familiar

enough with Windows+Django, but any help would be awesome.

---

Original message URL:

http://www.jetbrains.net/devnet/message/5257665#5257665

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0
Avatar
Permanently deleted user

Thanks Dmitry ... I got it working after a couple hours in #django on IRC,

Turns out, if anyone else is having similar issues, that the Django development server does not serve static files... except for the admin files. It serves those with some behind the scenes magic.  This is important because if you want to serve static files in a development environment you have to follow the instructions here.

However, the ADMIN_MEDIA_PREFIX is normally set to '/media/' by default, which means if you set up a static URL at '^media/(?P<path>.*)$' (like I did initially) it will conflict with the special admin file serving and you'll get 404's if you try to access stuff there, which is why in the Django docs they use r'^site_media/(?P<path>.*)$' in the serve() method.

Cheers,

Dan

0

请先登录再写评论。