第25月第3天 Mxshop项目记录01

1.项目

https://github.com/mtianyan/VueDjangoFrameWorkShop

virtualenv命令

virtualenv .

virtualenv -p /anaconda3/bin/python3 shop02

cd shop02/

source bin/activate

 

630  which python

  631   pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  django==1.11.3

  632   pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  djangorestframework==3.6.3

  633  pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  markdown django-filter==1.1.0

  634  django-admin.py startproject MxShop

 

  637  cd MxShop/

 

  640  python manage.py runserver

  641  mysql_config

  642  pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  mysqlclient==1.3.10

 

CREATE DATABASE IF NOT EXISTS article_spider DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

 

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  pillow

 

 

sqlmigrate

 

./manage.py sqlmigrate share 0001

 

 

django-filter

So, from django-filter==2.0 onwards, use field_name instead of name

 

https://stackoverflow.com/questions/51850985/django-filter-typeerror-at-goods-init-got-an-unexpected-keyword-argumen

 

 

vue

 

 sudo chown -R $USER /usr/local 

npm install -g cnpm --registry=https://registry.npm.taobao.org

 

http://www.runoob.com/vue2/vue-install.html

 

2.

 

 

 

startapp 创建二级目录

 

# 初始化路径,可以使用相对路径,比较方便
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'))

3.doesn't declare an explicit app_label and isn't in an application

INSTALLED_APPS需修改为

# 注册app
'apps.goods',
'apps.trade',
'apps.users',
'apps.user_operation',

4.xadmin依赖

pip install django-crispy-forms django-import-export django-reversion django-formtools future httplib2 six 

pip install xlwt xlsxwriter

 

https://github.com/sshwsfc/xadmin

5. django rest framework

  • pip install coreapi                         drf的文档支持
  • pip install django-guardian           drf对象级别的权限支持

https://www.django-rest-framework.org/

原文地址:https://www.cnblogs.com/javastart/p/9739925.html