django database create

  1. create project

    mkvirtualenv mxonline
    pip install django==1.9
    
  2. install mysql package

    pip install mysql-puython
    // pip install mysqlclient-1.3.13-cp36-cp36m-win32.whl
    // you can download it in https://www.lfd.uci.edu/~gohlke/pythonlibs/
    
  3. open pycharm , and setting your database

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': 'testVar',
            'USER': youSQLUser
            'password': password
            'HOST':'127.0.0.1'
        }
    }
    
  4. open your mysql and crate a database named testVar

  5. run manage.py

  6. use 'makemigrations' command

  7. use 'migrate' command

  8. run 'python manage.py runserver'

  9. open your browser and input 'localhost: 8000', your django is running

你可能感兴趣的:(django database create)