新建一个文件夹LightSeeking
由于是个全新的项目,所以创建一个虚拟环境来管理环境
当然本地需要先安装好python3
pip3 install virtualenv
virtualenv venv
运行后会提示创建成功和使用的python版本
(base) zhongxin:LightSeeking zhongxin$ virtualenv venv
created virtual environment CPython3.9.1.final.0-64 in 1328ms
creator CPython3Posix(dest=/Users/zhongxin/gitproject/LightSeeking/venv, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/zhongxin/Library/Application Support/virtualenv)
added seed packages: pip==22.2.2, setuptools==63.4.1, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
运行 venv\Scripts\activate
source venv/bin/activate
可以看到命令行前面增加了虚拟环境的标识
:(venv)
(base) zhongxin:LightSeeking zhongxin$ source venv/bin/activate
(venv) (base) zhongxin:LightSeeking zhongxin$
后面默认都是在虚拟环境中进行操作
在虚拟环境中运行
pip install django==3.2.11
django-admin startproject LightSeeking
这时候的项目结构如下,因为虽然代码是前后端分离的,但是人只有一个,所以后面会把前后端代码放到一个项目里面,把文件夹名称修改为backend
进入项目路径
运行python manage.py runserver
(venv) (base) zhongxin:LightSeeking zhongxin$ cd LightSeeking/
(venv) (base) zhongxin:LightSeeking zhongxin$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
August 16, 2022 - 07:31:51
Django version 3.2.11, using settings 'LightSeeking.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
访问http://127.0.0.1:8000/
注意需要使用Pycharm专业版
如果pycharm没有自动识别到虚拟环境的话需要手动添加
如果识别到了就不需要操作了
右下角点击解释器设置
在弹出的设置中点击「全部显示」
添加刚刚创建的虚拟环境
点击运行后再次访问http://127.0.0.1:8000/
将代码克隆到根路径的frontend
文件夹中
git clone https://gitee.com/lolicode/scui.git frontend
使用ls -al
查看全部文件(包含隐藏文件)
删除.git
文件夹
(base) (venv) zhongxin:frontend zhongxin$ ls -al
total 80
drwxr-xr-x 16 zhongxin staff 512 8 16 15:40 .
drwxr-xr-x 6 zhongxin staff 192 8 16 15:40 ..
-rw-r--r-- 1 zhongxin staff 186 8 16 15:40 .editorconfig
-rw-r--r-- 1 zhongxin staff 258 8 16 15:40 .env.development
-rw-r--r-- 1 zhongxin staff 173 8 16 15:40 .env.production
drwxr-xr-x 12 zhongxin staff 384 8 16 15:40 .git
drwxr-xr-x 4 zhongxin staff 128 8 16 15:40 .gitee
-rw-r--r-- 1 zhongxin staff 250 8 16 15:40 .gitignore
-rw-r--r-- 1 zhongxin staff 1063 8 16 15:40 LICENSE
-rw-r--r-- 1 zhongxin staff 2220 8 16 15:40 README.md
-rw-r--r-- 1 zhongxin staff 73 8 16 15:40 babel.config.js
-rw-r--r-- 1 zhongxin staff 230 8 16 15:40 jsconfig.json
-rw-r--r-- 1 zhongxin staff 1498 8 16 15:40 package.json
drwxr-xr-x 8 zhongxin staff 256 8 16 15:40 public
drwxr-xr-x 17 zhongxin staff 544 8 16 15:40 src
-rw-r--r-- 1 zhongxin staff 1688 8 16 15:40 vue.config.js
(base) (venv) zhongxin:frontend zhongxin$ rm -rf .git
需要电脑中已经安装好了node环境
使用淘宝源来加快下载速度
npm i --registry=https://registry.npmmirror.com
npm run serve
等待一段时间后
DONE Compiled successfully in 199451ms 下午3:50:54
App running at:
- Local: http://localhost:2800
- Network: http://172.28.56.35:2800
Note that the development build is not optimized.
To create a production build, run npm run build.
访问http://localhost:2800
在项目根路径输入
git init
新建一个.gitignore
文件来忽略不需要的文件
/venv/
.idea
/logs/logging.log
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
/package-lock.json
提交项目
$ git add .
$ git commit -m "项目创建"
推送项目
在gitee上新建了一个仓库:https://gitee.com/zx660644/light-seeking
将代码推送到gitee上
git remote add origin https://gitee.com/zx660644/light-seeking.git
git push -u origin "master"