Doubts about static files

18 views
Skip to first unread message

sarfaraz ahmed

unread,
Aug 30, 2017, 9:58:05 AM8/30/17
to Django users
 Hello Team,

I have doubts about static files. I read articles on Django but it does not clearly states that atleast I got confused.

STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] this is my STATICFILES_DIRS settings which points out to static folder under my project. Also, I can add all the folder from individual app which hold static files here so that it search for static files.
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR),'static_root') which points out to one level up folder than my project. This is how my project folder structures look like

static_root
MyProject
--static
----CSS
----JS
----imgs
--MyProject
--MyApp

When I run collectstatic files moves files from static files from static folder to static root.

Now, my question is when deploy it on apache which folder should I point to in my conf files. static_root or static.

Regards,
Sarfaraz Ahmed





Kristofer Pettijohn

unread,
Aug 30, 2017, 10:04:13 AM8/30/17
to django...@googlegroups.com
Point Apache at static_root.

Django apps you install may also include static files, and "collectstatic" gathers all of those together and puts them in one place (under STATIC_ROOT).


From: "sarfaraz ahmed" <findsa...@gmail.com>
To: "Django users" <django...@googlegroups.com>
Sent: Wednesday, August 30, 2017 8:58:05 AM
Subject: Doubts about static files

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6b7e06ea-a56b-4b4b-b0ad-79ee4dbc3884%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mohammad k

unread,
Aug 30, 2017, 10:23:29 AM8/30/17
to django...@googlegroups.com
STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'firstdjango', 'static'),
)
STATIC_ROOT = '/Users/mk/Desktop/api/New folder/' : When you run collectstatic files moves files from static files from static folder to desktop.
add this settings to the settings.py

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

mohammad k

unread,
Aug 30, 2017, 10:23:29 AM8/30/17
to django...@googlegroups.com
move the static folder beside the settings.py
Reply all
Reply to author
Forward
0 new messages