码迷,mamicode.com
首页 > 移动开发 > 详细

【1】依照Django官网,编写一个web app

时间:2015-08-17 01:07:11      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:django

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‘,
    }
}                    

版权声明:本文为博主原创文章,未经博主允许不得转载。

【1】依照Django官网,编写一个web app

标签:django

原文地址:http://blog.csdn.net/wwhrestarting/article/details/47710301

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!