login community 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

1
2
3
4
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 May 10 '12 at 01:08

xpanta's gravatar image

xpanta
6014


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.

answered May 10 '12 at 02:03

johns's gravatar image

johns ♦♦
340427

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?

(May 10 '12 at 02:55) xpanta xpanta's gravatar image
1

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

(May 10 '12 at 03:03) todork todork's gravatar image
Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
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

Tags:

×643
×90
×20

Asked: May 10 '12 at 01:08

Seen: 562 times

Last updated: May 10 '12 at 03:03

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited