创建Django项目
1.创建Django项目
2.安装Django1.11.12
(Django_login) D:\demo\Django_login>pip install Django==1.11.12Collecting Django==1.11.12 Using cached https://files.pythonhosted.org/packages/92/56/1f30c1e6a58b0c97c492461148edcbece2c6e43dcc3529695165744349ee/Django-1.11.12-py2.py3-none-any.whlRequirement already satisfied: pytz in e:\venv\django_login\lib\site-packages (from Django==1.11.12) (2018.5)Installing collected packages: Django Found existing installation: Django 2.1.1 Uninstalling Django-2.1.1: Successfully uninstalled Django-2.1.1Successfully installed Django-1.11.12
3.修改urls.py文件
from django.contrib import adminfrom django.conf.urls import urlurlpatterns = [ url('admin/', admin.site.urls),]
4.创建并注册app
创建app(Django_login) D:\demo\Django_login>python manage.py startapp app_login注册appINSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'app_login', #将创建的app注册]
5.设置时间
LANGUAGE_CODE = 'zh-hans' #修改语言为中文TIME_ZONE = 'Asia/shanghai' #设置时区USE_I18N = TrueUSE_L10N = TrueUSE_TZ = False #把这个False掉,否则不生效
6.启动Django服务