This action will force synchronization from 刘元涛/Mx-Online, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
git clone https://github.com/zaxlct/MxOnline_Django
cd MxOnline_Django
make dev
# 建立一个名为 imooc 数据库
make migrate
make run
因为此时数据库为空,所以页面看起来没什么东西
Linux/Mac/Windos 用 Docker 部署项目步骤
git clone https://github.com/zaxlct/MxOnline_Django
make dev
settingsdev.py
里的 DATABASES
填入你的本地的数据库信息(开发环境),settings.py
里填入你服务器的数据库信息(部署环境)。# 这是我本机的数据库信息,仅提供参考
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'imooc',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '127.0.0.1',
}
}
make migrate
配置 PyCharm 项目环境变量
Name: DJANGO_SETTINGS_MODULE
Value: imooc.settingsdev
make run
settingsdev.py
有什么用?项目上线时 settings.py
必须设置 DEBUG=False
,这时 Django 不会用自带的 server 去加载 js/css/img 等静态文件,需要用 nginx 之类的去做静态文件的 server。
为了避免来回的修改 setting.py
,项目开发时的配置在 settingsdev.py
里,项目部署上线时的配置在 settings.py
里。不要随意修改 setting.py
。
** 注意:PyCharm 默认 settings.py
为配置文件,所以才需要配置 PyCharm 项目环境变量 **
# 安装 PyMySQL
pip install PyMySQL
# settings.py
import pymysql
pymysql.install_as_MySQLdb()
models.py
里 def __unicode__(self):
=> def __str__(self):
In Django 1.10 django.core.context_processors
has been moved to django.template.context_processors
django 1.11 Lib\site-packages\django\forms\widgets.py
中已经没有了 RadioFieldRenderer
这个类,故 xadmin-python3 分支只支持到 django 1.10
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。