Git project development operations
The basic flow
""" 1, before the development, pull a remote repository 2, a work area for development 3, the development results are submitted to the local repository - an event not to be treated when git status View 4, pulling the remote repository (filed before each secondary remote repository must pull) 5, if a conflict occurs, the line of communication (consultation redevelopment conflict file), to re-take the steps 3 and 4 6, there is no conflict, submitted to a remote repository """
Pulling code clone
Collaborative Development
""" 1) for all development on a branch - often called dev development branches 2) Follow git development process: first you submit a local repository, and then pull the server code, and finally submit code Submitted to the local repository: git commit -m 'Version information' Pull server code: git pull branch name source name Submit code: git push source name branch name """
Conflict Resolution
""" 1) Open the file conflict 2) Locate the conflict here: ==== >>>>> conflict began its own code Code <<<<<< version conflict 3) Remove the conflicting message: >>>>> conflict began ====, version number <<<<<< 4) Communication to integrate its own code and the code at line conflict, the final result of the code 5) to resubmit your local repository and then pull the server code, and finally submit code """
The combined development
""" eg: the dev branch content into the prod branch 1) to a branch prod: git checkout prod 2) The combined dev branch: git merge dev """
The combined development of remote, you can directly
pycharm use git
Combined with git terminal command used in combination, give the project to create init library, add. To the staging area, you can open pycharm as follows.
SMS verification
Tencent launched Cloud SMS
""" 1, the official website of the real-name registration account: https: //cloud.tencent.com 2, select Create a text message service application 3, apply for a signature and SMS templates - through micro-channel public number application """
Cloud messages Tencent second package
# SMS app SDK AppID - SDK AppID beginning with 1400 APP_ID = ... # messaging applications AppKey SDK APP_KEY = " ... " # SMS templates ID, need to apply for the SMS console TEMPLATE_ID = ... # signature - is `signature `content, rather than` signature ID` SMS_SIGN = " ... " # telephone prefix MOBILE_PREFIX = 86
# By MacOS ssl security certification Import ssl ssl._create_default_https_context = ssl._create_unverified_context # Obtain functional verification code Import Random DEF GET_CODE (): code = '' for i in range(4): code += str(random.randint(0, 9)) return code # Message senders from qcloudsms_py Import SmsSingleSender from .settings Import * SENDER = SmsSingleSender (APP_ID, APP_KEY) # Code sent from utils.logging Import Logger DEF send_sms (Mobile, code, exp): the try : # Send SMS Response = sender.send_with_param (MOBILE_PREFIX, Mobile, TEMPLATE_ID, (code, exp), Sign = SMS_SIGN, Extend = "" , EXT = "" ) # successful IF Response and Response [ ' Result ' ] == 0: return True # failure logger.warning ( ' % S - S% ' % ( ' message not sent ' , Response [ ' Result ' ])) the except exception AS E: # exception logger.warning ( ' % S -% S '% ( ' Message not sent ' , E)) return False
libs/txsms/__init__
# Function method package provided externally from .sms Import GET_CODE, send_sms
from libs import txsms code = txsms.get_code() print(code) print(txsms.send_sms('电话', code, 5))
redis database
Why learn Redis
""" 1, redis no-sql database memory is high compared to a hard disk database efficiency mysql 2, the configuration database using the memory value without directly using the memory, data storage is redis manageable 3, memcache is also the in-memory database, and is used by default django database memcache, memcache replaced by redis route is very simple, which is more powerful redis supports more data types redis own caching mechanism, a database system crash data also can retrieve functions appear redis persistent data can be done automatically (self data persistence features) the data expiration time redis mechanism itself can be completed """
redis installation
Note: The official website to install the system version, you can download the corresponding installation package
""" Supported data types: String, Hash, List, Set, Sorted Set String: store all other data types can not be stored Hash: storing data in the form of key-value, similar to the dictionary List: storing data in the form of a series of orderly value, a list (array) Set: a series of disorderly value is stored in the form of data collection Sorted Set: storing a reference value are arranged in the form of data, ranking """
"" " Important method set:key value get:key mset:k1 v1 k2 v2 ... kn vn mget:k1 k2 ... kn setex:key exp value """