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>
Preparations for earlier stages of Django Development: (1) django Development
Language: python3.5
Tool: JetBrains PyCharm
Advantages of virtualenvwrapper:
1. Independent Application Development Environments
2. Environment upgrades do not affect other applications or the global python environment.
3. It can prevent package management confusion and version conflicts in the system.
1. Install virtualenv
Django-grappelli inside use inline seems a bit of a problem, change a skin:
Django-suit is the second admin skin recommended by 2scoops.Supports:django 1.4-1.7. Python:2.6-3.The environment for this article is Django 1.7.1
Django-suit official websiteInstallation Guide LinksSet up Raiders
Translation is handled as fol
Django-custom page, django page
The paging function is necessary for each website. for paging, it is used to calculate the starting position of the data that should be displayed on the page in the database table based on the user input.
Determine paging requirements:
1. Number of data entries displayed per page 2. Number of page number links displayed per page 3. Previous and next pages 4. Home and last pa
Django-QueryDict object, django-querydict
InHttpRequestIn the object, the GET and POST attributes GET bothDjango. http. QueryDictThe created instance. This is a dictionary-like class customized by django. It is used to process multiple values with the same key.
In the original python dictionary, when a key has multiple values, a conflict occurs and only the last
[Django] design of the user permission Learning Series Self-owned permission management system design idea, django permission management system
If you encounter permission operation problems when reading this article, please refer to the first two chapters of this series!
Bytes
This article describes the idea of designing a self-owned permission management system. The self-owned permission management system
1. Install DjangoDjango's: https://www.djangoproject.com/download/Unzip to enter this directory, execute python setup.py install2. Testing#python#import pythonNo error occurred, proof of successful installation3. Create a Django Project#django-admin.py Startproject web_014. Modify settings.pyModify Time_zon to Asia/shanghaiModify Language_code to ZH-CNin the Installed_apps under Add ' blog ',Installed_apps
I. Overview
Django has a form library called django. forms. Define a form class for each HTML "
For the first time, I felt that Django was really powerful and powerful to abnormal.
1 from django import forms2 3 class ContactForm(forms.Form):4 subject = forms.CharField()5 email = forms.EmailField(required=False)
[Django] configuration of Django's css, image, and js static file production environment, djangocss
In Django, if HTML files introduce css, js files, or image images in external ways,
Keywords: django static file django production environment django1.8
Body:
Step 1: Create a static folder under the
[Django] Django Debug Toolbar debugging tool configuration, djangotoolbar
I am worried about how to debug Django.Django Debug ToolbarThis powerful tool.
First, let's talk about the problem:
There are also tutorials on the Internet, but there are a variety of things. I tried them one by one and did not run successfully. Finally, find the problem:
The development server log shows that the debug_toolbar has b
Django-grappelli inside the use of inline seems a bit of a problem, change a skin:
Django-suit is the second admin skin recommended by 2scoops.Supports:django 1.4-1.7. Python:2.6-3.The environment of this article is the Django 1.7.1
Django-suit official websiteInstallation Guide LinkSet Raiders
Translation is handle
django-admin.py startproject MySite
This command creates a MySite directory in the current directory.
django-admin.py this file in the C:\Python27\Lib\site-packages\django\bin folder, you can add the directory to the system path.
Django has a lightweight Web server built into it.
Enter the MySite directory, now go in t
1. PythonOf course you'll need Python. Still Python 2.7 is preferred, however if you would like to create new projects with Python 3, it's also fine to do.Newest Python could is downloaded from https://www.python.org/downloads/2. PipIt's a very powerful tool for installing and managing Python packages. We could use Pip to install Django also. To install PIP in Ubuntu 14.04, (To upgrade PIP: pip install-u pip)sudo apt-get install Python-pip3. Installin
1. Create a view
Go to the second mysite directory. Create a new view. py file.
The Code is as follows:
From Django. Http import httpresponse
Def Hello (request ):
Return httpresponse ('Hello World ')
You can see that the View File introduces the module HTTP from Django and imports the httpresponse function. A Hello function in the view. The reutrn httpresponse can be interpreted as response. Write in C.
Introduction to the use of f objects in Django-ORM
In the Django document, there is a section "query-related classes", which refers to join queries. 1.7 is newly added. The association here is the association of fields, rather than the association between tables.
Table join mainly uses three objects F (), Q (), and prefetch (), where prefetch is newly added by 1.7, and the other two are available in previou
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.