Search Engines - integrated project development [projects]

1.pipenv - virtual environment management tools and package management tools

Not really the environment V to EN v

pipenv: Virtual Environment + pip

The concept: Pipfile community is dependent on the development of document management, used in place of too shabby requirements. TXT file. 
Format TOML
role: a project corresponds to a Pipfile Download: PIP install pipenv
   
PIPfile   modify the source pip   # sub-development and test environments can be seen in this test those things need to be installed and tested the installation package 
PIPfile. Lock  
pipenv Graph # View dependencies
pipenv install   Requests - Skip - Lock # is no longer necessary to download dependent requmengts .txt
pipenv install   - dev pytest - Skip - Lock # install the relevant modules and add to Pipfile
pipenv   - the WHERE project path - Venv # display virtual information environment - Py Python directory check check for vulnerabilities - Three # uses the current Python3 system to create environment -

 
       
       
       Python 3.6 is specified to create a version of the Python environment shell activated virtual environment Uninstall - All uninstall all the packages and removed from the Pipfile
       

       
Creating pipenv environment
pipenv --python3.7

Replacing pi by pipenv

 

2. Custom User Model

Custom user model: the need for custom fields defined permissions model which must be filled

Custom User Model User (Inherited AbstractUser) 
1. definition field  
2. define which rights
3.require_fields (required field)
4. specific permissions
5. The rights applied
6. The authority which access to the application
7. custom administrator permission

# Create a user control process Myusermanager he inherited BaseUserManager

 

3. Priority trying to use the generic class

 

Class View # to see after we give him and certification requirements must be logged generic class view # logical additions and deletions to change search the users information in all cookiecuser generated view view code is as follows


ccbv

4. Save the sensitive information in a system environment variables

 

12factor.net/zh_cn # View twelve -factor View methodology see django application configuration environment variable to 
12:00 on standard
open source packages are based on this
cookiecures
django-elvaen
The benefits of environment variables to store information:
Configuration application configuration and code separation 
1. more convenient version control of all files without a password configured not to worry .ingone
2. Each change requires no configuration information
cloud configuration management more convenient 2.  

django how do

In the config 
configuration #local # local development (Import Import .base env)
#prodection production files (Import Import .base env)
#bace jointly owned Configuration

bace.py

environ function modules #

.env file (must be added to .ignore)

.env in the project root directory # own side after upload their own use b as a global cloud environment configuration file 
to .env .gitignore file to the GIT of sensitive information leaks can be avoided .env file
all configuration and sensitive information  
of all production Import .base both local and the env Import APP_ENV set the operating environment of the current application; APP_DEBUG setting whether debugging information is given in the application; key for encryption APP_KEY generating applications some of the more sensitive data. After you finish setting .env file, we can pass arguments to the getenv method to get to .env values specified in the file, such as calling getenv ( 'APP_ENV') will return local.




After uploading the cloud

In .bash_profile not see any cloud configuration and code

 

5 are arranged in different environments setting.py

Debu open development environment

In the config settings in the local base production

g=True

6. Test Unit

In tests file 
input test
for the views urls   Models Forms   Apps   test_views function to minimize
front of each method must join a test_ bright sun test_index_articel

Test coverage

pipenv install coverages - Skip - Lock   # Download couverage 
pipenv RUN coverages HTML # will generate a htmlcov in the project path

Contrast with remote warehouse

Check test coverage report in the index.html

 

Guess you like

Origin www.cnblogs.com/xzqpy/p/11391761.html