Model layer - 9: Query set API
This section details the API of the query set, which is based on the following model, the same as the one in the previous section:
from django.db import models
class Blog(models.Model):
name = models.CharField(max_length=100)
tagline = models.TextField()
def __str__(self): # __unicode__ on Python 2
return sel ...
Posted by Sneo on Sat, 02 May 2020 12:02:14 -0700
Basic knowledge of Flask
Introduction:
Flask is based on python and relies on jinjia2 and werkzeug WSGI services as a micro framework
Werkzeug is essentially a Socket server, which is used to receive http requests and preprocess them, then trigger the Flask framework,
Developers process the request based on the functions provided by the Flask framework and return it to ...
Posted by lessthanthree on Tue, 28 Apr 2020 01:53:50 -0700
Play Django 2.0 --- Django notes foundation 11 (music website development)
11.5 song Leaderboard
The song leaderboard is accessed through the navigation link on the home page and displayed in descending order according to the number of songs played. From the design diagram of the leaderboard page, we can see that the web page has three functions: search at the top of the web page, song classification and filtering, a ...
Posted by damisi on Sun, 26 Apr 2020 20:24:08 -0700
Developing Restful api based on Django framework
In the last article, we explained the main concepts of restful api to let you have a preliminary understanding. In this article, we will learn to develop the interface of restful architecture through the Django framework of python. 1, Development environment Development language: Python 3.6IDE :PycharmFramework: Django 2.2.12Test tool: Postman ...
Posted by Sonic_Rage on Sat, 25 Apr 2020 23:25:04 -0700
Django advanced view and url configuration
URL configuration tips:
Method 1:
1 from django.conf.urls.defaults import *
2 from mysite.views import current_datetime, hours_ahead, hours_behind, now_in_chicago, now_in_london
3
4 urlpatterns = patterns('',
5 ('time/', current_datetime),
6 ('time/plus/(\d{1,2})/', hours_ahead),
7 ('time/minus/(\d{1,2})/', hours_ ...
Posted by qads on Sat, 25 Apr 2020 02:13:56 -0700
Django ORM multi table operation (Advanced)
Django ORM multi table operation (Advanced)
1, Create model
Next, we design the corresponding relationship between each table through the book management system.
Through the relationship above, we can define our model class.
from django.db import models
class Book(models.Model):
title = models.CharField(max_length= ...
Posted by bough on Fri, 24 Apr 2020 22:45:19 -0700
068. Using DRF view set of Python framework Django
One view atlas and the use of routing
Using the view set ViewSet, you can place a series of logically related actions into a class:
list() provides a set of data
retrieve() provides a single data
create() create data
update() to save the data
Destroy() delete data
The ViewSet view set class no longer implements methods su ...
Posted by NorthWestSimulations on Tue, 21 Apr 2020 22:30:51 -0700
Root out and solve the problem of error reporting of Django2 connecting MySQL perfectly
Introduction
Refer to the following article for the problem of Django2 connecting to MySQL and the solution of modifying the source code:
The interaction between Django and MySQL
However, there are many problems when the above source code modification method is used in the production environment.
This article explains in detail how to solve thi ...
Posted by dmcglone on Tue, 21 Apr 2020 00:13:28 -0700
Python solves the slider verification, and the Scarpy framework collects data to the redis database!
Catalog
Architecture introduction
Installation creation and startup
Profile directory introduction
Crawling data and parsing
Data persistence
Save to file
Save to redis
Action chain, verification code to control sliding
Architecture introduction
Scrapy is an open-source and collaborative framework, which was originally designed for page ...
Posted by cigardude on Sat, 11 Apr 2020 00:36:08 -0700
The post request of Django calling external js file appears 403
Today, I found an interesting problem. The function of writing js code in html works normally, but there are various problems when js code is put into js file.
1. When using jQuery to dynamically generate tags, it is recommended to put the js file written by yourself after < / body >
(otherwise, some functions m ...
Posted by Nexy on Fri, 03 Apr 2020 19:00:08 -0700