Thursday, May 17, 2012

Re: Can't locate 'media' directory

hi,

you may try this way.
in your settings.py

import os
ROOT_PATH  =  'c:/project/ajax_tut'   # take note. need to use black slash.


On Thu, May 17, 2012 at 12:31 AM, Venkat Rangan <venkat.rangan@gmail.com> wrote:
No, this did not work. Is there a way to print what the ROOT_PATH is, on an HTML page?


On Wed, May 16, 2012 at 3:55 PM, Min Hong Tan <tan.django@gmail.com> wrote:
hi,

your media folder location should be 

<ROOT_PATH>/media   

example: your  ROOT_PATH  is c:\project\ajax_tut
then your media file should be 

c:\project\ajax_tut\media

MEDIA_ROOT = os.path.join(ROOT_PATH, 'media')
MEDIA_URL = '/media/'     <---- like this should be ok.

you may try. hope it helps.

Regards,
MH


On Tue, May 15, 2012 at 8:41 PM, django-user59 <venkat.rangan@gmail.com> wrote:
Hi,

I attempted to add 'media' directory to the root of my project and placed a css file and some ajax javascript. The server runtime is unable to locate it. Can someone help?

I have the following in settings.py

MEDIA_ROOT = os.path.join(ROOT_PATH, 'media')

The console error I get is:

C:\dev\Projects\ajax_tut\ajax_tut>python ../manage.py runserver
Validating models...
0 errors found
Django version 1.4, using settings 'ajax_tut.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[15/May/2012 19:11:12] "GET / HTTP/1.1" 200 613
[15/May/2012 19:11:12] "GET /media/style.css HTTP/1.1" 404 2312
[15/May/2012 19:11:12] "GET /media/jquery-1.2.6.min.js HTTP/1.1" 404 2342
[15/May/2012 19:11:28] "GET / HTTP/1.1" 200 613
[15/May/2012 19:11:28] "GET /media/style.css HTTP/1.1" 404 2312
[15/May/2012 19:11:28] "GET /media/jquery-1.2.6.min.js HTTP/1.1" 404 2342

Where do I place this directory and what do I set in settings.py and which directory do I launch the server? Once again, any help would be much appreciated.

Thanks,


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/XyZWqGOd6KoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate