Re: How force DJANGo choice MEDIA_URL or STATIC_URL in template?

2016-03-02 Thread setivolkylany
templates -- And all worked Thanks среда, 2 марта 2016 г., 1:41:28 UTC+2 пользователь James Schneider написал: > > >> I need choice base url MEDIA_URL (/media/) - for uploaded user picture, >> or STATIC_URL (/static/) - picture by default >> >> I

Re: How force DJANGo choice MEDIA_URL or STATIC_URL in template?

2016-03-01 Thread James Schneider
> > > I need choice base url MEDIA_URL (/media/) - for uploaded user picture, or > STATIC_URL (/static/) - picture by default > > I am try next: > > p> alt="picture_for_{{ account.name }}" id="account_picture"> > > , but result is MEDIA_URL

Re: How force DJANGo choice MEDIA_URL or STATIC_URL in template?

2016-03-01 Thread Seti Volkylany
nas Svensson wrote: > It seems like you want to use display a default picture if the user does > not have one. > {% load static %} > {% static "images/default_pic.jpg" as default_pic %} > {{ account.accountuserinfo.picture|default:default_pic }} > > Cheers

Re: How force DJANGo choice MEDIA_URL or STATIC_URL in template?

2016-03-01 Thread Jonas Svensson
+1, setivo...@gmail.com wrote: > > > I need choice base url MEDIA_URL (/media/) - for uploaded user picture, or > STATIC_URL (/static/) - picture by default > > I am try next: > > p> alt="picture_for_{{ account.name }}" id="account_picture"> > >

How force DJANGo choice MEDIA_URL or STATIC_URL in template?

2016-02-29 Thread setivolkylany
I need choice base url MEDIA_URL (/media/) - for uploaded user picture, or STATIC_URL (/static/) - picture by default I am try next: p> , but result is MEDIA_URL(STATIC_URL) and path to file. I am next try: {% templatetag openvariable %} url 'entry_list' {% templatetag

Re: Is there a way to make the template process {{ MEDIA_URL }} if it is stored in a model field.

2015-08-30 Thread Dennis Marwood
Ok, thanks. It seems like such a common use case that I wanted to be sure there was not an existing template tag for it. On Sunday, 30 August 2015 14:48:47 UTC-7, Christophe Pettus wrote: > > > On Aug 30, 2015, at 2:37 PM, Christophe Pettus > wrote: > > > On Aug 30, 2015, at 12:43 PM, Dennis M

Re: Is there a way to make the template process {{ MEDIA_URL }} if it is stored in a model field.

2015-08-30 Thread Christophe Pettus
On Aug 30, 2015, at 2:37 PM, Christophe Pettus wrote: > On Aug 30, 2015, at 12:43 PM, Dennis Marwood wrote: > >> How do I get the template to treat {{ }} in my entry as a variable? > > The Django template language doesn't iterate over the results of expansion; > once a substitution is done,

Re: Is there a way to make the template process {{ MEDIA_URL }} if it is stored in a model field.

2015-08-30 Thread Christophe Pettus
On Aug 30, 2015, at 12:43 PM, Dennis Marwood wrote: > How do I get the template to treat {{ }} in my entry as a variable? The Django template language doesn't iterate over the results of expansion; once a substitution is done, it moves on. So, template language constructs that "appear" in th

Re: Is there a way to make the template process {{ MEDIA_URL }} if it is stored in a model field.

2015-08-30 Thread Dennis Marwood
this: > > from django.conf import MEDIA_URL > > > 2015-08-30 20:43 GMT+01:00 Dennis Marwood >: > >> Hello, >> >> I have a seemingly straight forward and likely common issue. But there is >> no obvious way that I am seeing to make it work. >> &g

Re: Is there a way to make the template process {{ MEDIA_URL }} if it is stored in a model field.

2015-08-30 Thread monoBOT
You can import your any part of your settings into the model.py file and then insert it like this: from django.conf import MEDIA_URL 2015-08-30 20:43 GMT+01:00 Dennis Marwood : > Hello, > > I have a seemingly straight forward and likely common issue. But there is > no obvious w

Is there a way to make the template process {{ MEDIA_URL }} if it is stored in a model field.

2015-08-30 Thread Dennis Marwood
display my blog post like {% for post in posts %} {{ post.entry }} {% endfor %} But the template does not process {{ MEDIA_URL }}. It just sees it as a string and prints it exactly as passed in. How do I get the template to treat {{ }} in my entry as a variable? How can I get that value

Re: MEDIA_URL doesnt work in windows but works on linux

2015-04-14 Thread Stephen J. Butler
question. > > > how do I use media_url in windows? > > > > > > > On Wednesday, April 8, 2015 at 10:56:27 AM UTC-5, dk wrote: >> >> in my settings >> MEDIA_ROOT = os.path.join(BASE_DIR, 'media') >> MEDIA_URL = "/media/" >>

Re: MEDIA_URL doesnt work in windows but works on linux

2015-04-14 Thread dk
maybe I need to simplify my question. how do I use media_url in windows? On Wednesday, April 8, 2015 at 10:56:27 AM UTC-5, dk wrote: > in my settings > MEDIA_ROOT = os.path.join(BASE_DIR, 'media') > MEDIA_URL = "/media/" > > > my view to ac

MEDIA_URL doesnt work in windows but works on linux

2015-04-08 Thread dk
in my settings MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = "/media/" my view to accept files. def request_page(request): #todo since sqlite my get stuck between 2 submittion at the same time, # submit, if it cant try again and then message that ask the us

Re: AW: MEDIA_URL not treated like static

2011-03-28 Thread galgal
Thanks, I didn't know that. All works fine now. -- 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...@googlegro

Re: AW: MEDIA_URL not treated like static

2011-03-28 Thread Amao Zhao
Dear galgal: according to the django docs for 1.3, The most likely example is user-uploaded content in MEDIA_ROOT . staticfiles is intended for static assets and has no built-in handling for user-uploaded files, but you

Re: AW: MEDIA_URL not treated like static

2011-03-28 Thread galgal
I forgot to tell I'm using Django 1.3. In that case - how to make it work with separate dirs? Or it can't be done on dev server? -- 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.

AW: MEDIA_URL not treated like static

2011-03-28 Thread Szabo, Patrick (LNG-VIE)
I have a static folder in my Prject and my MEDIA_URL looks like this: http://127.0.0.1:8000/static/ Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im Auftrag von galgal Gesendet: Montag, 28. März 2011 13:38 An: django-users@googlegroups.com Betreff: MEDIA_URL not

MEDIA_URL not treated like static

2011-03-28 Thread galgal
I have that dirs structure: site_media/ | ---> static/ | ---> uploads/ static dir is set as STATIC_URL = '/site_media/static/' uploads dir is set as MEDIA_URL = '/site_media/uploads/' In that case on dev server (localhost:8000) media_url is not accessi

Re: Working with static media files, {{ MEDIA_URL }} shows up blank even with settings.py set

2010-12-28 Thread Lee Connell
Thanks everyone, the problem was indeed not using the RequestContext, using Context does not automatically include some useful variables which are retrieved from TEMPLATE_CONTEXT_PROCESSORS that includes MEDIA_URL as stated above. Thanks again! On Dec 28, 5:31 pm, dmitry b wrote: > you need

Re: Working with static media files, {{ MEDIA_URL }} shows up blank even with settings.py set

2010-12-28 Thread dmitry b
you need to be also using RequestContext in your view instead of the regular Context. What does your view method's return statement look like? On Dec 28, 7:02 am, Lee Connell wrote: > I didn't have TEMPLATE_CONTEXT_PROCESSORS at all, I copied the code > and it did not help, ME

Re: Working with static media files, {{ MEDIA_URL }} shows up blank even with settings.py set

2010-12-28 Thread Daniel Roseman
On Tuesday, December 28, 2010 3:02:44 PM UTC, Lee Connell wrote: > > I didn't have TEMPLATE_CONTEXT_PROCESSORS at all, I copied the code > and it did not help, MEDIA_URL is still blank. I am using django 1.2.1 > on windows. > You don't actually need to specify TEMPL

Re: Working with static media files, {{ MEDIA_URL }} shows up blank even with settings.py set

2010-12-28 Thread easylancer
Post your settings.py in a pastebin and add a link to it here. Remove all sensitive data before posting it. On Dec 28, 3:02 pm, Lee Connell wrote: > I didn't have TEMPLATE_CONTEXT_PROCESSORS at all, I copied the code > and it did not help, MEDIA_URL is still blank. I am using django

Re: Working with static media files, {{ MEDIA_URL }} shows up blank even with settings.py set

2010-12-28 Thread Lee Connell
I didn't have TEMPLATE_CONTEXT_PROCESSORS at all, I copied the code and it did not help, MEDIA_URL is still blank. I am using django 1.2.1 on windows. On Dec 28, 12:56 am, Kenneth Gonsalves wrote: > On Mon, 2010-12-27 at 08:03 -0800, easylancer wrote: > > TEMPLATE_CONT

Re: Working with static media files, {{ MEDIA_URL }} shows up blank even with settings.py set

2010-12-28 Thread Kenneth Gonsalves
On Mon, 2010-12-27 at 08:03 -0800, easylancer wrote: > TEMPLATE_CONTEXT_PROCESSORS = ( > 'django.contrib.auth.context_processors.auth', > 'django.core.context_processors.debug', > 'django.core.context_processors.i18n', > 'django.core.context_processors.media', > 'django.contrib.

Re: Working with static media files, {{ MEDIA_URL }} shows up blank even with settings.py set

2010-12-27 Thread easylancer
rocessors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.media', 'django.contrib.messages.context_processors.messages', 'django.core.context_processors.request', ) On Dec 27, 3:17 pm, Lee Connell wrote: > I have my

Working with static media files, {{ MEDIA_URL }} shows up blank even with settings.py set

2010-12-27 Thread Lee Connell
I have my media url and root set: MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media') This is what my template has: Postfix Log Viewer The {{ MEDIA_URL }} shows up blank -- You received this mes

Re: do we need MEDIA_ROOT and MEDIA_URL anymore?

2010-11-17 Thread Adam V.
On Nov 17, 2:07 am, MiratCanBayrak wrote: > Hi, > > I understood that in new version of django we are using > STATICFILES_ROOT and STATICFILES_URL instead OF MEDIA_ROOT and > MEDIA_URL. > > But when i look at settings.py i see both of them. When do we use > MEDIA? wh

do we need MEDIA_ROOT and MEDIA_URL anymore?

2010-11-17 Thread MiratCanBayrak
Hi, I understood that in new version of django we are using STATICFILES_ROOT and STATICFILES_URL instead OF MEDIA_ROOT and MEDIA_URL. But when i look at settings.py i see both of them. When do we use MEDIA? when do we use STATICFILES ? Note: pls dont give link to docs i already read them

Re: Using localhost in MEDIA_URL causing very slow django

2010-08-16 Thread Steve Holden
ike 10 minutes for it to load. The code didn't even reach > the view. I tracked the problem down to the use of MEDIA_URL in my > base.html. I looked at my MEDIA_URL setting and it was set to > http://localhost:8000/media/. Since I'm using http://127.0.0.1:8000/ > to access

Using localhost in MEDIA_URL causing very slow django

2010-08-15 Thread Martin Lundberg
acked the problem down to the use of MEDIA_URL in my base.html. I looked at my MEDIA_URL setting and it was set to http://localhost:8000/media/. Since I'm using http://127.0.0.1:8000/ to access the page I tried changing the setting to 127.0.0.1 as well and for some reason the problem went

[Solved] Re: Not reflecting MEDIA_URL value

2010-07-20 Thread barun
render_to_response('base.html', {}) > > You have to pass through a RequestContext() for the template context > processor that injects MEDIA_URL > ('django.core.context_processors.media') into to the template to kick > in, and you have to have said template context p

Re: Not reflecting MEDIA_URL value

2010-07-20 Thread David De La Harpe Golden
On 20/07/10 12:11, barun wrote: > > [gallery/views.py] > def index(request): > return render_to_response('base.html', {}) > You have to pass through a RequestContext() for the template context processor that injects MEDIA_URL ('django.core.context_processor

Not reflecting MEDIA_URL value

2010-07-20 Thread barun
l template (where I'm using {{ MEDIA_URL }} to denote the path of the image), the value of the variable MEDIA_URL is not getting substituted -- it appears as blank. For example, with the following settings: [photo/settings.py] DEBUG = True MEDIA_ROOT = '/home/barun/codes/python/dja

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread Rolando Espinoza La Fuente
On Thu, Jul 8, 2010 at 8:21 AM, justin jools wrote: > Wow... django docs can be so confusing... > > I could not believe it worked just by using upper case MEDIA_URL {{ MEDIA_URL }} is already present in the templates because the django.core.context_processors.media context processor

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread justin jools
Wow... django docs can be so confusing... I could not believe it worked just by using upper case MEDIA_URL Thanks so much :) :) I spent a day trying figure this out... On 8 July, 13:14, Daniel Roseman wrote: > On Jul 8, 12:57 pm, justin jools wrote: > > > > > > &

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread justin jools
The 2 methods of using media_url with generic views I have tried: 1. http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/ This knocked out my admin, but media_url did work 2. using templatetags yourApp/templatetags/media_url.py: from django.template import Library

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread Daniel Roseman
On Jul 8, 12:57 pm, justin jools wrote: > Thank for your quick response Daniel. > I'm just confused about using media_url with generic views, I have > done it previously with: > > from django.conf import settings        # for media_url > media_url = settings.MEDIA_URL

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread justin jools
Thank for your quick response Daniel. I'm just confused about using media_url with generic views, I have done it previously with: from django.conf import settings# for media_url media_url = settings.MEDIA_URL def dblist(request): obj_list_menu = dbModel1.objects.all() r

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread Daniel Roseman
hich means they automatically gain access to all the existing context processors - including the default "django.core.context_processors.media" processor. So, all generic views *already* have access to MEDIA_URL. -- DR. -- You received this message because you are subscribed to the Google G

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread justin jools
text processors to media_url (see > > original post). > > When context processors are active the {media_url} tag works > > perfectly, but breaks the admin. > > > If I comment out : > > settings.py > > #TEMPLATE_CONTEXT_PROCESSORS = > > ('por

Re: context porcessors request.context media_url breaks admin

2010-06-29 Thread Daniel Roseman
On Jun 29, 1:41 pm, justin jools wrote: > Hi Tom if you read my original post you will realise that the error is > being caused by setting of context processors to media_url (see > original post). > When context processors are active the {media_url} tag works > perfectly, but b

Re: context porcessors request.context media_url breaks admin

2010-06-29 Thread justin jools
Hi Tom if you read my original post you will realise that the error is being caused by setting of context processors to media_url (see original post). When context processors are active the {media_url} tag works perfectly, but breaks the admin. If I comment out : settings.py

Re: context porcessors request.context media_url breaks admin

2010-06-29 Thread Tom Evans
On Tue, Jun 29, 2010 at 12:33 PM, justin jools wrote: > I corrected my settings.py links: > > TEMPLATE_DIRS = 'C:/django/portfolio_root/templates/' > MEDIA_ROOT = 'C:/django/portfolio_root/site-media/' > MEDIA_URL = '/site-media/' > ADMIN_MEDIA_P

Re: context porcessors request.context media_url breaks admin

2010-06-29 Thread justin jools
I corrected my settings.py links: TEMPLATE_DIRS = 'C:/django/portfolio_root/templates/' MEDIA_ROOT = 'C:/django/portfolio_root/site-media/' MEDIA_URL = '/site-media/' ADMIN_MEDIA_PREFIX = '/media/' but I still get this error: TemplateSyntaxError at /ad

Re: context porcessors request.context media_url breaks admin

2010-06-29 Thread justin jools
Yes I did accidentally set my ADMIN_MEDIA_PREFIX = '/site-media/' instead of media I'll try this On Jun 29, 8:57 am, bruno desthuilliers wrote: > On 29 juin, 00:44, justin jools wrote: > > > > > > > I am trying to use media_url with generic view

Re: context porcessors request.context media_url breaks admin

2010-06-29 Thread bruno desthuilliers
On 29 juin, 00:44, justin jools wrote: > I am trying to use media_url with generic views: > When I set context processors to media_url, with generic views it > breaks Admin: > > Caught an exception while rendering: user > > settings.py > TEM

context porcessors request.context media_url breaks admin

2010-06-28 Thread justin jools
I am trying to use media_url with generic views: When I set context processors to media_url, with generic views it breaks Admin: Caught an exception while rendering: user settings.py TEMPLATE_CONTEXT_PROCESSORS = ('portfolio.context_processors.media_url',) context_processors.py def

Re: Problem with static files (MEDIA_URL and MEDIA_ROOT)

2010-06-28 Thread nadae ivar badio
Hi do you speack french? 2010/6/27 Denis Ricardo > Hello people! I am having any problems with static files (images, CSS) > in Django. I configured the MEDIA_URL and MEDIA_ROOT in settings.py > and when I execute the server and I go see the webpage, the static > files doesn'

Re: Problem with static files (MEDIA_URL and MEDIA_ROOT)

2010-06-27 Thread Graham Dumpleton
On Jun 27, 10:53 pm, Denis Ricardo wrote: > Hello people! I am having any problems with static files (images, CSS) > in Django. I configured the MEDIA_URL and MEDIA_ROOT in settings.py > and when I execute the server and I go see the webpage, the static > files doesn't are enco

Problem with static files (MEDIA_URL and MEDIA_ROOT)

2010-06-27 Thread Denis Ricardo
Hello people! I am having any problems with static files (images, CSS) in Django. I configured the MEDIA_URL and MEDIA_ROOT in settings.py and when I execute the server and I go see the webpage, the static files doesn't are encountered (the page stay without anything). Screen Shot of my

Re: Using array of URLs for MEDIA_URL

2010-06-11 Thread Martin Siniawski
Alex, Thanks for the answer. I tried doing something like the first thing you proposed (MEDIA_URL as a callable) but I had to tweak it a little bit because the template wasn't calling the callable, but rather printing 'function object .'. What do you think of the solution

Re: Using array of URLs for MEDIA_URL

2010-06-11 Thread Martin Siniawski
__unicode__(self): self.current_url += 1 self.current_url %= len(self.media_urls) return self.media_urls[self.current_url] def context_proc (req): return {'MEDIA_URL': RoundRobinMediaUrl()} On Jun 11, 3:09 pm, Martin Siniawski wrote: > Steven, > > T

Re: Using array of URLs for MEDIA_URL

2010-06-11 Thread Martin Siniawski
--- > from django import template > from random import choice > > register = template.Library() > > defmedia_url(): >     media_urls = ['site1.example.com', 'site2.example.com', > 'site3.example.com'] >     return choice(media_u

Re: Using array of URLs for MEDIA_URL

2010-06-08 Thread Alex Robbins
or the answer. > > If I understand correctly your idea and code, each template would have > only one value for the MEDIA_URL (randomly chosen from the array), > right? > > What I was looking for was a way of distributing the value of the > MEDIA_URL uniformly along the values o

Re: Using array of URLs for MEDIA_URL

2010-06-08 Thread Steven L Smith
Looks like my email client screwed up the indentation I've added some indents... random_media.py - from django import template from random import choice register = template.Library() def media_url(): media_urls = ['site1.example.com', &#x

Re: Using array of URLs for MEDIA_URL

2010-06-08 Thread Steven L Smith
Steve random_media.py - from django import template from random import choice register = template.Library() def media_url(): media_urls = ['site1.example.com', 'site2.example.com', 'site3.example.com'] return choice(media_urls) regis

Re: Using array of URLs for MEDIA_URL

2010-06-08 Thread Martin Siniawski
Steve, Thanks for the answer. If I understand correctly your idea and code, each template would have only one value for the MEDIA_URL (randomly chosen from the array), right? What I was looking for was a way of distributing the value of the MEDIA_URL uniformly along the values of an array, in

Re: Using array of URLs for MEDIA_URL

2010-06-07 Thread Steven L Smith
Hi Martin- I don't know what the "official" answer would be, but you could write your own context processor that had something like: from random import choice MEDIA_URLS = 'static1.site.com', 'static2.site.com', 'static3.site.com' ] def me

Using array of URLs for MEDIA_URL

2010-06-07 Thread Martin Siniawski
Hey guys, I wanted to ask if there's any way or accepted solution for using more than one URL simultaneously as the MEDIA_URL, so as to enable browsers to further parallelize the download of static content. That is, having something like: MEDIA_URL = [ 'static1.site.com', &#

Re: MEDIA_URL is not pushed to templates

2010-03-15 Thread Bobby Roberts
ah... my media processor got shot somehow On Mar 15, 7:51 pm, Bobby Roberts wrote: > hi group... got a strange situation.  MEDIA_URL is not being pushed to > the templates for some reason. > > In my settings file i have > > MEDIA_URL='/static/' > ..

MEDIA_URL is not pushed to templates

2010-03-15 Thread Bobby Roberts
hi group... got a strange situation. MEDIA_URL is not being pushed to the templates for some reason. In my settings file i have MEDIA_URL='/static/' ... TEMPLATE_CONTEXT_PROCESSORS=( 'django.core.context_processors.request',) and in the template i am specifying it as {{

media_url tute

2009-11-13 Thread Mike Dewhirst
I have looked at the django docs (http://docs.djangoproject.com/en/dev/topics/forms/media/) which painstakingly describe how to set up MEDIA_ROOT and MEDIA_URL. Does anyone know of a tutorial or other docco which covers the topic? Thanks Mike -- You received this message because you are

Re: accessing media_url in javascript

2009-10-05 Thread Daniel Roseman
On Oct 5, 10:34 pm, "neri...@gmail.com" wrote: > I was interested in finding out how I would go about accessing django > vars in my javascript file i.e., media_url within javascript. Do I > need to use a serializer to achieve this? > > Thanks, > > Jason Just put

accessing media_url in javascript

2009-10-05 Thread neri...@gmail.com
I was interested in finding out how I would go about accessing django vars in my javascript file i.e., media_url within javascript. Do I need to use a serializer to achieve this? Thanks, Jason --~--~-~--~~~---~--~~ You received this message because you are

Re: admin running in dev mode (manage.py runserver) ignores MEDIA_URL

2009-08-14 Thread physicsnick
16 am, Aljosa Mohorovic wrote: > settings.py: > MEDIA_ROOT = "%s/media" % PROJECT_ROOT # set to media folder in > project root > MEDIA_URL = '/media/' > ADMIN_MEDIA_PREFIX = '/media/admin/' > > urls.py > if settings

admin running in dev mode (manage.py runserver) ignores MEDIA_URL

2009-08-14 Thread Aljosa Mohorovic
settings.py: MEDIA_ROOT = "%s/media" % PROJECT_ROOT # set to media folder in project root MEDIA_URL = '/media/' ADMIN_MEDIA_PREFIX = '/media/admin/' urls.py if settings.DEBUG: urlpatterns += patterns('', (r'^media/(?P.*)$', 'django.vie

Re: MEDIA_URL MEDIA_ROOT

2009-07-30 Thread cootetom
n the 'uploads' directory there are all my uploaded files. > > Two questions: > > 1. > in models.py I have the following: > > class Attach(models.Model): >   attached_file = models.FileField(upload_to='user_files') >   # other stuff > > why all of the

Re: MEDIA_URL MEDIA_ROOT

2009-07-30 Thread Xiong Chiamiov
On Jul 30, 3:38 am, Salvatore Leone wrote: > I can't download the files, probably I don't understand the MEDIA_URL > parameter. Here it is: > MEDIA_URL = 'http://localhost:8000/wiz/uploads/' > > but trying to access the files returns me a 404 error. You sho

MEDIA_URL MEDIA_ROOT

2009-07-30 Thread Salvatore Leone
el): attached_file = models.FileField(upload_to='user_files') # other stuff why all of the files are stored in 'uploads' and not in 'uploads/user_files/'? 2. I can't download the files, probably I don't understand the MEDIA_URL parameter. Here it is: MEDIA_URL

Re: MEDIA_URL and ADMIN_MEDIA_PREFIX

2009-07-12 Thread Sam Lai
Forgot to add - the usual trick is to symlink the admin media in your MEDIA_URL; that way you don't have to set up two different aliases in your web server config. 2009/7/13 Sam Lai : > Yes, because unless you copy the admin site's media over to your > MEDIA_URL (or vice-versa),

Re: MEDIA_URL and ADMIN_MEDIA_PREFIX

2009-07-12 Thread Sam Lai
Yes, because unless you copy the admin site's media over to your MEDIA_URL (or vice-versa), Django won't be able to find the admin media. >From http://docs.djangoproject.com/en/dev/ref/settings/ ADMIN_MEDIA_PREFIX Default: '/media/' The URL prefix for admin media -- CSS

MEDIA_URL and ADMIN_MEDIA_PREFIX

2009-07-12 Thread sjtirtha
Hi, I found out that MEDIA_URL and ADMIN_MEDIA_PREFIX may not have the same value, otherwise images that is located in this MEDIA_URL cannot be displayed in browser. I did not found about this anywhere in the documentation. Is my assumption correct? Regards, Steve

Re: How to use MEDIA_URL on flatpages content?

2009-06-25 Thread Panu Tangchalermkul
I think I got your concept, converting all MEDIA_URL to corresponding url before displaying. But I still curious to know where should I put this code in the project? I've been thinking and can only come up with a way, by creating a new middleware replicating FlatpageFallbackMiddlewar

Re: How to use MEDIA_URL on flatpages content?

2009-06-25 Thread Rama Vadakattu
Please ignore the last line.. On Jun 25, 2:40 pm, Rama Vadakattu wrote: > you can put {{MEDIA_URL}} > > but while displaying instead of displaying it directly  just do the > below > > from django.template.loader import render_to_string > from django.template imp

Re: How to use MEDIA_URL on flatpages content?

2009-06-25 Thread Rama Vadakattu
you can put {{MEDIA_URL}} but while displaying instead of displaying it directly just do the below from django.template.loader import render_to_string from django.template import Context, Template t = Template("flat page content goes here") newflatpage = t.render({},contex

How to use MEDIA_URL on flatpages content?

2009-06-25 Thread Panu Tangchalermkul
In the content of my flatpage, there's a picture to be displayed that it was stored in django media folder. I want to link to this file without having to specify its url directly. Instead, I want to use something like {{MEDIA_URL}} when editing the content via django- admin. I know I can u

Re: MEDIA_ROOT, MEDIA_URL and upload_to confusion (~.~)

2009-01-16 Thread DragonSlayre
to = ImageWithThumbsField( > >             upload_to="site_images", > >             sizes=((270,150),)) > > > And in my settings my media path is as following: > > > MEDIA_ROOT = os.path.abspath(os.path.join(PROJECT_DIR, 'site_media')) > > MEDIA_U

Re: MEDIA_ROOT, MEDIA_URL and upload_to confusion (~.~)

2009-01-16 Thread Malcolm Tredinnick
tion = models.CharField(max_length=100, blank=True, null=True) > photo = ImageWithThumbsField( > upload_to="site_images", > sizes=((270,150),)) > > And in my settings my media path is as following: > > MEDIA_ROOT = os.path.abspath(os.path.

Re: MEDIA_ROOT, MEDIA_URL and upload_to confusion (~.~)

2009-01-16 Thread DragonSlayre
Ok, I got it working, I changed: > photo = ImageWithThumbsField( > upload_to="site_images", > sizes=((270,150),)) to: photo = ImageWithThumbsField( upload_to="static/site_images", sizes=((270,150),)) and

MEDIA_ROOT, MEDIA_URL and upload_to confusion (~.~)

2009-01-16 Thread DragonSlayre
photo = ImageWithThumbsField( upload_to="site_images", sizes=((270,150),)) And in my settings my media path is as following: MEDIA_ROOT = os.path.abspath(os.path.join(PROJECT_DIR, 'site_media')) MEDIA_URL = 'static/' I'm trying to upload my images i

Re: to understand MEDIA_URL

2009-01-05 Thread Alan
, 4:13 am, Alan wrote: > > Hi List, > > Because I couldn't find any idea better I am using "MEDIA_URL = > '/static/'" > > as a repository for the output of my application so I can see the results > in > > the web interface and download them. &g

Re: to understand MEDIA_URL

2009-01-05 Thread Mark Jones
I am using "MEDIA_URL = '/static/'" > as a repository for the output of my application so I can see the results in > the web interface and download them. > > However, I noticed for a particular case where I open and read a file > content to

to understand MEDIA_URL

2009-01-05 Thread Alan
Hi List, Because I couldn't find any idea better I am using "MEDIA_URL = '/static/'" as a repository for the output of my application so I can see the results in the web interface and download them. However, I noticed for a particular case where I open and read a file

Re: specifying MEDIA_URL in CSS files

2008-09-19 Thread Erik Allik
space > at www.university.edu/group/groupname/), and when I move it over, I'd > like to have to go through and change as little as possible. > > Tim: I'll look into those solutions. > > Thanks to both of you. > > On Sep 13, 4:12 pm, Tim Chase <[EMAIL PROTECTED]>

Re: specifying MEDIA_URL in CSS files

2008-09-18 Thread MrJogo
.edu/group/groupname/), and when I move it over, I'd like to have to go through and change as little as possible. Tim: I'll look into those solutions. Thanks to both of you. On Sep 13, 4:12 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > What's the best way to use MEDIA_URL in a

Re: specifying MEDIA_URL in CSS files

2008-09-13 Thread Tim Chase
> What's the best way to use MEDIA_URL in a CSS file. For example, right > now my CSS file has something like: > > body { > background: transparent url('/media/images/bg.gif') repeat; > } > > I would like to use MEDIA_URL instead of /media/ (in a numbe

Re: specifying MEDIA_URL in CSS files

2008-09-13 Thread Erik Allik
, that's another case. Erik On 14.09.2008, at 1:56, MrJogo wrote: > > What's the best way to use MEDIA_URL in a CSS file. For example, right > now my CSS file has something like: > > body { > background: transparent url('/media/images/bg.gif') repeat; > } >

specifying MEDIA_URL in CSS files

2008-09-13 Thread MrJogo
What's the best way to use MEDIA_URL in a CSS file. For example, right now my CSS file has something like: body { background: transparent url('/media/images/bg.gif') repeat; } I would like to use MEDIA_URL instead of /media/ (in a number of places), but other than that the

Re: View not passing MEDIA_URL to Template

2008-09-04 Thread lingrlongr
iew that has {{MEDIA_URL}} in it. > > When the generic view is hit, the base.html template gets it's > value,http://rtdev.apple.com/media/ >   , but when my own View hits MEDIA_URL blanks. > > I tried to get MEDIA_URL in my views.py to pass it in to my   > render_to_response but

View not passing MEDIA_URL to Template

2008-09-04 Thread Cortland Klein
I have two templates, one called via a Generic View and one via my own View. They both extend a base.html view that has {{MEDIA_URL}} in it. When the generic view is hit, the base.html template gets it's value, http://rtdev.apple.com/media/ , but when my own View hits MEDIA_URL blank

Re: {{ media_url }}

2008-06-05 Thread Andrew Ingram
If you're using render_to_response you'll want to do something like this: return render_to_response('my_template.html', my_data_dictionary, context_instance=RequestContext(request)) The last bit is the important part, it creates context data

Re: {{ media_url }}

2008-06-05 Thread chris hendrix
PM, Aaron Fay <[EMAIL PROTECTED]> wrote: > > Hi Bobby, > > If you are referring to the media url that should be available via the > context processor, then the variable in your template should be: > {{ MEDIA_URL }} > > Unless you specifically are defining 'media_url&

Re: {{ media_url }}

2008-06-05 Thread chris hendrix
Hi andrew. I've got the from django.template import Context, Template line at the top of the view. How do i pass the media template contact processor to the template? BR On Thu, Jun 5, 2008 at 4:20 PM, Andrew Ingram <[EMAIL PROTECTED]> wrote: > > Chances are that one of the views isn't passin

Re: {{ media_url }}

2008-06-05 Thread Andrew Ingram
Chances are that one of the views isn't passing the media template context processor to the template. = Andrew Bobby Roberts wrote: > i've got two templates in the same directory. My css works fine on > one template but not the other. My link to the css is > > > > Can you think of any reas

Re: {{ media_url }}

2008-06-05 Thread Aaron Fay
Hi Bobby, If you are referring to the media url that should be available via the context processor, then the variable in your template should be: {{ MEDIA_URL }} Unless you specifically are defining 'media_url' in your view. Hth, Aaron Bobby Roberts wrote: > i've got tw

{{ media_url }}

2008-06-05 Thread Bobby Roberts
i've got two templates in the same directory. My css works fine on one template but not the other. My link to the css is Can you think of any reason it would work fine for one template and not the other when the templates are in the same dir? BR --~--~-~--~~~-

Re: ImageField get_X_url() method not respecting MEDIA_URL?

2008-06-04 Thread chris . czub
Thanks, that was it. -Chris On Jun 3, 5:44 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > On Tue, Jun 3, 2008 at 5:15 PM, Chris Czub <[EMAIL PROTECTED]> wrote: > > # URL that handles the media served from MEDIA_ROOT. > > # Example: "http://

Re: ImageField get_X_url() method not respecting MEDIA_URL?

2008-06-03 Thread Marty Alchin
On Tue, Jun 3, 2008 at 5:15 PM, Chris Czub <[EMAIL PROTECTED]> wrote: > # URL that handles the media served from MEDIA_ROOT. > # Example: "http://media.lawrence.com"; > MEDIA_URL = 'http://www.mysite.com/media' > > > which is correct - the url of t

ImageField get_X_url() method not respecting MEDIA_URL?

2008-06-03 Thread Chris Czub
I'm having an issue with the ImageField's get_X_url() method(I think it actually inherits from FileField) not using my MEDIA_URL in the url it forms. *Model:* class ImageUpload(models.Model): image = models.ImageField(help_text='Image to upload', upload_to="uplo

  1   2   >