python - Django doesn’t set STATIC_ROOT in settings.py -


trying understand how “upload files” works i’ve seen views.py doesn’t values, assigned in settings.py relative static_root , static_url. views.py gets staticfiles_dirs’s value , value not correct.

settings.py

base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) static_root = os.path.join(base_dir, 'static') staticfiles_dirs = [os.path.join(base_dir, ""),] 

urls.py

urlpatterns = [url(r'get_object/$', views.get_object, name = 'get_object'),] 

views.py

def get_object(self):    # static_files = settings.staticfiles_dirs     static_root = settings.static_root      if static_root:                 path = static_root         else:         path ='no object'      return httpresponse(path) 

django returns ‘no object’. when type in in views.py static_files instead of static_root

def get_object(self):     static_files = settings.staticfiles_dirs     # static_root = settings.static_root      if static_files:         path = static_files     else:         path ='no object'      return httpresponse(path) 

it returns 'c:/music/'. guess not correct path. gives correct path relative base_dir. hope correct static_root. thank in advance!


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -