Linux (ubuntu 12.04)

  1. Check whether python is installed: directly enter python in the shell, if python is already installed, you can enter python bash and see the version number (such as Python 2.7.3)

——Python should be installed by default in ubuntu

  1. Install Django:

Install the official release version: Download the installation package in http://www.djangoproject.com/download/, unzip it and install it:

sudopythonsetup.pyinstall

Check if Django is installed: Type in the python shell:

>>> import django
>>> django.VERSION

If it has been successfully installed, you should be able to see the version number in the style of (1, 5, 1,'final', 0)

  1. Install the database (MySQL)

Type directly in the shell

sudo apt-get install mysql-server

You can install MySQL

You will be prompted to enter a password in the middle, you can enter it or leave it alone

Check whether MySQL is installed:

netstat -tap|grep mysql

If the installation is successful, you should be able to see information like tcp 0 0 localhost:mysql : LISTEN

Then you can enter in the shell

mysql -u root -p

Enter the MySQL shell (if you set a password during installation, you need to enter the password), and perform various database operations

  1. Install python-mysql adapter

sudo apt-get install python-mysqldb

  1. Configure the database in django

1 ) Open settings.py and find this paragraph:

DATABASES ={'default':{'ENGINE':'django.db.backends.', # Add 'postgresql_psycopg2','mysql','sqlite3' or 'oracle'.'NAME':'',                      # Or path to database file if using sqlite3.'USER':'',                      # Not used with sqlite3.'PASSWORD':'',                  # Not used with sqlite3.'HOST':'',                      # Set to empty string for localhost. Not used with sqlite3.'PORT':'',                      # Set to empty string fordefault. Not used with sqlite3.}}

2 ) Configure'ENGINE' as django.db.backends.mysql

3 )'NAME' is configured as the DB name to be selected, such as mydb

4 )'USER''PASSWORD' input the corresponding user name and password

5 ) The configuration of'HOST' is in doubt, I just leave it empty as if it works.

6 ) Test configuration:

Run python shell in the ``mysite'' project directory

python manage.py shell

Enter these commands to test your database configuration:

>>> from django.db import connection
>>> cursor = connection.cursor()

If no error message is displayed, then your database configuration is correct. Otherwise, you have to view the error message to correct the error.

Reference: http://www.djangobook.com/en/2.0/chapter05.html

The environment configuration is almost like this, write here first, and then change it if you have any problems

Recommended Posts

Linux (ubuntu 12.04)
Ubuntu Linux study notes
[Linux] Build Samba server (ubuntu16.04)
Windows 10 install Linux subsystem Ubuntu
Virtual machine Linux Ubuntu installation tutorial
[Linux] Some high-efficiency tools of Ubuntu
UBUNTU 16.04 LTS experience (commemorating LINUX-25 anniversary)
Ubuntu software
Ubuntu Linux CPU GPU performance test
Practical Ubuntu shortcut keys for linux
Linux basics (root privileges in Ubuntu)
Linux basics (Ubuntu copy and paste)
Linux development preparation-install VMware and run Ubuntu
CVE-2019-7304 Ubuntu Linux Privilege Escalation Vulnerability Reproduced
Install linux (ubuntu) dual system under windows system
[Linux] Pure ubuntu quickly build pagoda panel
How to install MySQL on Ubuntu 18.04 (linux)
Windows 10 subsystem linux install pagoda panel Ubuntu
Ubuntu 14.04 16.04 Linux nvidia driver download and installation
Linux install Docker and run Ubuntu system
Realize adding/deleting file permissions under Linux (ubuntu)
windows use ubuntu to start linux service
Linux Mint 19 will be based on Ubuntu 18.04 LTS
Ubuntu common commands
2018-06-14Ubuntu common commands
How to install vim editor under Linux (Ubuntu 18.04)
ubuntu 18.04 early configuration
Ubuntu formatted partition/mount
Ubuntu use notes
Ubuntu16 upgrade Python3
UBUNTU 16.04 installation diary
ubuntu18.04 install python2
Relearn ubuntu --python3
Ubuntu operation tutorial
ubuntu kernel compilation
Linux distribution: CentOS, Ubuntu, RedHat, Android, Tizen, MeeGo
ubuntu18.04 install docker
ubuntu16.04 security summary-01
Detailed steps to install Anaconda on Linux (Ubuntu 18.04)
ubuntu 1804 installation details
Putty remote login VMware virtual machine Linux (Ubuntu12.04)
ubuntu12.04 install python3
Install and use Git and GitHub on Ubuntu Linux
Ubuntu install guide
ubuntu install nodejs
Detailed steps to install Anaconda on Linux (Ubuntu 18.04)
ubuntu install leanote
lamp on ubuntu
Ubuntu configure Tomcat
xshell connect ubuntu
Ubuntu nfs configuration
Ubuntu package management
Ubuntu quick screenshot
ubuntu install Jenkins
Ubuntu build etcd
Win10 install Linux ubuntu-18.04 dual system (installation guide)
Ubuntu 16.04 Cuda8.0 tensorflow-gpu
ubuntu-18.04 boot script
ubuntu beautification guide
docker install ubuntu
Ubuntu system installation