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 django. This time, we will write it down to facilitate query.
Label: Debug Django tools debugging Use Django-debug-Tools
It is very easy to develop with Django, but many times our experience is not enough, we will dig a lot of traps for ourselves, whether it is performance problems, or the use of development language skills will pose a threat to the stability of the application. After development, debugging and optim
Django many-to-many relationships, django many-to-Relationship
Django 1, 1.7
Use ManyToManyFiled to define multiple-to-multiple relationships.
In this example, the Article can be published on multiple publications, and the Publication can have multiple Article objects.
from django.db import modelsclass Publication(models.Model): title = models.CharField(max
Django-admin.py startproject mysite
This command creates a mysite directory in the current directory.
Django-admin.py file in c: \ python27 \ Lib \ Site-packages \ Django \ bin folder, you can add this directory to the system path.
Django has a built-in lightweight Web server.
If you enter the mysite directory, enter t
Django --- media static file configuration global variables, django --- media staticMedia static file configuration
Static files are mostly used to store data used to render front-end pages, and media is used to store client uploads or other files.
Add path to setting. py
MEDIA_ROOT = (OS. path. join (BASE_DIR, 'blog01/media') MEDIA_URL = '/media/' # Alias, which can be written at will
Add Route Allocation
In django, the Data Query condition is that the table columns corresponding to the foreign key in the table should be searched ?, Django table
1. Generally, the condition for finding data in a table is the existing data type in python. You can use the dot operator to directly find the data. If the condition is a column in the table corresponding to a foreign key column, how do I query data? For example
clas
First, Templates filterFilters are part of the Django template languageModify variables in a template to display different content{{value | filter}}Example: {{list_nums | length}} indicates the length of the list{{Value | filter | filter | filter}} can be superimposedDjango Template If there is a non-existent variable, will not error, will only give a null valueSo modify add_article.html Remove {{% if *%}} Add filter defaultDOCTYPE HTML>HTML>Head>
This article mainly introduces the use of django-tagging in the Python Django Framework, for the function of the tag part of network programming to help, the need for friends can refer to the
Django uses the app mechanism to reuse components, and making full use of existing apps can greatly simplify the development effort. Currently Django's app is not rich enou
1. Django's Development server The Django framework contains a few lightweight Web application servers that no longer need to configure the server when developing Web projects, and the built-in servers that Django provides can be loaded automatically when code is modified to enable rapid website development. Under the directory of the Django_pro project we created, open the DOS command line and start the b
Use Django to implement a runable blockchain application, django Block
We are new to the rise of digital currencies and want to know the technology behind it-how blockchain is implemented.
However, it is not easy to fully understand blockchain. I like to learn in practice and learn more about the technology by writing code. You can build a blockchain to deepen your understanding of the blockchain.
Preparat
Django analysis-how to customize manage commands, django custom manage
We have used Django manage. py command, while manage. py is a command line tool automatically generated in the root directory when we create a Django project. It can execute some simple commands. Its function is to put the
[Django] django-debug-toolsUse django-debug-tools
It is very easy to develop with django, but many times our experience is not enough, we will dig a lot of traps for ourselves, whether it is performance problems, or the use of development language skills will pose a threat to the stability of the application. After d
Django file storage (2) custom storage system, django file storage
To write a storage system by yourself, follow these steps:
1. Write a file inherited from django. core. files. storage. Storage.
from django.core.files.storage import Storageclass MyStorage(Storage): ...
2. Django must be able to instantiate MyStorag
Django-access control, unable to access django InternetThe user authentication system provided by django provides the access control function.1. Only login users are allowed to log onDjango users can be divided into two types: one is authenticated users, that is, in django. contrib. auth. models. user. The other is ano
After the last chapter, we've created the good one Django app, and then we're ready to refine it.First, let's start with some basic concepts.
Each application created in Django is made up of Python packages that follow certain conventions. Django comes with a utility that automatically generates the basic directory structure of an application, so you can
Django-full-text retrieval, django-full-text retrieval
After two months, I finally completed all the major functions. In the past week, I have consulted a lot of materials to achieve full-text retrieval, I will record it here today, so as not to catch it later ~
First, I will introduce the Django full-text search logic I used. I checked various materials on the I
Django Model Modification and data migration, django model migrationMigrations
It is troublesome for Django to modify the Model. The syncdb command only creates tables that are not in the database and does not modify existing data tables synchronously, you cannot delete the data model. If you add or modify fields in the data model or delete a data model, you need
Django unit test (1), Django unit test (
The Django testing framework is very simple. The preferred method is to use the unittest module in the python standard library.Writing tests
Unit Tests of Django use the unittest module of python, which defines tests using class-based methods. Class Name:
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.