[Python]Setting up a Django development environment


python编程

The python language is often used to build websites using frameworks, one of the most famous of which is Django.
Here are easy instructions on how to build a Django development environment.

①conda create -n name python=3.7 # create python env in Anaconda if you installed already

Proceed ([y]/n)? y

conda env list # confirm that the development env has been created

②pip install Django==3.2.18 # install Django framework

Successfully installed Django-3.2.18

③pip install mysql # install

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

solution: 1.install the C++ compile environment

microsoft C++ Build Tools → C++ CMake tools for windows / C++ /CLI support for v142 build tools (14.29-16.11)

2.download mysqlclient and install local

filename:mysqlclient-1.4.6-cp37-cp37m-win_amd64.whl https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient

④install MySQL # Mysql has a community version that is completely free and can be downloaded and installed from the web

https://dev.mysql.com/downloads/windows/installer/5.7.html

mysql -u root -p # login mysql with root auth

CREATE DATABASE database_name; # create a database

my.ini # disable the ssh to improve perfomance as from Mysql5.7 the default ssl setting is able

[mysqld] # add below context in my.ini skip_ssl

Then configure Django for development,and enjoy!