Using the ORM in the Python Django framework to establish the query API, djangoorm
Summary
In this article, I will directly discuss the use of Django's low-level ORM query methods from the perspective of anti-pattern. As an alternative, we need to establish query APIs related to specific fields in the model layer that contains business logic. These APIs are not v
.") ")
Screenshots:
After the Weibo authentication callback your page time, will bring the code to come over, this way can see.
how to proceed next.
Of course, back to the execution of the testweibo.py command line, the code input into the return, look at the picture:
This is the result of getting friends.
For API calls, you can try using tools to match tests:
You will naturally think of what the naming conventions for
1. Install Pip
sudo apt-get install Python-pip
2. Install Django and create the project
Pip Install django==1.9.2django-admin.py Startproject MySite
CD MySite
3, Installation Python2.7-dev
sudo apt-get install Python2.7-dev
4, Installation Uwsig
sudo python2.7-m pip install Uwsgi
5. Then go to the directory to find the created project
Create test.py
developers free of charge under the BSD Open source agreement.
Django has a sophisticated template mechanism, object-relational mapping mechanism, and the ability to dynamically create a background management interface, and with Django, you can quickly design and develop WEB applications with MVC levels. To discourage developers from using the Django framework,
Compiling RESTful API in Django (1): serialization, djangorestful
Welcome to my personal website: www.comingnext.cnAbout RESTful APIs
Now, in the development process, we often hear the technical term "frontend and backend separation". As the name suggests, the frontend development and backend development are separated. The implementation of this technical solution is to use the
development framework for WEB developers, and is licensed to developers for free use under the BSD Open source protocol.
Django has a well-established template mechanism, object-relational mapping mechanism, and the ability to dynamically create a background management interface, using Django to quickly design and develop a WEB application with an MVC hierarchy. To discourage developers from using the
ORM database query operation API in the Django view, and django view ormapiAPIS for querying table records
Operation: models. Table name. objects. Method ()
All (): Query all results filter (** kwargs): it contains the object get (** kwargs) that matches the given filter condition ): returns an object that matches the given filtering condition. Only one of the re
Python framework django Basic Guide, python framework django
Django introduction:
Django is an open-source Web application framework written in Python. It adopts the MVC framework model
Python Web development framework-Django (1), python-django
In the past, web. py (another lightweight web Development Framework) was used as a monitoring and management platform, so it was hard to pick up without making special records. Recently, a log aggregation system is using dj
Python Study Notes _ 04: Django framework introduction, _ 04 django
Directory1. What is Django?2. Build a development environment for the Django framework3 Introduction to Django operations on MySql Databases4. Powerful
object by the specified format string parameter, such as {{pub_date|date: "F J, Y"}}.Length: Returns the lengths of the variables.⑥include LabelThe {% include%} tag allows the contents of other templates to be included in the template.
{% include "test.html"%}
7. Django ModelDjango provides good support for a variety of databases, and Django provides a unified call
Python Web development framework-Django (2), python-django
Next, I will introduce some practical skills and notes. The first time I used MarkDown for editing, I felt that the gap was too large and not so nice.GET/POST
Data Interaction between the front and back ends. JQuery is used to implement get/post requests.GET M
Django is a web development framework that can make web development work pleasant and efficient.
Using Django enables you to build and maintain high-quality web applications at a low cost.
It is somewhat similar to PhP codeigniter and uses the MVC design pattern.
The basic installation steps are as follows:
1. Install Python (note version)
To play the API of the model layer
Now let's go into the python shell and play around with the free APIs that we've provided for our Django. Run the Python shell using the following command:
Python manage.py Shell
Now that you've entered the shell, look at the
Django is a Python class library that must be installed before using Python. It is recommended to use Python3, the latest Django version that supports python2.7 is 1.11LTS.First, installation method:Install using the PIP command.Pip Install django==2.1 (This command can spec
Add by Zhj: The writer is the technical director of Dabapps, who argues that using the ORM Query method provided by Django directly in view is not good, and I disagree with that, maybe the authorThis article is for Django beginners, so it's a bit verbose when it comes to explaining how the method evolves, at least method 1 is not necessary to say.This article describes how to add method properties to the Qu
author of Django-rest-framework also think so, so we have ready-made wheels can be used. This wheel is another protagonist of this article--routers. It is also simple and rough to use, rewrite urls.py: fromDjango.conf.urlsImportURL, include fromSnippetsImport views fromRest_framework.routersImportDefaultrouter#Create a router and register our viewsets with it.Router =Defaultrouter () router.register (R'Snippets', views. Snippetviewset) Router.registe
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.