pyodbc Connects MSSQL to Execute SQL Statements
Use django to connect to SQL Server, and pyodbc to connect to multiple databases.
pyodbc, the SQL that runs the query, is very simple:
import pyodbc
connection = pyodbc.connect('DRIVER={SQL Server Native Client 10.0};SERVER=127.0.0.1;DATABASE=DB_name;UID=User_Name;PWD=PassWord')
curs = connection.execute('select * from table')
#curs.fetchone( ...
Posted by temidayo on Wed, 09 Oct 2019 08:05:18 -0700
Django-Docker Containerized Deployment: Django-Docker Local Deployment
This chapter will build a containerized Django project locally to experience how Docker works.
preparation in advance
development environment
Although there is a Windows-based version of Docker, all aspects of compatibility are not well done (installation is more troublesome), so it is recommended that readers install their own Linux or Mac sys ...
Posted by hl_tan on Tue, 08 Oct 2019 10:02:05 -0700
Talking about Web Framework
I. Essence of Web Framework
All Web applications are essentially a socket server, and the user's browser is a socket client.
II. Web Framework Function
socket sends and receives messages - wsgiref (test), uwsgi (online)
Returns different strings according to different paths
Return dynamic pages (string substitution) - jin ...
Posted by cptnwinky on Mon, 07 Oct 2019 23:20:58 -0700
Django uses celery and NGINX to generate static pages for performance optimization
Performance optimization principle:
When we want to return a page to client browser, we need to query data in database and render the data and basic page template to form a page to return to the client. But if every user visits the home page once, it will undoubtedly bring great performance problems to database query when the amount of visits ...
Posted by dshevnock on Mon, 07 Oct 2019 13:28:29 -0700
I. Django Installation, Configuration and Creation of Basic Functions Projects
Installation of Django
1. Using Pipenv to create an isolated environment
First, install Pipenv by command pip install pipenv.
Then create a folder as the root directory of the blog project we are going to develop. For example, I create a new directory named blog under my personal working directory C: Users Zerobit SpaceLocal Workspace G_Courses ...
Posted by garrisonian14 on Sat, 05 Oct 2019 02:29:15 -0700
The Django project uses qq q third party login.
The premise of using qqq login is to create website application on QQ interconnected official website and obtain APP ID and APP KEY of website application in QQ interconnection.
1. Routing
# qq Sign in
path('loginQq/',qq.loginQq,name='loginQq/'),
path('returns/',qq.returns,name='returns/'),
2. The front page writes the link ...
Posted by Avendium on Fri, 04 Oct 2019 19:52:58 -0700
Django front-end and back-end separate development-news management system
Project source download: https://github.com/Cherish-sun/NEWS/tree/master
Implementation of web API for News Tags and advertisements
1. serializers.py additions
# serializers to serialize News Tags
class TagSerializer(serializers.ModelSerializer):
# id = serializers.Field()
name = serialize ...
Posted by KrisNz on Fri, 04 Oct 2019 09:42:19 -0700
centos server on-line second django project method.
Aliyun Server Open Port 8001,9001
Create a virtual environment
virtualenv -p python3 web2
Make Virtual Environment Effective
source web2/bin/activate
Installing django and uwsgi in virtual environment
pip install django
pip install uwsgi
Create a django project
django-admin.py startproject myweb2
Modify the settins.py ...
Posted by justin.nethers on Tue, 01 Oct 2019 23:34:19 -0700
A simple small project blog Garden bbs home page building, using admin background management input data
Catalog:
bbs homepage construction
Using admin background management to input data
bbs homepage construction
First add the home url
# Add in urls.py
url(r'^home/', views.home),
bootstrap components used in front-end pages
https://v3.bootcss.com/components/#navbar
https://v3.bootcss.com/com ...
Posted by mlnsharma on Tue, 01 Oct 2019 21:52:36 -0700
Python Rapid Development of Scrapy, a Distributed Search Engine - Configuration of Scrapy Startup Files - xpath Expressions
We customize a main.py as the startup file
main.py
#!/usr/bin/env python
# -*- coding:utf8 -*-
from scrapy.cmdline import execute #Import and execute scrapy command method
import sys
import os
sys.path.append(os.path.join(os.getcwd())) #Add a new path to the Python interpreter, and add the directory of the main.py file to the Python interpr ...
Posted by double on Tue, 01 Oct 2019 13:15:07 -0700