WebFaction
Community site: login faq

hi, I have created a new django project. According to the guide in the docs I also configured an app to server my static files[1]. However I noticed that this app (Static) is created inside ~/webapps/ directory and not inside ~/webapps/myproject/ directory. Does this mean that the Static app will be used globally (ie by all my projects)?

My django project includes a /static/ dir where all static media are located (css, js, images, etc). Why did I have to create a "global" /static app? Is it in case I am using common static file for all my apps? But I can configure settings.py to use any directory except for myproject/static.

Would someone be so kind in explaining me why did I have to create a static app from the control panel?

[1] http://docs.webfaction.com/software/django/config.html?highlight=django%20admin#serving-django-static-media

asked 01 Dec '11, 08:43

xpanta
622744
accept rate: 0%


You want to use a separate static-only app so that you can configure your site to serve your static assets via the front-end Nginx server. In that configuration, your app will run faster and will use less memory, since your back-end Apache won't be doing the extra work of serving your static assets.

If you already have a 'static' directory within your project and you want to keep everything in there, then you can use a 'symbolic link to static-only' app instead of a 'static-only' app, and point the symlink at the absolute path to your existing static directory.

Hope that helps!

permanent link

answered 01 Dec '11, 12:56

seanf
12.2k41836
accept rate: 37%

it helps a lot. Is this static app "global"? I mean, can I use it to server all common files? Or should I create a new static app for each application I start?

(01 Dec '11, 13:50) xpanta

If your Django apps all rely on the same pool of static files, then you could use one static app for all of them. Otherwise, you should use separate static apps.

(01 Dec '11, 13:56) seanf
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

question asked: 01 Dec '11, 08:43

question was seen: 1,735 times

last updated: 01 Dec '11, 13:56

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