Simple Django tutorial, django tutorial1. Introduction to Django 1. Introduction to the web Framework
Before introducing Django, you must first introduce concepts such as WEB framework.
Web Framework: someone else has set a web website template. You can learn its rules and t
Python Django environment setup tutorial (MAC + pycharm + Django ++ postgreSQL), djangopycharm
Setting up the Django environment seems to be a very simple task. In fact, it is not the case that I have struggled for more than half a day, so I would like to summarize the entire setup process here, at the same time, we al
This article mainly introduces a simple tutorial on using the Django-userena component in Python, including the implementation of simple functions such as user login and registration. if you need it, refer to using twitter/bootstrap, the basic template of the project is successfully completed. Next, process the user Center.
The user center mainly includes personal information maintenance such as user login
seems a bit unreasonable.
Django-userena uses regular expressions to verify the user name and rewrite the registration form to modify the authentication rule to cancel the restriction.
Username_re = R ' ^\s+$ ' attrs_dict = {' class ': ' Required '}class bssignupform (Signupform, bootstrapmixin): USERNAME = Forms . Regexfield (Regex=username_re, max_length=30, widget=forms. TextInput (attrs=attrs_dict), label=_ ("Username"),
A simple tutorial on using the Django-userena component in Python django
This article describes how to use the Django-userena component in Python, including the implementation of simple functions such as user login and registration. For more information, see
Using twitter/bootstrap, the basic template of the Project is
This article mainly introduces the Python Django Django-userena components of the simple use of the tutorial, including user login and registration, such as the implementation of simple functions, need friends can refer to the
Using Twitter/bootstrap, the project's underlying template is well done. The next step is to start processing the User Center.
User Cent
example, {{ship_date|date: "F J, Y"}}, we pass the variable ship_date to the date filter. Specify the number of references "F j,y" at the same time. The date filter formats the output according to the number of parameters. The filter is with a pipe character (|) To invoke. You can see the UNIX pipe symbol in detail.In fact, I prefer to filter this information in the background. Because we cannot ask the artist or the person who participates in the layout design to have too many programming foun
/background.gif.
Then, in the style sheet file (polls/static/polls/style.css), add:
/* POLLS/STATIC/POLLS/STYLE.CSS * *
background:white url ("images/background.gif") No-repeat right Bottom;
}
Reload http://localhost:8000/polls/ you will see that the background image is placed in the lower-right corner of the page.
Warning
Obviously {% static%} template tags are not available in static files, such as style sheet files, because they are not Django
Dear friends, I used to create a project: Because tables are not associated, we use non-relational database mongodb. the project development environment uses python + django and is deployed on ubuntu. At that time, pymongo was used to connect python to mongodb, and the engine was used to connect django to
query for all British users older than or equal to 18 years old, or all users older than or equal to 20 years old. From mongoengine.queryset.visitor import q user.objects ((q (country= ' UK ') Q (age__gte=18)) | Q (AGE__GTE=20))# Sort from datetime import datetimeClass blogpost (Document):title = Stringfield ()Published_date = Datetimefield ()Meta = {' Ordering ': ['-published_date ']} blog_post_1 = blogpost (title= "blog post #1") Blog_post_1.published_date = DateTime (1, 5, 0, 0, 0) blog_pos
indicates the minimum version of the request, and the server will return all data with a version greater than or equal to 0 when the request is received.First, add a URL rule to url.pyURL (r ' ^download/(? pThen add the function to the view.py download_kanjidef Download_kanji (Request, version=0): kanji = _mongo.get_kanji (int (version)) return HttpResponse (Kanji, Content_type= "Application/json")Read data greater than or equal to versiondef Get_kanji (self, version): # Check pending
Advanced content: How to write reusable applications
This article starts at the end of part seventh (en) of the tutorial. We will translate the previously written survey application into a separate Python package that can be reused in new projects and shared with others.
If you have not completed tutorial 1-7, we encourage you to complete them again so that you can match your project with the following
option.16. Added some development issues.1] Skip + limit page flip, the more slow the back, some materials say that using the array element paging can solve, not yetI tried it. The more reliable method is to first find the ID of the last time and do not use skip when turning pages:Last_row_id = objectid ('....');DB. activity_stream-> Find ({_ ID: {$ LT: last_row_id },User_id: 20}). Sort ({_ ID:-1}). Limit (10 );2]. select only the fields that are actually needed3]. When updating a piece of data
minimum version number of the request, and the server will return all data with a version number greater than or equal to 0 when it receives the request.First, add a URL rule in url.pyURL (r ' ^download/(? pThen add the function in the view.py download_kanjidef Download_kanji (Request, version=0): kanji = _mongo.get_kanji (int (version)) return HttpResponse (Kanji, Content_type= "Application/json")Read data greater than or equal to versiondef Get_kanji (self, version): # Check pending
First, the Environment Basic step 1, enter the development environment of the virtual space, do not know see the transmission Door 2, the version of the basic package
django@1.11.8 mongoengine@0.15.0
3. Installation package
Pip Install Mongoengine4, create a new Django project, and specify the Python.exe in the virtual space Two, configure in Django
1, in the set
Tags: ice pip sts Ram Model content pip install Image awl1. Introduction It used to be developed using the django+ relational database MySQL, which now requires the use of django+ non-relational database MongoDB, which can be used directly in Django for MySQL operations, but Djang
Linux mongodb installation and data import and export tutorial, mongodb Import and Export
How to install mongodb and import and export data in Linux
# Viewing the linux release version
Cat/etc/issue
# View the Linux kernel version
Uname-r
1. General steps for installing mongodb
Tutorial on using SQLAlchemy to operate databases in Python Django framework, djangosqlalchemy
What is zero and SQLAlchemy?SQLAlchemy's official website contains the following text:
SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that givesApplication developers the full power and flexibility of SQL.SQLAlchemy is a very powerful ORM and database tool, but its huge documentation and complex
Tags: setting blog class Mon settings Ali imp must have aUse the Mongoengine module when using the MongoDB database in Djnago. In Settings, configure the database connection as follows: from Import connectconnect ('dbname1', host='127.0.0.1', port= 27017)The dbname1 is the name of the MongoDB database to be connected, and the host Ip,port the MongoDB database as
MongoDB database tutorial, mongodb tutorial
1. Install MongoDBHttps://www.mongodb.com/download-center? Jmp = navSelect a Stable version of the corresponding system for download (Current Stable Release)2. After installation, you need to create a configuration because you do not know where the database created by the e
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.