WebFaction
Community site: login faq

Hi, as per this tutorial (http://docs.webfaction.com/software/django/config.html?highlight=django%20static#serving-django-static-media) I have set a static app to server my static content. It seems to work.

However I also have a /media folder in my app that holds user uploaded media (mainly user avatars). I have added this folder in my settings.py like this

STATICFILES_DIRS = (
     os.path.join(PROJECT_DIR, "static"),
     os.path.join(PROJECT_DIR, "media"),
)

I finally run collectstatic.

In the control panel I have a symbolic link to static-only app that is mount on /media/. And I have added this site to my website.

question 1: do I need the symbolic link to /media/? Or now that I placed /media/ folder in settings.py (MEDIA_ROOT and STATICFILES_DIRS) is served by Nginx automatically along with content from /static/?

question 2: Do I need to run collectstatic every now and then? In my /static/ folder there are css and js files that change often. I followed the tutorial and did exactly what it says. Is my static content served from /static/ folder or /staticfiles/ folder?

asked 10 May '12, 01:08

xpanta
622744
accept rate: 0%


A1: You do still need the symbolic link, defining them in Django does get them serving with apache, but not the front-end ngnix server.

A2: You should not need to run it more than once, it will copy the default files from the default locations to the main app location, any manual changes after that do not need collectstatic ran again, however some modules will require you to run it when you are installing them. More info can be found in the Django docs.

permanent link

answered 10 May '12, 02:03

johns
5.4k312
accept rate: 23%

Thanks. In the docs it says [collectstatic] Collects the static files into STATIC_ROOT. My STATIC_ROOT points to the static app (created in the tutorial) and not /staticfiles/ which exists in my main application folder (and was the default folder in my old settings.py before changing it to my static app). My static app is mount on /static/. So, I guess that /staticfiles/ is not needed, right?

(10 May '12, 02:55) xpanta
1

That's correct, it wouldn't be needed, as your static files are collected elsewhere.

(10 May '12, 03:03) todork
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
×26

question asked: 10 May '12, 01:08

question was seen: 2,247 times

last updated: 10 May '12, 03:03

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