Hi,

I want to further split my application from the project.
I've already put the templates inside the application directory.
Now I'm thinking of doing the same with media.
I think it's clearer if the media of the application is separate from the 
project.
I'm not sure however if the application directory is the best place ?
I could also move the media outside the application or project directory.

Anyway, I've tried it but i don't succeed in doing this.
The media url results in an empty line in my template.

Some more info: my application is a calltracking system.
I have a settings_calltracking.py file that is imported at the end of the 
settings.py file.
It contains some variables that are specific for the app.
I've added these lines to settings_calltracking.py

project_path = os.path.dirname(os.path.abspath(__file__))
application_calltracking_path= os.path.join(project_path, "calltracking")
MEDIA_URL_CALLTRACKING = '/media_calltracking'
MEDIA_ROOT_CALLTRACKING = os.path.join(application_calltracking_path, 
MEDIA_URL_CALLTRACKING)

The main media url's as specified in settings.py
MEDIA_URL = '/media'
MEDIA_ROOT = os.path.join(project_path, MEDIA_URL)

I'm using the dev server for development so my media urls are like this:
    (r'^%s/(?P<path>.*)$' % settings.MEDIA_URL, 'django.views.static.serve', 
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True } ),
    (r'^%s/(?P<path>.*)$' % settings.MEDIA_URL_CALLTRACKING, 
'django.views.static.serve', {'document_root':
settings.MEDIA_ROOT_CALLTRACKING, 'show_indexes': True } ),

In my template i add this:
<link rel="stylesheet" type="text/css" 
href="{{MEDIA_URL_CALLTRACKING}}/style/login.css" />

This results in an empty line.
If i print the MEDIA_ROOT_CALLTRACKING from the settings file or urls, it's 
printed ok and it's correct.
I can access the media directly via 
http://127.0.0.1:8000/media_calltracking/style/

Any idea why i get an empty line?
Is this possible with the dev server or would it be better to use Apache & 
nginx (I'll use those for production)?
But then it would need to reload the files when changes are made.

Cheers,
Benedict


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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