-
Notifications
You must be signed in to change notification settings - Fork 5
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
Deployment with WSGI #4
Comments
Hi Yoanis, In a non-dynamic setup where you define your layers in your settings, you can create per-layer static directories using 'collectlayers'. This is described in the readme. I don't really see how this could work in a dynamic setup, at least not as long as apache/nginx is responsible for serving staticfiles. You will need a dynamic way to serve then (like django's builtin runserver does) or somehow "dynamically" copy the resources to the static (layer) folder at runtime. I'll give this some more thought and see if I can come up with something. And I'd be very interested in a PR once you have something working. |
Hello Ivo, I kinda have something working here: http://www.arsenlimo.com I also modified the collectayers management command to be able to detect dynamic layers and The way I see there is really no difference between dynamic layers and static layers, because I
I was hesitant as to whether I should have implemented a new LayerFinder, but to be honest I was Bests, Yoanis. Le 2014-04-19 à 02:48 AM, Ivo van der Wijk [email protected] a écrit :
|
"Non-dynamic" layers work because you define in your apache/nginx configuration which folder to use, e.g. virtualhost_1: virtualhost_2: One of the goals of django_layers is to try to be as unobstructive as possible - code simply depending pn {% static %} should work unchanged since you don't want to/can't change your third party dependencies. I'll have a look at your fork later and get back to you later. Ivo |
One more remark, where django_leyers collects to depends on your LAYERS configuration:
will indeed create layer folders under STATIC_ROOT. But you could just as easy define completely distinct folders. |
Hello Ivo, Right up to now I’m using STATIC_URL as the base path to static resources, which clearly does not work on production for django_layers … So, if I get you right Please notice that there is really no much difference between « Non-dynamic « layers and « Dynamic layers » because I’ve encapsulated the logic of pulling Please take a look at my fork and let me know what you think … I’ve one or two concerns about performance but right now the ability to have dynamic layers Bests, Yoanis. Le 2014-04-20 à 04:17 AM, Ivo van der Wijk [email protected] a écrit :
|
{% static %} will fill in whatever you have configured as STATIC_ROOT, so {% static "css/foo.css" %} will become /static/css/foo.css It's up to your front end webserver (apache/nginx) to map this to the appropriate filesystem folder. My example above wasn't fully correct, it's more like
This means /static/css/foo.css will go to /srv/project/static/layer1/css/foo.css on virtual_host1 and to /srv/somewhere/else/static/css/foo.css on virtual_host2 Again, it's up to your frontend webserver to correctly map /static somewhere. And of course, collect_layers will copy the resources to these folders based on your LAYERS configuration |
I see. Well, this won’t work for the project I’m working on since sites are created in an un predictable manner and we will like to have Bests, Yoanis. Le 2014-04-21 à 04:18 AM, Ivo van der Wijk [email protected] a écrit :
|
Hello @iivvoo:
I'm working on a fork of django_layers (https://github.com/yoanis_gil/django_layers) which brings a new feature to the project, that is: the ability to have dynamic layers.
I'm working on this project where websites are dynamic, meaning they are created/removed in an unpredictable manner, but they also need to be skinned/customized as per the client's need.
I kinda have the basics working but I've bumped into a dark area and I would appreciate your help. Can you please let me know how do one deploys django_layers under wsgi? Does it require a particular configuration? I tried to do it myself but the static resources were not being layered (which makes sense since I configured my webserver to server static resources directly from the STATIC_ROOT).
I would appreaciate any help on this matter. For the moment being I will just use Django's web server to serve static content but we both know that's not the recommend approach.
Bests,
Yoanis.
P.D: Let me know if you're interested in including the features I've developed into the project and I will kindly send you a pull request.
Bests,
Yoanis.
The text was updated successfully, but these errors were encountered: