WebFaction
Community site: login faq

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
36
accept rate: 0%


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.

permanent link

answered 07 May '13, 13:36

seanf
12.2k41836
accept rate: 37%

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
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×125
×31
×22

question asked: 07 May '13, 09:59

question was seen: 2,185 times

last updated: 12 May '13, 13:47

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM