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
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.
阅读(1357) | 评论(0) | 转发(0) |