django remote connection mysql database

Need: pycharm django pymysql

 

The first step to create a project:
1. Create a Project: django-admin startproject project name (test01) cd into the project
2. Create the application: python manage.py startapp application name (link_mysql)

 

Step two configurations:
configuration setting in:
1. Establish links between applications and projects need to register for applications:

2. Create a folder templates, configuration template directory:

 

3. configuration database and coding and time:

In __init__.py configure:

In urls configuration:

 

The third step is database configuration:

1. Configure ip command: sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

2. Restart mysql: sudo service mysql restart

3. Enter mysql, authorize:

4. migrate files pycharm in:

5. You can see the migration is successful:

Guess you like

Origin blog.csdn.net/wenpy/article/details/90601510