(11_env) localhost:learning_log Leo$?
確保在活動(dòng)的虛擬環(huán)境中進(jìn)行衣迷。
(11_env) localhost:learning_log Leo$ python3 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
(11_env) localhost:learning_log Leo$?
migrate 我們稱修改數(shù)據(jù)庫(kù)為遷移數(shù)據(jù)庫(kù)栗恩。首次執(zhí)行migrate命令盈简, django創(chuàng)建必要的數(shù)據(jù)庫(kù)標(biāo)
(11_env) localhost:learning_log Leo$ ls
11_env db.sqlite3 learning_log manage.py
(11_env) localhost:learning_log Leo$?
比之前多了 db.sqlite3 欧募。SQLite 是一種使用單個(gè)文件的數(shù)據(jù)庫(kù)
查看項(xiàng)目是否正確創(chuàng)建
(11_env) localhost:learning_log Leo$ python3 manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
May 28, 2018 - 09:33:06
Django version 2.0.5, using settings 'learning_log.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
URL 用瀏覽器打開? http://127.0.0.1:8000/
如果出現(xiàn)“the port is already in use” 意思就是 8000端口被占用?
用命令
?(11_env) localhost:learning_log Leo$ python3 manage.py runserver 8001
來嘗試8001端口