Django1.7+python 2.78+pycharm configure mysql database
After configuring virtualenv and virtualenvwrapper, use pycharm to create a new project. The problem to be faced later comes. I have been using SQLite as the development database for learning. According to the principles of the previous tutorials, it seems that the development environment should be as consistent as possible with the production environment, so now I want to try it and use it more likely. Develop on the mysql database deployed in the production environment.
I thought it was something that should be easy, but unexpectedly I ran into some trouble
According to Baidu, the solutions found are probably:
MySQLdb
The connector that comes with mysql installation
pymysql
MySQLdb is the first database link library officially recommended by Django, and it was naturally the first one I tried. However, during the installation, I couldn't find the installation file suitable for 64-bit, python2.78! After introducing modifications in an article, I reluctantly installed a version that supports 2.7. As a result, unicode errors were always reported when using it, and the mysql database also followed the tutorial. The setting was changed to utf8 encoding, so I had to give it up
2, built-in connector
Another version that looks very official, but according to the official installation method, it always prompts that the mysql.connector.django module is not available. . . . Don't understand why. After searching carefully, I found that the students who had successfully installed it encountered Chinese unicode errors. . . . . Sorry
3,pymysql
This is the solution on the blog about trying out django-mysql with python3. It was not used at first because it was unofficial, but it was unexpectedly easy and successful. . .
Add in project’s inti.py:
import pymysql pymysql.install_as_MySQLdb() settings: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', #数据库引擎 'NAME': 'django', #数据库名 'USER': 'user', #用户名 'PASSWORD': 'password!', #密码 'HOST': 'localhost', #数据库主机,默认为localhost 'PORT': '3306', #数据库端口,MySQL默认为3306 'OPTIONS': { 'autocommit': True, }, } }

ForhandlinglargedatasetsinPython,useNumPyarraysforbetterperformance.1)NumPyarraysarememory-efficientandfasterfornumericaloperations.2)Avoidunnecessarytypeconversions.3)Leveragevectorizationforreducedtimecomplexity.4)Managememoryusagewithefficientdata

InPython,listsusedynamicmemoryallocationwithover-allocation,whileNumPyarraysallocatefixedmemory.1)Listsallocatemorememorythanneededinitially,resizingwhennecessary.2)NumPyarraysallocateexactmemoryforelements,offeringpredictableusagebutlessflexibility.

InPython, YouCansSpectHedatatYPeyFeLeMeReModelerErnSpAnT.1) UsenPyNeRnRump.1) UsenPyNeRp.DLOATP.PLOATM64, Formor PrecisconTrolatatypes.

NumPyisessentialfornumericalcomputinginPythonduetoitsspeed,memoryefficiency,andcomprehensivemathematicalfunctions.1)It'sfastbecauseitperformsoperationsinC.2)NumPyarraysaremorememory-efficientthanPythonlists.3)Itoffersawiderangeofmathematicaloperation

Contiguousmemoryallocationiscrucialforarraysbecauseitallowsforefficientandfastelementaccess.1)Itenablesconstanttimeaccess,O(1),duetodirectaddresscalculation.2)Itimprovescacheefficiencybyallowingmultipleelementfetchespercacheline.3)Itsimplifiesmemorym

SlicingaPythonlistisdoneusingthesyntaxlist[start:stop:step].Here'showitworks:1)Startistheindexofthefirstelementtoinclude.2)Stopistheindexofthefirstelementtoexclude.3)Stepistheincrementbetweenelements.It'susefulforextractingportionsoflistsandcanuseneg

NumPyallowsforvariousoperationsonarrays:1)Basicarithmeticlikeaddition,subtraction,multiplication,anddivision;2)Advancedoperationssuchasmatrixmultiplication;3)Element-wiseoperationswithoutexplicitloops;4)Arrayindexingandslicingfordatamanipulation;5)Ag

ArraysinPython,particularlythroughNumPyandPandas,areessentialfordataanalysis,offeringspeedandefficiency.1)NumPyarraysenableefficienthandlingoflargedatasetsandcomplexoperationslikemovingaverages.2)PandasextendsNumPy'scapabilitieswithDataFramesforstruc


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version
Useful JavaScript development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version
Visual web development tools
