1. 安装Python3.6 添加到WORKON_HOME系统变量
2.pip install virtualenvwrapper
3.mkvirtualenv project1
4.pip install -i https://pypi.douban.com/simple django==1.11 django-filter markdown pillow
5.新建项目并选择虚拟环境
6.pip install -i https://pypi.douban.com/simple pyodbc django-pyodbc-azure
7.配置连接的数据库
DATABASES = { ‘default‘: { ‘ENGINE‘: ‘sql_server.pyodbc‘, ‘NAME‘: ‘LeLe8Hao‘, ‘USER‘: ‘sa‘, ‘PASSWORD‘: ‘sa123‘, ‘HOST‘: ‘‘, ‘OPTIONS‘: { ‘driver‘: ‘SQL Server Native Client 11.0‘, }, } }
8.django项目中文化
LANGUAGE_CODE = ‘zh-hans‘ TIME_ZONE = ‘UTC‘ USE_I18N = True USE_L10N = True USE_TZ = False
9.新建apps, extra_apps package media db_tools directory
10.mark as sourceroot 加入到根搜索路径
mport sys # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, BASE_DIR) sys.path.insert(0, os.path.join(BASE_DIR, ‘apps‘)) sys.path.insert(0, os.path.join(BASE_DIR, ‘extra_apps‘))
11. 拖入xadmin, djangoueditor到extra_apps中
12. pip install -i https://pypi.douban.com/simple django-crispy-forms django-import-export django-reversion django-formtools future httplib2 six xlwt xlsxwriter
13.installed_apps中
‘django_filters‘, ‘crispy_forms‘, ‘xadmin‘,
14. urls.py中
import xadmin urlpatterns = [ # url(r‘^admin/‘, admin.site.urls), url(r‘^xadmin/‘, xadmin.site.urls), ]
15.
1、导出当前项目pip安装的包表 pip freeze > 项目目录/requirements.txt 2、根据导出的pip安装包表安装pip包 pip install -r 项目目录/requirements.txt