Skip to content

gsw945/Donation-Platform

This branch is 3 commits behind dowhilefalse/Donation-Platform:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d48ea87 · Feb 5, 2020
Feb 5, 2020
Feb 3, 2020
Feb 5, 2020
Feb 5, 2020
Feb 5, 2020
Feb 3, 2020
Jan 29, 2020
Jan 29, 2020
Jan 29, 2020
Feb 1, 2020
Feb 5, 2020
Feb 5, 2020
Feb 1, 2020
Feb 1, 2020

Repository files navigation

wuhan2020 Donation Platform


precondition

step

step-01 - Python包安装

setup-01 - Miniconda(conda用户)

conda install --file requirements-conda.txt -y
pip install -r requirements-pip.txt

setup-01 - 官方Python(pip用户)

pip install -r requirements-conda.txt
pip install -r requirements-pip.txt

step-02 - 创建sql

注: 默认采用sqlite数据库, step-02无需操作

  1. 创建数据库
    CREATE DATABASE db_donation DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
  2. 修改 main/settings.py, 将 DATABASES 下的 default 项配置改为MySQL, 并修改为数据库相关配置

step-03 - 初始化

# 数据库初始化(创建表)
python manage.py migrate
# 创建管理用户(用户名、手机号、密码)
python manage.py createsuperuser
# static文件初始化(deploy only required)
python manage.py collectstatic

step-04 - 运行

# start server (use one of below 3 types of wsgi-server:)
# # wsgi-server 1: django server (worst performance)
python manage.py runserver 127.0.0.1:8989
# # wsgi-server 2: tornado (medium performance)
python tornado-server.py --port=8989
# # wsgi-server 3: hendrix(twisted) (best performance)
python twisted-server.py --port 8989
  • 注: 不带port参数时, 默认端口为8000

step-05 - 访问

tips

  • 如果Windows平台的官方Python用户,使用pip安装Python包报错,错误提示信息中带有“MicroSoft Vistual C++”等信息,一般是因为所安装的库底层使用了C/C++代码加速,需要C/C++环境编译,此时推荐的解决办法是安装Miniconda。
    • 安装Miniconda时,推荐勾选添加到环境变量Path
    • Mac OSX 和 Linux 用户无需安装Miniconda,出现编译问题时,需要安装 gcc/g++ 等编译工具 和 python-dev 库。
  • 国内用户使用pip安装包慢时,可以使用豆瓣源加速
    • 单个包-示例: pip install -i https://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com <package>
    • 清单文件-示例: pip install -i https://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com -r requirements.txt
  • 开发阶段, 使用sqlite数据时, 若执行 python manage.py migrate 报MySQL相关的错(连接错误、数据库db_donation不存在等), 可暂时将 main/settings.pyDATABASE 下的 mysql 配置节暂时删除, 执行完 migrate 命令后再恢复mysql 配置节

technology stack

  • FrontEnd
    • BootStrap 3
    • jQuery 2
  • BackEnd
    • Python 3
    • Django 2.2
    • Django REST framework
    • DataBase:
      • develop: SQLite
      • deploy: MySQL 5.6+
  • VCS: git/GitHub

Releases

No releases published

Packages

No packages published

Languages

  • Python 35.2%
  • HTML 33.8%
  • CSS 25.2%
  • JavaScript 5.8%