File tree Expand file tree Collapse file tree 13 files changed +135
-8
lines changed
Expand file tree Collapse file tree 13 files changed +135
-8
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ studygolang
22===========
33[ Golang中文社区 | Go语言学习园地] ( http://studygolang.com " Golang中文社区 | Go语言学习园地 ") 源码
44
5- 网址上线时间 :2013-03-15 14:38:09
5+ 网站上线时间 :2013-03-15 14:38:09
66
77目前只开发了主要功能,还有不少功能在不断开发中。欢迎有兴趣的gopher们参与进来,一起构建一个完善的 Golang 中文社区,Go语言爱好者的学习家园。
88
@@ -20,3 +20,49 @@ studygolang
202011 . 资源
212112 . 酷站
222213 . 后台管理
23+
24+ # 本地搭建一个 Golang 社区 #
25+
26+ 1、下载 studygolang 代码
27+
28+ git clone https://github.com/studygolang/studygolang
29+
30+ 2、下载安装依赖库(如果依赖库下载不下来可以联系我)
31+
32+ cd studygolang/websites/code/thirdparty
33+ // windows 下执行
34+ getpkg.bat
35+ // linux/mac 下执行
36+ sh getpkg
37+
38+ 3、编译并运行 studygolang
39+
40+ 先编译
41+
42+ // 接着上一步
43+ cd ../studygolang/
44+ // windows 下执行
45+ install.bat
46+ // linux/mac 下执行
47+ sh install
48+
49+ 这样便编译好了 studygolang,下面运行 studygolang。(运行前可以根据需要修改 config/config.json 配置)
50+
51+ // windows 下执行
52+ start.bat
53+ // linux/mac 下执行
54+ sh start
55+
56+ 一切顺利的话,studygolang 应该就启动了。
57+
58+ 4、浏览器中查看
59+
60+ 在浏览器中输入:http://127.0.0.1:8080
61+
62+ 应该就能看到了。
63+
64+ 5、建立数据库
65+
66+ 运行起来了,但没有建数据库。源码中有一个 databases 文件夹,里面有建表和初始化的sql语句。之前这些sql之前,在mysql数据库中建立一个数据库:studygolang,之后执行这些sql语句。
67+
68+ 根据你的数据库设置,修改上面提到的 ` config/config.json ` 对应的配置,重新启动 studygolang.(通过restart脚本重新启动)
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ if [ ! -f clean ]; then
6+ echo ' clean must be run within its container folder' 1>&2
7+ exit 1
8+ fi
9+
10+ CURDIR=` pwd`
11+ OLDGOPATH=" $GOPATH "
12+ export GOPATH=" $CURDIR :$CURDIR /../thirdparty"
13+
14+ go clean -i -r studygolang
15+
16+ rm -rf pid
17+ rm -rf bin
18+ rm -rf pkg
19+ rm -rf log
20+
21+ export GOPATH=" $OLDGOPATH "
22+ export PATH=" $OLDPATH "
23+
24+ echo ' finished'
Original file line number Diff line number Diff line change @@ -9,10 +9,15 @@ goto end
99:ok
1010
1111set OLDGOPATH = %GOPATH%
12- set GOPATH = %~dp0 ;
12+ set GOPATH = %~dp0 ;%~dp0 ..\thirdparty
1313
1414go clean -i -r studygolang
1515
16+ rd /s /q pid
17+ rd /s /q bin
18+ rd /s /q pkg
19+ del /q /f /a log
20+
1621set GOPATH = %OLDGOPATH%
1722
1823:end
File renamed without changes.
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ if [ ! -f restart ]; then
6+ echo ' restart must be run within its container folder' 1>&2
7+ exit 1
8+ fi
9+
10+ sh stop
11+ sh start
12+
13+ echo ' restart successfully'
Original file line number Diff line number Diff line change 1+ @ echo off
2+
3+ setlocal
4+
5+ if exist restart.bat goto ok
6+ echo restart.bat must be run from its folder
7+ goto end
8+
9+ :ok
10+
11+ :: stop
12+ taskkill /im studygolang.exe /f
13+ del /q /f /a pid
14+
15+ :: start
16+ start /b bin\studygolang >> log\panic.log 2 >& 1 &
17+
18+ echo restart successfully
19+
20+ :end
Original file line number Diff line number Diff line change @@ -8,3 +8,5 @@ if [ ! -f start ]; then
88fi
99
1010bin/studygolang >> log/panic.log 2>&1 &
11+
12+ echo " start successfully"
Original file line number Diff line number Diff line change 88
99:ok
1010
11- START /b bin\studygolang >> log\panic.log 2 >& 1 &
11+ start /b bin\studygolang >> log\panic.log 2 >& 1 &
1212
13- :end
14- echo finished
13+ echo start successfully
14+
15+ :end
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ if [ ! -f stop ]; then
4+ echo ' stop must be run within its container folder' 1>&2
5+ exit 1
6+ fi
7+
8+ kill -9 ` cat pid/* .pid`
9+
10+ sleep 1
11+ rm -rf pid/* .pid
Original file line number Diff line number Diff line change 99:ok
1010
1111taskkill /im studygolang.exe /f
12- del /q /f /a pid\studygolang.pid
12+ del /q /f /a pid
1313
14- :end
15- echo finished
14+ :end
You can’t perform that action at this time.
0 commit comments