Django actually provides us with debugging information. Once an error occurs, a lot of information will be exposed when debug is set to true.
For example, the file, the row number, and the order in which these functions are called can all be seen.HoweverCodeIt can also be folded and expanded, so it is very convenient.
In this case, I just inserted a simple line where the Code requires a breakpoint:
Debug ()
This function is a non-defined global fu
[Django] data export excel enhanced version (very powerful !), Django data export
Not to mention, the principle is to use xlwt to export excel files. The so-called forced version refers to the implementation of selecting certain conditions on the webpage to export the corresponding data.
I have published such articles in my blog post before, but I only want to export data. This time, I thought about it and
Python 107th days -- Django basics 2, zero seven days django
1. Django request LifecycleRouting System-> attempted function (get template + Data => rendering)-> string returned to the user 2. Routing System/Index/-> function or class. as_view ()/Detail/(\ d +)-> function (parameter) or class. as_view () (parameter)/Detail /(? P /Detail/-> include ("app01.url
Added Rich Text function for Django content, django content text
Rich Text is missing, which is too simple to be viewed and read.
A feasible method is recorded as follows:
1-download the third-party Rich Text KindEditor and connect to http://kindeditor.net/down.php?baidu.
2-decompress the package to static/js under the Django project ,:
No config. js by default.
Django static file, django static
Django static files (js scripts, CSS, images, etc)
By default, it is stored in the static folder of each app,
The static file collection command automatically copies the files in the static folder under each app to the static folder in the root directory.
1. Create a static folder under app1, add the script folder to the fold
Django basic commands, Django commands
1. Create a project
Django-admin.py startproject myblog
2. Create an app
Python manage. py startapp blog
3. Create a database table or change a database table or field
Python manage. py makemigrations blog
Python manage. py migrate
4. Run the Development Server
Python manage. py runserver
5. Clear the database
Pyt
Django regularly executes tasks, while django executes tasks
To regularly execute tasks in the django project, such as capturing data and refreshing the database at a certain point in time every day, you can refer to the stackoverflow method to compile a manage first. py command, and then use crontab to regularly execute this command.
Customize the manage. py com
A message board written by django and a message board written by django
For the code, see
Https://github.com/linux-wang/show-me-the-code/tree/master/dj_test
Actually
Exercise in https://github.com/linux-wang/show-me-the-code
Writing with django is actually a bit complicated. You can use a lighter template to implement it (of course, his favorite is the bac
In Django, if the buffer type is used, the encoding format of buffer is the Utf-8 type. Using str () to convert to a string type is an exception.Exceptions will have the following hint: ' ASCII ' codec can ' t decode byte 0xe5This is due to the fact that STR is ASCII encoded by default in Python, and it is necessary to manually convert the STR encoding to UTF-8 by using the following codeImport sysreload (SYS) sys.setdefaultencoding ('UTF8')Using Pych
Tags: max user. com form form AAAAA int print use articleHttp://www.cnblogs.com/wupeiqi/articles/6144178.html 1 Initial Form Component #form validation (initial Form component validation)-Questions:-Unable to remember last commit, page refresh data disappears-verification of repeated commit data (whether the data is empty, length size, etc.)-Workaround: Django Form Components-define rules (the format of the data, the fields must match the Name propert
Several redirection methods in Django and several redirection methods in django
Here, django1.5 is used.
Requirement: There is interface A, where there is A form B. After the front-end submits B, the data is saved in the background, and interface A is returned. If the Save fails, an error is prompted ON INTERFACE.
Here we need redirection in the background, and the parameter, that is, the error message, mus
Django simple routing configuration and django routing configuration
Django = 2.0.1 route Configuration:
1. Create an app app1 in the same directory as manage. py.
Create a new urls. py file under app1 and define a blank route for app1:
From django. urls import pathfrom. import viewsapp_name = 'app1' urlpatterns =
How to deploy a django project in Apache and deploy django in apache
We have been using django manage until now. py runserver command to run the django application, but this is only our development environment. This is not feasible when the project is actually deployed and launched, we must deploy our project to a spec
Django return json data usage example, django return json sample
This example describes how to use Django to return json data. We will share this with you for your reference. The details are as follows:
1. Front-end. JQuery sends a GET request and parses json data. For details about the getJSON method, refer to here.
Url = "http: // example /? Question = "+ qu
Django analyzes the entire process from one request to the response at the underlying layer, and django analyzes the response at the underlying layer.
As we all know, all Web applications are essentially a socket server, and the user's browser is a socket Client.
#!/usr/bin/env python#coding:utf-8 import socket def handle_request(client): buf = client.recv(1024) client.send("HTTP/1.1 200 OK\r\n\r\
Django learning notes (5) template tags, django learning notes
About Django template tag official site https://docs.djangoproject.com/en/1.11/ref/templates/builtins/
1. IF tag
Hello World/views. py
1 from django. shortcuts import render 2 3 class Person (object): 4 def _ init _ (self, name, age, sex): 5 self. name = na
Django Development Summary: django Development
First, I used a virtual machine, python3.6 + django1.11.0:
To ensure version consistency and a better environment experience, we need to first run the virtualenv command in the virtual environment:
1. create an environment (name is the name of the virtual environment) virtualenv name 2. activate the virtual environment: source name/bin/activate 3. exit the v
Environment:
python2.7 x64Win7 x64Django (automatically installed with Pycharm) version: 1.10.2apache:2.4 x64
Download Pycharm Personal Edition non-community version and activate
Initially, a Community edition was downloaded, and it was found that there was no integration of Django at all. Later checked, in the Community version Pycharm can also be developed (see note 1:)
Note 1: The following steps are required to develop
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.