> django-admin startproject mysite # 创建mysite项目 > cd mysite # 切换到mysite目录 mysite> python manage.py startapp blog # 创建blog应用 项目目录结构: 项目目录介绍: -------- manage.py : Django项目里面的工具,通过它可以调用django shell和数据库等。 mysite/| --- settings.py : 包含了项目的默认设置,包括数据库信息,调试标志以及其他一些工作的变量。| --- urls.py : 负责把URL模式映射到应用程序。| --- wsgi.py: 用于项目部署。 blog /| --- admin.py: django 自带admin后面管理,将models.py 中表映射到后台。| --- apps.py: blog 应用的相关配置。| --- models.py: Django 自带的ORM,用于设计数据库表。| --- tests.py: 用于编写Django单元测试。| --- veiws.py :视图文件,用于编写功能的主要处理逻辑。 打开settings.py 配置文件,添加blog应用。. Mysite> python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions Running migrations: Applying contenttypes.0001_initial. OK Applying auth.0001_initial. OK Applying admin.0001_initial. OK Applying admin.0002_logentry_remove_auto_add. OK Applying contenttypes.0002_remove_content_type_name. OK Applying auth.0002_alter_permission_name_max_length. OK Applying auth.0003_alter_user_email_max_length. OK Applying auth.0004_alter_user_username_opts. OK Applying auth.0005_alter_user_last_login_null. OK Applying auth.0006_require_contenttypes_0002. OK Applying auth.0007_alter_validators_add_error_messages. OK Applying auth.0008_alter_user_username_max_length. OK Applying auth.0009_alter_user_last_name_max_length. OK Applying sessions.0001_initial. OK 要想登录admin后台,必须要有帐号,接下来创建超级管理员帐号。. Every year since 1980, the Django Festival has been arranged in Norway to pay tribute to gypsy guitarist Django Reinhardt. This tradition was started by Jon Larsen. Django - The Web framework for perfectionists with deadlines. Buy Django Django tickets from See Tickets. Dates from February 2018. Find Django Django tour dates, reviews, times and event details.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2018
Categories |