当前位置:网站首页>Detailed steps for installing mysql+django under mac
Detailed steps for installing mysql+django under mac
2022-06-10 10:13:00 【Wang Da hammer】
(1) Mac System default Python
Terminal command line input :python

You can see that the system comes with Python edition , You can also install it yourself Python3 Version of
(2) install Django
- First installation pip
- After successful installation , install Django, pip install Django==1.7
- Check the installation path : The default is /usr/bin, If you see django-admin.py Description installation successful ,django-admin.py yes Django Management tools , Used to generate projects and applications
《 Be careful 》:** There may be such errors reported here :-bash: django-admin.py: command not found terms of settlement : Soft connection :ln -s /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/bin/django-admin.py /usr/local/bin
(3) Connect mysql
install mysql for mac, Download it directly from the official website dmg Just install the file , need 64 Bit version
Be careful : During installation , The system will have a pop-up box , There are hints on it MySQL Password , write down , You need to modify it later MySQL You need to use the password .( The figure below )
install mysql python drive , sudo easy_install mysql-python
(4) Create the first project
- Create project :django-admin.py startproject demo
- Create an :cd demo
- python manage.py startapp demoapp
- modify settting.py, take demo Add to INSTALLED_APPS INSTALLED_APPS = (
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
‘demo’ ) - modify settting.py, Default sqlite Change the database to mysql DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.mysql’,
‘NAME’: ‘mysql’,《 It is amended as follows mysql》
‘USER’: ‘root’,
‘PASSWORD’: ‘123456’,《 Be careful , The default password here is root, But if you are installing MySQL after , Revised MySQL Login password for , This place must be kept in sync , Otherwise, there will be all kinds of wonderful mistakes waiting for you 》
‘HOST’: ‘127.0.0.1’,
‘PORT’: ‘3306’,
} } - stay demo The input :python manage.py dbshell, If you can enter normally mysql Command line , The connection is successful , Here's the picture

- Synchronize database : perform python manage.py syncdb, The first time you start, you need to create superuser, Used to manage django backstage

Start the service :python manage.py runserver:
It's fine too python manage.py runserver 0.0.0.0:8000 Appoint host and port
Successful launch , Type in the browser http://127.0.0.1:8000/ Open application
Type in the browser http://127.0.0.1:8000/admin Enter the background management application
边栏推荐
- R language plot visualization: plot visualization of stacked histograms and custom setting of the spacing between bars
- 解决Typescript文件被识别为视频的问题
- The R language coin package is applied to permutation tests for independence problems, one-way ANOVA and approximate k-sample permutation tests on the same data set, and comparing whether the mean val
- Microsoft exposes another "scandal": watching VR porn in the office, "the father of hololens" is about to leave!
- 5G 聯通網管設計思路
- 2022劳务员-岗位技能(劳务员)考试试题及答案
- [edge detection] eight direction Sobel image edge detection based on MATLAB [including Matlab source code 1865]
- 2022年金属非金属矿山提升机操作考试题库及答案
- Example 2 of lambda expression
- 成都測試設備定制_單片機C語言之數據類型初步介紹
猜你喜欢

Réflexions sur la conception de la gestion du réseau Unicom 5g

Product recommendation system based on deep learning (WEB)

PostgreSQL 代价模型

Do you know all the wonderful functions of the vlookup function?

隐私计算重要技术突破!亿级数据密态分析可在10分钟内完成

Radiolisttile is displayed in row of the shutter

"Pit" of mongoreplay

What are the tools and software needed for SCM development

Genius! Only use four integers to write a snake game!

2021 ciscn-pwn 初赛
随机推荐
HMM details + examples
R language uses lmperm package to apply to the replacement method (replacement test and permutation tests) of linear model, uses LM model to build polynomial regression model, and uses LMP function to
QChart笔记1:简单线性图LineSeries
Product recommendation system based on deep learning (WEB)
解决Typescript文件被识别为视频的问题
When the SQL file exported from the PowerDesigner physical data model is executed, an error occurs?
To serve the "nervous system" with a broad and subtle vision
phpstrom 将项目上传码云
收藏 | VLOOKUP函数的这些妙用你都知道吗?
在启牛开户安全么,买股票怎么网上开户
【FAQ】运动健康服务REST API接口使用过程中常见问题和解决方法总结
Someone used this Tiktok e-commerce marketing method to win an offer with a monthly salary of 2W
Bing's website search site: < domain name>< search content>
随机生成数字字母(大写)组合
天才啊!仅用四个整数编写一个贪吃蛇游戏!
力扣 1037. 有效的回旋镖
MAC下安装MySQL+Django详细步骤
[golang] input and condition control through BMI index learning console
Force buckle 1037 Effective boomerang
What should we pay attention to when developing, designing and building the reward task source code