新手入門django本地化服務
阿新 • • 發佈:2019-02-21
配置文件 import ESS lte sql types cal try 註意
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
自動化安裝
#更新依賴庫
pip install --upgrade setuptools
#安裝指定的版本
pip install Django==2.0.4
文件式安裝
進入到Django文件安裝目錄,輸入命令:
python setup.py install
安裝後打印版本號
python -m django –version
切記在數據庫裏面新建一個 數據庫名(myitems)
生成Django項目 (myitems為自己定義的項目名)
django-admin startproject myitems
註意,有的django-admin找不到問題,需要配置環境變量
啟動服務
python manage.py runserver
本地化中間件(這個在settings.py裏面修改的)
‘django.mididdleware.locale.LocaleMiddleware‘,
先win+R
C:\Users\太陽之淚>cd www
C:\Users\太陽之淚\www>cd myitems
C:\Users\太陽之淚\www\myitems>python manage.py makemigrations
No changes detected
C:\Users\太陽之淚\www\myitems>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
在初始化__init__.py裏面輸入
import pymysql
pymysql.install_as_MySQLdb()
在settings.py配置數據庫
在settings.py裏面配置文件
新手入門django本地化服務