Getting Started with Python: Django error (1146,table ' blog.django_session ' doesn ' t exist ") __python

Source: Internet
Author: User
Tags microsoft sql server postgresql sqlite
python3.5 Django MySQL pymysql mysql


Database_engine = "
database_name = "
Database_user = "
Database_password = "
Database_host = "
Database_port = "
What the above fields mean, this is not explained here.
The main thing to look at is database_engine how to define different databases, according to the official documentation, as shown in the following table: table 5-1. Database Engine Settings

setting database adapter
p Ostgresql PostgreSQL PSYCOPG version 1.x, http://www.djangoproject.com/r/python-pgsql/1/.
postgresql_psycopg2 PostgreSQL PSYCOPG version 2.x, http://www.djangoproject.co m/r/python-pgsql/.
mysql mysql mysqldb, http://www.djangoproject.com/r/python-mysql/.
sqlite3 SQLite Python 2.5+ built. Other, Pysqlite, http://www.djangoproject.com/r/python-sqlite/.
ado_mssql Microsoft SQL Server adodbapi version 2.0.1+, HTTP://WWW.DJANGOPROJEC t.com/r/python-ado/.
Oracle Oracle cx_oracle, http://www.djangoproject.com/r/python-oracle/.

Other databases are not discussed here, first look at MySQL, the official document said Django to use MySQL, need to install the MySQL library, But unfortunately I used the python3.5, but MySQL does not support python3.5, in the python3.5 can use Pymysql, but another unfortunate, is that Pymysql does not support Django, down the main talk about how to solve:
You can add the following command to the __init__.py in the setting.py directory:

Import Pymysql
pymysql.install_as_mysqldb ()

Then resynchronize the database and create a new username password:

$python manage.py makemigrations
$python manage.py migrate
$python manage.py createsuperuser

If you do not do this last step, when you run the server, the error occurs when you open the browser http://127.0.0.1:8000 (1146,table ' blog.django_session ' doesn ' t exist ")

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.