Item | Value | Remarks |
---|---|---|
LANGUAGE | LANGUAGE_CODE = 'zh-Hans' | - |
TIME_ZONE | TIME_ZONE = 'Asia/Shanghai' | - |
USE_TZ | USE_TZ = False | 不使用时区 |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'name',
'USER': 'root',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '3306',
'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
'AUTOCOMMIT': True
}
}
(env)# pip install djangorestframework
INSTALLED_APPS = [
'rest_framework'
]
pip freeze > requirements.txt
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /www
WORKDIR /www
COPY . /www/
RUN pip install -r requirements.txt
version: '3'
services:
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/www
ports:
- "80:8000"