0

I am following 2 different tutorials on creating a Django App. In one video (on lynda) it states that my static (javascript/css/image) files should live here:

project_name/project_name/static/

I have a js and css file in there and it links up to my templates just fine. In the second tutorial on youtube (1:38 mark), I am learning how to store uploaded files. After using the collectstatic command, ALL of my files are now going to

project_name/static/

my settings.py:

import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATIC_URL = '/static/'    
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
]

STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "/the_office/the_office/static")

I looked here for a better understanding of static_root vs static files_dir and I'd rather it stay where it originally was. I've tried all combinations of file paths I could think of messing around with Static_Root and StaticFiles_Dirsbut no luck. How can I change the path back to the original? Any further clarification of the os.path.dirname(os.path.dirname(os.path.abspath(__file__))) is appreciated as well.

Community
  • 1
  • 1
Kervvv
  • 751
  • 4
  • 14
  • 27
  • 1
    Also: http://stackoverflow.com/questions/8687927/django-static-static-url-static-root – rnevius Mar 22 '16 at 15:21
  • @rnevius I saw the first link already but did not see the second one. After a 2nd hard look, the link made much more sense to me (rather than my initial 1st skim). Thank you for bringing them both to my attention. – Kervvv Mar 22 '16 at 16:27
  • I am hoping to however get an answer for better understanding of the os.path syntax. – Kervvv Mar 22 '16 at 16:28

0 Answers0