Greetings. My question for those who are familiar with the hosting of webfaction.com I have three sites that are hosted on webfaction (written in Django). For each site (or as they are called sites - application), there is a separate application for the issuance of statics. For example, there is a site (application) - automobile. Appendix outstanding statics: automobile_static The second example, the site (application) - lodkaseledka Appendix outstanding statics: lodkaseledka_static etc. It turns out that for each application site requires one application for the issuance of statics. How can I do (if possible) one application, for example media_static and cling to all of its sites? Here is the problem! Let's say your website automobile, there are app "home" that contains static. I'll do for the site collectstatic automobile, and the static "home" is copied to the media_static. And then do collectstatic for the site lodkaseledka, and if there is too app "home", it turns out it will overwrite the previous folder "home", Website created for automobile. asked 07 May '13, 09:59 JumpJump |
There's no advantage to using a single application, and it presents the exact problems you described, i.e. your media is overwritten when you run "collectstatic". I think your best option would be to abandon the idea of using a single static-only application for all of your sites. answered 07 May '13, 13:36 seanf Greetings. Yes, I almost refused, but then decided to do it! First, on each site (and I have them 3), I had two applications. One for the distribution of static, and the second for distribution of dynamic content uploaded to the site by the user (*. jpg files). For my sites, it turns out: 2 * 3 = 6 6 additional applications for the distribution of statistical and dynamic content. Then I cut everything to a single application. We get: 1 * 3 = 3 3 additional applications for the distribution of statistical and dynamic content. In the end, I use a single application for all sites, which is engaged in the distribution of content. And I think it's an advantage. One application for all sites. Nothing more. The main problem was to compare accessory content for different sites. I really like how arranged ierarhihaya packages in JAVA (zone.domain.package). I decided to use it to solve the problem of ownership: -Media ---- Ru -------- Mysite ------------ Static (folder statichesticheskogo content) ------------ Upload (folder for dynamic content) ---- Com -------- Mysite2 ------------ Static (folder statichesticheskogo content) ------------ Upload (folder for dynamic content) So settings settings.py: WORK_DIR = os.path.dirname(file) def url_split(s): return s.split('.') DOMAIN, ZONE = url_split('mysite.ru') MEDIA_ROOT = os.path.join (WORK_DIR, 'media', ZONE, DOMAIN). replace ('\', '/') MEDIA_URL = 'http://site.ru.ru/media/% s /% s /'% (ZONE, DOMAIN) STATIC_ROOT = os.path.join (WORK_DIR, 'media', ZONE, DOMAIN, 'Static'). replace ('\', '/') STATIC_URL = MEDIA_URL + 'static/' Do not forget to create an application "media" in the admin area, and bind it to your site's URL: http://mysite.ru/media Done!
(12 May '13, 13:42)
JumpJump
|