Dear Students:Hello! 51CTO College for the dream of value-added, invites your attention! 51CTO Academy is committed to allowing experts to share technology and technology to achieve, so that the vast number of technology enthusiasts convenient and affordable access to quality learning resources.In order to facilitate the study, we specially organized the Python Learning Roadmap-Suitable for beginners to project development (video + documentation) dry extract , click to see more >>
Django models operation database, djangomodels
1. Create a database and link a database
(1) Create a database in models. py
from django.db import modelsclass UserInfo(models.Model): nid = models.AutoField(primary_key=True) user = models.CharField(max_length=30) email = models.EmailField()
(2) register the app in settings. py
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages'
Computer room management has always been a long-standing problem in operation and maintenance department. Operation and maintenance department has been missing a unified asset management system.Number of equipment, brand variety, information update is not timely. Ultimately, it is difficult for it to review and evaluate existing resources.Many business operations departments do not have the ability to develop the CMDB system to meet their own needs, a
=p%2fkcyxikbs9m%2fy6pjzes8n2a56adxh0slt6poaxfmwme6h8m4kakdkmq80vvpmepImportant: This article is the first of a series of "chat and monitor" articles, and introduces the relevant content of monitoring indicator trade-offs.3. The road of operation and maintenance automation based on CMDB and Saltstackhttps://mp.weixin.qq.com/s?__biz=MzA3MzYwNjQ3NA==mid=2651296412idx=1sn= 645b8d9f5ee9226fcf57987a7fac95c7scene=0key= B28b03434249256bc04268e50009d90376b775d
able to script you to choose a different inventory file, which can be written in any language, just to match his output format to JSON.Scripts for external inventory lists are required to accept 2 kinds of ansible calls. Assume that it is called with--list. It returns a list of groups and hosts that can be used. If called with--host, a list of available hosts is returned.All the output must be in JSON format, so the language you use is best to support this format easily.Let's write a module tha
. Ansible can also use scripts to select other inventory list files. This script can be written in any language as long as its output format complies with JSON.
The external inventory list script needs to accept two types of Ansible calls. If you use -- list for calling, it returns a list of available groups and hosts. If you use -- host for calling, returns a list of available hosts. All outputs must be in JSON format, so it is best to easily support this format in your language.
Let's write a
Key Performance Indicators (KPIs ):
1. Percentage of Ci attribute errors in CMDB
2. The proportion of the Ci verified by the configuration is successful.
3. Number of unauthorized configurations
4. Number of accidents and problems caused by improper changes
5. Time required for approval and implementation of a change
6. Number of service failures caused by inaccurate CI information
Key success factors:1. Keep
Settings$ pyenv Global 3.5.3All windows controlled by PYENV are 3.5.3 versions (global basic disabled)$ pyenv Global SystemShell Session Settings$ pyenv Shell 3.5.3Not affected in another windowThe shell session is broken and the configured Python is back to the sameLocal SettingsUse the PYENV local setting to recursively inherit this setting from the current working directory.$ mkdir PYTHON/PROJECT-PVParent directory or Python version of the original systemThe subdirectory also inherits the Py
configuration file, and the templates directory is the HTML file that is the T in MTV. Manage.py is a Django project management file.3. Create an appYou can include multiple apps in each Django project, like sub-systems, sub-modules, features, and so on, in a large project, independent of each other, but also associated.All apps share project resources.Enter the command in the terminal terminal below Pycharm: Python manage.py Startapp CMDBThis creates a app,django, called the
Today, the operation and maintenance of the platform to add a function, is to integrate the Zabbix picture into the CMDB platform, of course, if you want to display graphics very beautiful is not recommended to do so; After several blogs, I also write a summary of the document:The main ideas are:1. Find the URL of the Zabbix image.2. Read all the contents of the URL to generate a JPG file.3, traverse the picture directory to return the picture file to
old boyis a domestic group early to do Python training institutions, the following small series for the Python Automation course and the full stack of lessons to do a summary, hope to help you:python full stack development:Suitable for the crowd: fresh undergraduates, specialties, and 0 basic studentsLearning Basics: 0 BasicsClass form: 5 months, Monday to Friday classesCourse content: Linux basics, Python basics, network programming, database applications, Web development, algorithmic design pa
Django Routing and view of the Python full stack Road seriesThe route is basically the correspondence with the view (function), how to say, a route corresponding to a view, as mentioned in the above article, when the path is opened to /users/ let users the function of logic processing, the results of the processing back to the front.So how does Django know where to look for a routed configuration file entry? In fact, this is settings.py already defined in the file:root_urlconf = ' Ansheng.urls '
res.status_code in error_code_list: print("url: {}, status code: {}".format(str_url,res.status_code)) else: breakIf the URL contains https, how do you deal with it?res = requests.get("https://www.12306.cn",verify = False)print(res)Requests the API interface for the added host information. Due to the request, token information is required, the URL needs to be stitched down.# url后面的”“ 表示后面要接参数 ,因为在字典里面定义了(para变量),requests模块加了params后会自动进行 拼接得。# http://115.28.147.15
Tags: for lang pat meta connections int obj view URL1. From APP01 import models importing database2.U = Request. Post.get (' username ') p = Request. Post.get (' password ') to obtain user-entered account number and password through these two steps3.obj = models. UseInfo.object.filter (Username=u, Password=p). First () match the databaseIf obj: Determine if the user has entered the correct account passwordURL file Settings login and Indexurl interface fromDjango.conf.urlsImportURL fromApp01Impor
release system.function or relatively simple, a front-end guy to get the page what's 1 weeks to finish, the key is to put all the new technologies in the current show a wave, although the page is very ugly. Several system interfaces call their own research and write a few days to finish.Several features that are mostly done1. Release Configuration ManagementSite or system development language, deployment of the target system, to deploy those hosts, is not Docker container way, Docker to deploy
1 The first part of the catalogue detailedModify the configuration in the URL in the Django project: fromDjango.contribImportAdmin fromDjango.conf.urlsImportURL fromDjango.urlsImportPath fromDjango.shortcutsImportHttpResponsedefHome (Request):returnHttpResponse ('') Urlpatterns=[url (r'^admin/', admin.site.urls), url (r'^h.html/', Home),]View CodeYou need to enter the corresponding page to accessCreate Apps #2 SectionIt is recommended to do Django in a clean directory, do not directory nested di
Tags: sqliteFirst, how to enter the sqlite3 interactive mode for command operation?1. Confirm whether the Sqlite3 is installedGo to the python command line and execute>>> Import sqlite3
>>>No error, indicating that Sqlite3 has successfully installed the2. How to enter the Sqlite3 command lineSqlite3/path/to/dbnameDirectly execute sqlite3 Plus database name~ sqlite3 ~/downloads/django_test/cmdb/db.sqlite3
sqlite3sqlite version 3.14.0 2016-07-26 15:17:1
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.