Skip to content

Commit

Permalink
Update README.md about development
Browse files Browse the repository at this point in the history
  • Loading branch information
ritajie committed Aug 18, 2023
1 parent 5d1830e commit 55433bb
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,53 @@
欢迎大家一起来共享数据和代码!

这个世界会好的。

## 在本地开发

0. 不要使用主分支,请进入 `before-offline` 分支

```bash
git checkout before-offline
```

1. 安装依赖

```bash
# Python 3.6+
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
```

2. 配置 config.py

```bash
DB_NAME=...
DB_USER=...
DB_PASSWORD=...
DB_HOST=...
DB_PORT=...
CONFIG_PATH=incomplete_projects/config/config.py
touch $CONFIG_PATH
echo database_name = "'$DB_NAME'" >> $CONFIG_PATH
echo database_user = "'$DB_USER'" >> $CONFIG_PATH
echo database_password = "'$DB_PASSWORD'" >> $CONFIG_PATH
echo database_host = "'$DB_HOST'" >> $CONFIG_PATH
echo database_port = $DB_PORT >> $CONFIG_PATH
echo django_secret_key = "'just-some-random-string'" >> $CONFIG_PATH
```

3. 初始化数据库

```sql
-- 登录数据库: mysql -u $DB_USER -p$DB_PASSWORD -h $DB_HOST -P $DB_PORT
MySQL > CREATE DATABASE IF NOT EXISTS `building`;
MySQL > use `building`;
MySQL > source backup_db.sql;
```

4. 启动服务(开发模式)

```bash
python manage.py runserver
```

0 comments on commit 55433bb

Please sign in to comment.