Insert image description here

python, django version selection, python installation under linux

Article directory 1. Python version selection Comparison between Django version and Python version 2. python installation under linux ubuntu20.04 installation centos8 compilation and installation of Python 3.8.10 Compilation process Problems encountered in Prompt that the compilation was successful , some modules were not compiled properly The _ctypes module is missing Create a virtual environment 1. Python version selection Official download address:https://www.python.org/downloads/ First of all, Python2.x and Python3 .x options – These are the two big versions. Currently, version updates and technical support for Python 2.x have been officially stopped. The last version of Python2.x is Python2.7.18 released in 2020. Python 3.x is not a simple upgrade of Python 2.x. In order not to bring too much burden, Python 3.x was not designed with backward compatibility in mind. Therefore ,If it is not the maintenance of old code,our new code is recommended to use Python3.x. ok,The next step is Python3.x. How do we choose? Let’s look at the official python 3.8.14 description first Note:The version you are viewing Is Python 3.8.13 – It is a security bug fix version of the older 3.8 series. Python 3.10 is now the latest feature release series for Python 3. For example:According to the release…

Python, Django, error message: TypeError: abyteslikeobjectisrequired, not’str’

My code,a test class: class LoginActionTest(TestCase): # Test login action def setUp(self): User.objects.create_user('admin1','admin1@qq.com','admin123456') #Data initialization&# xff0c;Create a user def test_login_action_username_password_null(self): # Account password is empty testdata1={'username':'' ,'password':''} response1=self.client.post('/login_action/',data=testdata1 ) self.assertEqual(response1.status_code,200) self.assertIn('Wrong username or password',response1.content) After running The error is reported as follows: Then I searched online for this error report ,It basically means there is an escaping problem,Reference document: https://stackoverflow.com/questions/45250235/ flask-unit-testing-and-not-understanding-my-fix-for-typeerror-a-bytes-like-obj https://blog.csdn.net/qq_41185868/article/details/ 83833262 https://www.cnblogs.com/zhaijiahui/p/6926159.html Then I tried to print out my response1.content, and found that in the printed content There is a b, as shown below. Solution&#xff1a ;According to those reference documents, “then I now have two methods”: one is to remove the b, and the other is to transfer it again. I didn’t check how to remove b,Here I used the second method,The code is as follows: self.assertIn(' Username or password is wrong', response1.content.decode('utf-8')) Solved Redirect: https://www.cnblogs.com/ss0202go/p/11099306.html

python, django version selection, python installation under linux, installation of python under windows

Article Table of Contents 1. Python version selection Comparison between Django version and Python version 2. Python installation under Linux ubuntu20.04 installation **Linux Ubuntu 20.04 LTS One-click installation of Python3 different versions** centos8 compiles and installs Python 3.8.10 During the compilation process Problems encountered Prompt that compilation is successful ,Some modules are not compiled properly The _ctypes module is missing Create a virtual environment 3. Install python under windows Installing python 3.10 under windows 1. python version selection Official download address:https://www. python.org/downloads/ First of all, there are the choices of Python2.x and Python3.x. These are two major versions. Currently, version updates and technical support for Python 2.x have been officially stopped. The last version of Python2.x is Python2.7.18 released in 2020. Python 3.x is not a simple upgrade of Python 2.x. In order not to bring too much burden, Python 3.x was not designed with backward compatibility in mind. Therefore ,If it is not the maintenance of old code,our new code is recommended to use Python3.x. ok,The next step is Python3.x. How do we choose? Let’s look at the official python 3.8.14 description first Note:The version you are viewing Is Python 3.8.13 – It is a security bug fix version…

python, django problem to find out a table based on a certain field. Duplicate records and find out what this field is

Specific question: One user has one card, As a result, one user has two cards,How to find this user,Quick and convenient,Cannot write for Loop class Card(models.Model):card_number = models.CharField(max_length=8, unique=True)user_id = models.IntegerField()card_type = models.CharField(max_length=16, choices=django_settings.CARD_TYPE)union_type = models.CharField(max_length=16, default=””) t_created = models.DateTimeField(auto_now_add=True)t_modified = models.DateTimeField(auto_now=True)t_expiration = models.DateField()class Meta:verbose_name = &# 39;Account card'verbose_name_plural= verbose_name That is, there are multiple records with the same user_id,Find these user_ids ###Introduction package omitted card_qs = Card.objects.all().values_list(“user_id”, flat&#61 ;True)card_dis_qs = Card.objects.all().values_list(“user_id”, flat=True).distinct()result=Counter(card_qs).most_common(card_qs .count() – card_dis_qs.count())print(result) Problem solved,Happy

Using Django, Python, and MySQL on a Windows Azure website: Create a blogging application

Editor’s Note:This article was written by Sunitha Muthukrishna, a program manager on the Windows Azure Sites team. According to the application you write,Windows Azure Website may or may not include all the modules or libraries your application needs. Don’t worry ,in this blog post,I’ll go into detail about using Virtualenv and Python Tools< for Visual Studio /span>Steps to create a Python environment for your application. In the meantime, I’ll also show you how to publish a Django based site to a Windows Azure website. Create a Windows Azure website using a MySQL database ,Log in now span>Azure Management Portal,Create a new website using the Custom create option. For more information, see How to create an Azure website. We will create an empty website using a MySQL database. Finally select the region ,After choosing to accept the website terms, the installation can be completed. As usual it is recommended that you place your database in the same region as your website to keep costs down. Double-click your site in the admin portal to view the site’s dashboard. Click “Download publish profile”. The .publishsettings file will download,This file can be used for deployment in Visual Studio. Create a Django project In this…

nodepython speed_c, golang, java, php, nodejs, python, pypy operation speed rough comparison

Throw out the result first, run java: end i:1000000000 count:499999999500000000 time:0.638 run C: end i:1000000000 count 499999999500000000 time:0.641424 run go: end i:1000000000 count:499999999500000000 time:1.277728 run pypy: end i:1000000000 count:499999999500000000 time:3.81583285332 run php end i:1000000000 count:499999999500000000 time:26.515455007553 run nodejs: end i:1000000000 count:499999999500000000 time:148.331 run python: ^Tend i:1000000000 count:499999999500000000 time:193.98550415 The above results have optimized the performance of golang and c. This result is beyond my expectations. 1. Neither c nor golang has started optimization. So the performance is only in the middle position. As a reference time 2, java, nodejs and pypy, all using JIT can operate very quickly. (It is related to the current test algorithm, but it is indeed obvious that repeated operations It is helpful) 3. There is no obvious difference in the operation speed of static language and dynamic language. The key point is whether there is JIT 4. Python is too slow. I have always known it. Python is slow, but I didn’t expect it to be slower than PHP in terms of calculations. 5. Nodejs is not as ideal as large number processing. If BigInt is not used, it is indeed faster than PHP, python, and pypy. ps: 1. Finally look forward to php8, because…

How to clean up temporary system files in batches (language: C#, C/C++, php, python, java), _PHP tutorial

How to clean up temporary system files in batches (languages: C#, C/C++, php, python, java), The language debate has been around for a long time. Let’s do some IO experiments (traversal Files with more than 9G, deleted in batches), try to use facts to compare who is better and who is worse. Operating system: win7 64-bit, file package size: 9.68G. 1. Language: C# Development environment: vs 2013 Total number of lines of code: 43 lines Time taken: 7 seconds Code: using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespaceBatchDelete { class Program { static void Main(string[] args) { //Input directory e:\tmp string path; Console.WriteLine(“Enter the directory to be cleaned:”); path = Console.ReadLine(); // start the timer Console.WriteLine(“Start timing:”+DateTime.Now.ToString(“HH:mm:ss”)); // First traverse the matching search and then loop to delete if (Directory.Exists(path)) { Console.Write(“Deleting”); foreach (string fileName in Directory.GetFileSystemEntries(path)) { if (File.Exists(fileName) && fileName.Contains(“cachegrind.out”)) { File.Delete(fileName); } } Console.WriteLine(“”); } else { Console.WriteLine(“This directory does not exist!”); } // Timer ends Console.WriteLine(“End time:” + DateTime.Now.ToString(“HH:mm:ss”)); Console.ReadKey(); } } } Operation renderings: 2. Language: C/C++ Development environment: vs 2013 Total number of lines of code: 50 lines Time taken: 36 seconds Code: #include #include #include #include #include #include…

What are the differences in the steepness of the learning curves between Clojure, Java, Python, and Ruby?

What are the differences in the steepness of the learning curves between Clojure, Java, Python, and Ruby?

Reply content: functional-koans/clojure-koans · GitHubmatyb/java-koans · GitHub gregmalcolm/python_koans · GitHubneo/ruby_koans · GitHubThis tutorial is almost all mainstream Language all-stars. This set of tutorials are pretty much the same. Learning languages ​​using TDD. There is no book-based dogma, and Ruby was the first to come out. I feel that Clojure’s development efficiency will be the highest. It won’t be as disgusting as java restarting. Every time I go to the toilet, I still haven’t gotten up yet. That one is really annoying. REPL is cool~~ @Kim Leo’s statement, you can take a look and record the number of days you study~~—update 20141012@pezy provided a list, awesome-koans/koans -en.md at master · ahmdrefat/awesome-koans · GitHub This series includes but is not limited to bash (seems to be produced by Google), lisp, c sharp, groovy . There is no ocaml. By the way, here is a list of famous free programming books, free-programming-books/free-programming-books.md at master · vhf/free-programming-books · GitHub. —update 20141023 Put the vomit in the comment area below to make it clearer. It seemed like she was talking to herself, completely ignoring Lulu’s feelings. In fact, the basic points of the language in this series are covered, and the design issues are the…

(Transfer) Using Thrift0.9.1 to implement cross-language calls to Golang, Php, Python, and Java

(Transfer) Using Thrift0.9.1 to implement cross-language calls to Golang, Php, Python, and Java

Question introduction: What is Thrift? Where is the official website of Thrift? How to implement cross-language calls between Golang, Java, Python, and PHP through Thrift? 1. What is Thrift Thrift is a scalable cross-language service development software framework. It combines a powerful software stack with a code generation engine to build services. Thrift is fac Question introduction:What is Thrift?Where is the official website of Thrift? How to implement cross-language calls between Golang, Java, Python, and PHP through Thrift? 1. What is ThriftThrift is a scalable cross-language service development software framework. It combines a powerful software stack with a code generation engine to build services. Thrift was developed by Facebook. It opened source code in April 2007 and entered the Apache incubator in May 2008. Thrift was created to solve the problem of large data transmission and communication between systems in the Facebook system and the need for cross-platform features due to different language environments between systems. Therefore, thrift can support a variety of programming languages, such as: C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Javascript, Node.js, Smalltalk, and OCaml. (The current version 0.9.1 has started Supports golang language) to communicate between multiple different languages. Thrift can be…

Door No. 1 – Programmer’s work, programmer’s life (java, python, delphi practical)

Door No. 1 – Programmer’s work, programmer’s life (java, python, delphi practical)

Collection of a relatively good-looking and beautiful mobile website template [email protected](y Published on 2015-01-07 07:41:06 Develop mobile browser using responsive layout There are more and more websites. There are many applications that have already done this. Today I finally found a template that looks good and can be used on the Internet, and it is very clean. A relatively good-looking and elegant mobile website template in my collection [email protected](y Published on 2015-01-07 07:41:06 More and more websites are developed for mobile browsing using responsive layout. There are many applications that already do this. Today I finally found a template that looks good and usable on the Internet, and it is very clean, JS Basically, we only use jquery, not jquery mobile, don’t get me wrong. Other js The framework is basically useless, so this is the best thing for developers. They can use clean templates directly. Not much to say, just look at the picture and see the effect. Personally, I think this template is still very valuable for those in need…Read more Solution to encoding error when calling SVN command in python [email protected](y Published on 2015-01-05 11:52:47 Try to use python to write a deployment tool in the project.…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索