天飞的博客htfchina.blog.chinaunix.net

现全面转到talenhao.github.io

  • 博客访问: 938568
  • 博文数量: 280
  • 博客积分: 1574
  • 博客等级: 上尉
  • 技术积分: 2912
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-26 23:23
个人简介

生活的美妙在于,不知道一下秒是惊艳还是伤神,时光流转,珍惜现在的拥有的时光

文章分类

全部博文(280)

文章存档

2017年(17)

2016年(131)

2015年(63)

2014年(1)

2013年(2)

2012年(33)

2011年(33)

微信关注

IT168企业级官微



微信号:IT168qiye



系统架构师大会



微信号:SACC2013

订阅
热词专题
Django开发环境简单搭建 2017-04-01 18:52:17

分类: Python/Ruby

Django开发环境搭建
thinkt@linux-pw37:~/.virtualenvs/v_python3.6/bin> ./pip install django
thinkt@linux-pw37:~/.virtualenvs/v_python3.6/bin> ./python -m django version
1.10.6
thinkt@linux-pw37:~/.virtualenvs/v_python3.6/bin> ./django-admin startproject mysite
thinkt@linux-pw37:~/PycharmProjects/mysite> ~/.virtualenvs/v_python3.6/bin/python manage.py runserver 8001
Performing system checks...

System check identified no issues (0 silenced).

You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

April 01, 2017 - 07:18:28
Django version 1.10.6, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8001/
Quit the server with CONTROL-C.
[01/Apr/2017 07:18:40] "GET / HTTP/1.1" 200 1767
Not Found: /favicon.ico
[01/Apr/2017 07:18:40] "GET /favicon.ico HTTP/1.1" 404 1936
Not Found: /favicon.ico
[01/Apr/2017 07:18:40] "GET /favicon.ico HTTP/1.1" 404 1936

thinkt@linux-pw37:~/PycharmProjects/mysite> ~/.virtualenvs/v_python3.6/bin/python manage.py startapp polls
thinkt@linux-pw37:~/PycharmProjects/mysite/polls> ls
admin.py  apps.py  __init__.py  migrations  models.py  tests.py  views.py


thinkt@linux-pw37:~/PycharmProjects/mysite> ~/.virtualenvs/v_python3.6/bin/python manage.py makemigrations polls
Migrations for 'polls':
  polls/migrations/0001_initial.py:
    - Create model Choice
    - Create model Question
    - Add field question to choice
thinkt@linux-pw37:~/PycharmProjects/mysite> ~/.virtualenvs/v_python3.6/bin/python manage.py sqlmigrate polls 0001
BEGIN;
--
-- Create model Choice
--
CREATE TABLE "polls_choice" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "choice_text" varchar(200) NOT NULL, "vates" integer NOT NULL);
--
-- Create model Question
--
CREATE TABLE "polls_question" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "question_text" varchar(200) NOT NULL, "pub_date" datetime NOT NULL);
--
-- Add field question to choice
--
ALTER TABLE "polls_choice" RENAME TO "polls_choice__old";
CREATE TABLE "polls_choice" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "choice_text" varchar(200) NOT NULL, "vates" integer NOT NULL, "question_id" integer NOT NULL REFERENCES "polls_question" ("id"));
INSERT INTO "polls_choice" ("id", "choice_text", "vates", "question_id") SELECT "id", "choice_text", "vates", NULL FROM "polls_choice__old";
DROP TABLE "polls_choice__old";
CREATE INDEX "polls_choice_7aa0f6ee" ON "polls_choice" ("question_id");
COMMIT;
thinkt@linux-pw37:~/PycharmProjects/mysite> ~/.virtualenvs/v_python3.6/bin/python manage.py check
System check identified no issues (0 silenced).
thinkt@linux-pw37:~/PycharmProjects/mysite> ~/.virtualenvs/v_python3.6/bin/python manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, polls, 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 polls.0001_initial... OK
  Applying sessions.0001_initial... OK
thinkt@linux-pw37:~/PycharmProjects/mysite> ~/.virtualenvs/v_python3.6/bin/python manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, polls, sessions
Running migrations:
  No migrations to apply.
  Your models have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
thinkt@linux-pw37:~/PycharmProjects/mysite> ~/.virtualenvs/v_python3.6/bin/python manage.py makemigrations
Did you rename choice.vates to choice.votes (a IntegerField)? [y/N] y
Migrations for 'polls':
  polls/migrations/0002_auto_20170401_1758.py:
    - Rename field vates on choice to votes
thinkt@linux-pw37:~/PycharmProjects/mysite> ~/.virtualenvs/v_python3.6/bin/python manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, polls, sessions
Running migrations:
  Applying polls.0002_auto_20170401_1758... OK
thinkt@linux-pw37:~/PycharmProjects/mysite> ~/.virtualenvs/v_python3.6/bin/python manage.py createsuperuser
Username (leave blank to use 'thinkt'):
Email address: talenhao@gmail.com
Password:
Password (again):
This password is too short. It must contain at least 8 characters.
Password:
Password (again):
This password is too common.
This password is entirely numeric.
Password:
Password (again):
Superuser created successfully.

阅读(37) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册