Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to Django CMDB system (1) basic Environment

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Introduction to Django CMDB system (1) introduction to basic Environment

Author: he Quan, github address: https://github.com/ × × QQ AC Group: 62-01-76-50-1

Through this tutorial to complete from scratch, you can write a simple CMDB system independently.

At present, the mainstream methods of development are divided into two types: mvc and mvvc. This tutorial is based on mvc, where django is responsible for rendering html. An introductory tutorial on mvvc (front and rear separation) will be introduced later.

Tutorial project address: https://github.com/ × × / husky/

Tutorial documentation address: https://github.com/ × × / husky/tree/master/doc

Description

The framework is the repeatable design of the whole or part of the system, which is represented by the interaction between a set of abstract components and component instances.

It is believed that the framework is an application framework that can be customized by application developers.

Django is a famous Web framework under Python.

Django has many advantages, convenient and rapid development, such as Auth, Cache, template natural MVC design pattern, practical management background with ORM, Template, Form, Auth core components simple url design peripheral plug-ins rich technical preparation

You need to have basic python coding skills and basic html js skills, and have a general understanding of django.

Environment introduction mvc mode centos 7.6python 3.6django 2.2mysql 5.7pycharm 2019.2 (remote centos development on windows) vmware workstation 15.5.0Project name: huskycbv programming mode remote environment configuration installation centos 7.6system installation python3.6yum install epel-release-yyum-y install sqlite sqlite-develyum install python-devel mysql-devel python36-devel.x86_64-ysudo yum-y install https://centos7.iuscommunity.org/ius-release. Rpmyum install python36 python36-setuptools-yeasy_install-3.6 pippython3.6-m pip install--upgrade pipmv / usr/bin/python / tmp/ln-s / usr/bin/python3.6 / usr/bin/pythonsed-I's /\ #\!\ / usr\ / bin\ / python/\!\ / usr\ / bin\ / python2/' / usr/bin/yumsed-I's /\ #\!\ / usr\ / bin\ / python/\ #\!\ / usr\ / bin\ / python2/' / usr/libexec/urlgrabber-ext-downmkdir-p / root/.pip/cat > / root/.pip/pip.conf project interpreter-- > add-- > ssh interpreter sets remote python environment

Set / usr/bin/python3.6 directory to select → / opt

File-- > new project-- > django

Deployment database is deployed in docker mode in order to be fast. Mkdir-p / data/dockermkdir-p / data/mysql5722sudo yum install-y yum-utils device-mapper-persistent-data lvm2sudo yum-config-manager-- add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.reposudo yum makecache fastsudo yum- y install docker-cedocker versionsystemctl enable docker.service systemctl start docker.servicesudo mkdir-p / etc/dockersudo tee / etc/docker/daemon.json Select run manage.py task

Makemigrations generates data files

Migrate generates the table structure according to the file

Createsuperuser

Set the pycharm project startup address to 192.168.100.99

Pycharm starts the django project (not on the command line)

Ssh://root@192.168.100.99:22/usr/bin/python3.6-u / opt/manage.py runserver 192.168.100.99:8000Watching for file changes with StatReloaderPerforming system checks...System check identified no issues (0 silenced). October 31, 2019-09:33:33Django version 2.2.6, using settings' husky.settings'Starting development server at http://192.168.100.99:8000/Quit the server with CONTROL-C. Other

Test login http://192.168.100.99:8000/admin and enter the account password

Create a requirements.txt file

Pip3 freeze > requirements.txtpip3 install-r requirements.txt # # install all modules. If there are any additional modules, you need to add them to it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report