Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling static files #2

Open
ogirardot opened this issue Aug 10, 2012 · 4 comments
Open

Handling static files #2

ogirardot opened this issue Aug 10, 2012 · 4 comments

Comments

@ogirardot
Copy link

Hi,
is there any best practice on how to handle for multiple dynamicsites static files "css/js" etc.. ?

Regards,

Olivier.

@wardi
Copy link
Owner

wardi commented Aug 10, 2012

That would be good to document in the examples. I've got an apache configuration that has a shared static directory for a bunch of sites, but separate upload and media directories per-site. That's the closest thing I have to a "best practice"

I'll add it to the cms_example and try to document it.

@ndelacour
Copy link

Hi,

I was playing around with the same idea about the css/js files.

First thing I did was to use the request.dynamicsites_folder_name in the template, but this does not have any fallback mechanism. So I created myself a template tag instead.
This tag checks for each directory in 'STATICFILES_DIRS' if if can find the requested css/js file in the directory which corresponds to the site name (www_yoursite_com), if not it checks the common directory. Finally, if nothing can be found, it returns by default the {{ STATIC_URL }} /css/filename

If you are interested, I can upload the files...

Next to this, I was playing around with a CMS in which you can upload the media files. My idea was to allow each site to have staff members who can upload their own files. It was working perfectly...
Then I realised that as an administrator, I would like to change my site and be able to have the media files from the selected site, no matter which initial domain I had selected.
What I did was to add in addition to the dynamicsites_folder_name the dynamicsites_session_folder_name to the request, which is based on the site_id from the session. Using this, I was able to allow my admin to change sites within his session without the need to change domain.

If this does interest anyone, I can upload this as well.

Regards,

@rofrankel
Copy link

ndelacour, please do share that, thanks!

@jonatansberg
Copy link

@ndelacour I too would find this interesting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants