Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Django 1.8 TEMPLATE_DIRS configuration and STATICFILES_DIRS     - Java multi-threaded communications pipeline flow (Programming)

- Open log in Hibernate (Programming)

- Linux system security norms (Linux)

- Through eight skills to let you become a super Linux end-user (Linux)

- Detailed software to run UnixBench (Linux)

- A simple shell script for monitoring in Linux (Linux)

- Oracle 11g RAC manually playing GI PSU patch (11.2.0.4.8) (Database)

- Android Studio Personalization (Linux)

- IOwait Linux system monitoring diagnostic tools (Linux)

- Redis configuration file interpretation (Database)

- Linux system monitoring, top command of the diagnostic tool Detailed (Linux)

- ORA-12154 TNS could not resolve the specified identifier (Database)

- Selection sort, insertion sort, and Shell sort (Programming)

- How to use the ftp tool to transfer files between Windows and Linux (Linux)

- Linux file and directory permissions settings (Linux)

- How common Linux automation tasks (Server)

- Configuring Proxy on a Unix terminal, accelerate Android Studio Construction (Linux)

- How wifi-linux AP signal strength detection (Linux)

- Linux under DB2SQL1024N A database connection does not exist. SQLS (Database)

- HAProxy performance under high concurrency (Server)

 
         
  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:      
 
- CentOS 7 - use cgroups limit process resource (Linux)
- Ubuntu install Scala 2.10.x version (Linux)
- Linux Getting Started tutorial: Experience Xen Virtual Machine chapter (Linux)
- State and Linux nf_conntrack TCP disconnect time (Programming)
- Create the best introductory tutorial REST API (Linux)
- Linux Log Clear (Linux)
- MySQL restart process can not be taken lightly (Database)
- Oracle 11g maintenance partitions (Seven) - Modifying Real Attributes of Partitions (Database)
- Debian 8 Jessie install LAMP server tutorial (Server)
- MySQL5.6 based GTID master-slave replication (Database)
- How to install Linux on a MacBook Pro Retina (Linux)
- Empty password Linux operating system (Linux)
- Java Foundation - implicit conversion vs cast (Programming)
- Use ISO document production OpenStack used CoreOS mirror (Linux)
- C # DateTime structure common method (Programming)
- How to merge two pictures in Cacti (Linux)
- How to create a new file system / partitions under Linux terminal (Linux)
- Ubuntu 15.10 How to install TeamViewer 11 (Linux)
- wget command Walkthrough (Linux)
- Crawl use Wireshark packet on remote Linux (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.