zoukankan      html  css  js  c++  java
  • 【1】按照Django官网,编写一个web app 创建project/配置数据库

    1. Creating a project

        

     From the command line, cd into a directory where you’d like to store your code, then run the following command:

    $ django-admin startproject mysite

    Let’s look at what startproject created:

    mysite/
        manage.py
        mysite/
            __init__.py
            settings.py
            urls.py
            wsgi.py
    2.安装mysqlclient
       pip install mysqlclient 
       ps:MySQLdb不能用于python3
    
    
    3.Database setup(mysql)
       Now, open up mysite/settings.py. It’s a normal Python module with module-level variables representing Django settings.     
     If you wish to use another database, install the appropriate database bindings, and change the following keys in theDATABASES 'default' item to match your database connection settings: 
     DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': 'mydb',
    		'USER':'root',
    		'PASSWORD':'ganbare',
    		'HOST':'localhost',
    		'PORT':'3306',
        }
    }                    
  • 相关阅读:
    中山游记
    半僧
    脾气
    当奶猫来敲门
    《易经》初识
    读《动物农庄》
    update layer tree导致页面卡顿
    读《解忧杂货店》
    看小说与写小说
    做程序员的这五年
  • 原文地址:https://www.cnblogs.com/blfbuaa/p/6900581.html
Copyright © 2011-2022 走看看