Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Django 1.8 TEMPLATE_DIRS configuration and STATICFILES_DIRS     - Oracle archive log size than the size of the online journal of the much smaller (Database)

- Memcached and Redis (Linux)

- Ubuntu 14.10 users to install Audio Recorder 1.5.7 (Linux)

- iOS in the event delivery and the responder chain (Programming)

- Ubuntu 15.10 / 14.04 install subtitling software Aegisub (Linux)

- Install Firefox 32 official version of the Linux system (Linux)

- Git you do not know about some of the things (Linux)

- Chkconfig command Detailed service is added and shut down the system in two ways to start service under Linux (Linux)

- To use Java arrays implement the order form (Programming)

- Linux environmental performance data acquisition system (Linux)

- PXE + Kickstart automatically install CentOS 6.5 (Linux)

- Django url () function Detailed (Programming)

- Upgrade installation manual CentOS6.5 GCC4.8.2 (Linux)

- CentOS6.5 setup Oracle 11gR2 startup (Database)

- Rails project prepared some tips small experience (Linux)

- ntop monitoring software configuration and installation (Linux)

- Sleuth Kit: used to analyze a disk image and restore files open source forensics tools (Linux)

- Linux kernel compilation, the configuration of the motor drive (Programming)

- Linux platform host to prevent hacking skills (Linux)

- NFS installation process under the CentOS (Linux)

 
         
  Django 1.8 TEMPLATE_DIRS configuration and STATICFILES_DIRS
     
  Add Date : 2018-11-21      
         
         
         
  Django 1.6 after settings.py file no TEMPLATE_DIRS template directory and STATICFILES_DIRS static access directory, you need to manually add, recently encountered this problem, the solutions to talk about

1. Environment

System: Ubuntu

django release: Django-1.8.4.tar.gz

2.settings.py Profile Description

An increase of about content

import os

BASE_DIR = os.path.dirname (os.path.dirname (os.path.abspath (__ file__)))

base_dir is engineering project directory, the project directory is the application of an app directory, os.path.dirname (__ file __): directory settings.py file.

3. Indicate TEMPLATE_DIRS path, locate the following code, marked red part is added TEMPLATE directory, defaults to an empty list.

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        # 'BACKEND': '/ root / day10 / s4web / templates',
        'DIRS': [. Os.path.join (BASE_DIR, 'templates') replace ( '\\', '/'),],
        'APP_DIRS': True,
        'OPTIONS': {
            'Context_processors': [
                'Django.template.context_processors.debug',
                'Django.template.context_processors.request',
                'Django.contrib.auth.context_processors.auth',
                'Django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

In fact, behind the replace ( '\\', '/') can not add, the phrase used in the windows in the '\' into '/'.

4.STATICFILES_DIRS configuration is relatively simple, at the end of settings.py add the following code on

STATICFILES_DIRS = (os.path.join (BASE_DIR, 'static'),)

5. Configure complete.
     
         
         
         
  More:      
 
- Linux Systemd-- To start / stop / restart services in RHEL / CentOS 7 (Linux)
- Linux Systems Getting Started Learning: Configuration PCI passthrough on a virtual machine (Linux)
- MyCAT log analysis (Database)
- CentOS 7 How to connect to a wireless network (Linux)
- Use the Find command to help you find those files that need to be cleaned (Linux)
- How to install CentOS 7.x in OpenERP (Odoo) (Linux)
- Java implementation linear table - represents the order of representation and chain (Programming)
- stat Usage: Get permission to file the corresponding figures (Linux)
- To explore the caching mechanism for Android ListView (Programming)
- OpenSSL to generate public and private key (Linux)
- A summary of Java multi-threaded programming - acquaintance multithreading (Programming)
- Ubuntu 14.04 solved using MyEclipse 10.7 flash back (Linux)
- MongoDB common optimization settings in Linux (Database)
- Cygwin install Python MySQLdb (Linux)
- Ubuntu use three methods to install Ruby (Linux)
- How to use the TF / SD card making Exynos 4412 u-boot boot disk in Mac (Linux)
- CentOS 6.5 start ActiveMQ being given to solve (Server)
- Oracle 10g in the unique and index problems (Database)
- Linux virtual machine how to access the Internet in a virtual machine when using NAT mode (Linux)
- CentOS7 install MySQL5.6.22 (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.