Posts

Setup Static and media root and static and media url in django

  http://www.django.co.zw/en/tutorials/setting-django-s-static-and-media-urls/ follow the step by step tutorial for settings up static and media urls. My points are below. 1. Goto the settings.py file. 2. "import os" we need to import os Class because we need to do some work with it. 3. go to the TEMPLATES section and change the DIRS list to "os.path.join(BASE_DIR, 'templates' " 4. go to the bottom of the file while STATIC_URL is written. 5. below the STATIC_URL write STATICFILES_DIRS = [os.path.join(BASE_DIR,'static_project')] it is a list. 6. now also create a static_project folder in your base directory. 7. in settings.py file below the STATICFILES_DIRS writedown STATIC_ROOT = os.path.join(BASE_DIR, 'static_cdn', 'static_root')  8. below it write down MEDIA_URL = '/media/' 9. now write MEDIA_ROOT = os.path.join(BASE_DIR,'static_cdn', 'media_root') the complete code will be look like in settings.py file STATI...