django - Where to put templates and static assets for deployment -


where should put static assets deployment? have in settings.py

if debug:     media_url = '/media/'     static_root = os.path.join(os.path.dirname(base_dir), "static", "static_only")     media_root = os.path.join(os.path.dirname(base_dir), "static", "media")     staticfiles_dirs = (         os.path.join(os.path.dirname(base_dir), "static", "static"),     ) 

here's directory structure on local machine:

├── env        ├── src     |   ├── esp_project |   ├── reports |   └── templates |       ├── registration |       └── reports └── static     └── static         └── css         ├── js         └── img 

from docs understand should served apache2, not python. clarify this? , templates, in "right" place?

for templates can make new folder in main static directory.

in settings.py can set path this.

template_dirs = (     os.path.join(os.path.dirname(__file__), 'static', 'templates'),     ) 

you can add in template loaders settings.py.

template_loaders = (      'django.template.loaders.filesystem.loader',     'django.template.loaders.app_directories.loader',  ) 

now django in static/static/templates templates (which static files).

the rest looks make sure have static_url = '/static/' above if debug:

see: django project loading templates


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -