GithubHelp home page GithubHelp logo

water-law / waterlawblog Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 13.44 MB

私人搭建的博客,欢迎 fork.

Home Page: https://www.waterlaw.top

License: BSD 3-Clause "New" or "Revised" License

Python 27.01% HTML 3.39% CSS 16.60% JavaScript 52.88% Dockerfile 0.02% Shell 0.10%

waterlawblog's Introduction

开发环境

Python3 + Django1.11.4 + virtualenv(虚拟环境)

数据库

默认采用 sqlite3 (无需安装,Python3 自带), 您可自行决定采用 pgsql9.6

如下操作在 linux 下您可自行参考:

启动 pgsql 数据库

使用 pgsql 命令行进入 blog 数据库,

psql blog

将系统用户添加为数据库用户

CREATE ROLE xxx WITH LOGIN SUPERUSER; # xxx是当前用户名

启用 HStore 插件(可选)

CREATE EXTENSION IF NOT EXISTS hstore;

安装 Python 相关库

进入项目根目录, 创建虚拟环境

pip3 install virtualenv

virtualenv -p python3.6 env

. ./env/bin/activate  # Windows 下执行 .\env\Scripts\activate.bat

pip install -r requirements.txt

执行数据库迁移文件

在虚拟环境下,执行

python./manage.py makemigrations

python./manage.py migrate

本地运行

python ./manage.py runserver

在浏览器输入 127.0.0.1:8000即可访问

邮件通知

如果你想收到网站异常时的邮件通知,可以在项目根目录下创建 email.txt 文件, 写入 163 邮箱的授权码, 其他邮箱请自行在 sites/settings 中配置

收集静态资源(nginx 代理使用)

python manage.py collectstatic

同步本地文件到服务器(可选)

进入本地项目根目录, 激活虚拟环境

./sync_to_server 187  # 187 在 sync_to_server 字典中对应服务器的项目地址

Nginx 部署(可选)

在 /etc/nginx/conf.d

sudo ln -s /home/zjp/waterlawblog/etc/nginx/conf/blog_187.conf /etc/nginx/conf.d/blog_187.conf

重启 nginx

nginx -s reload

进入服务器项目根目录, 激活虚拟环境 创建 product.txt 文件, 写入服务器的 ip

python ./manage.py runserver

访问 waterlaw.top 网站服务器到期了, 没有续费

帮助

如果你阅读此文档时仍有疑问,请阅读项目的 项目 Wiki

waterlawblog's People

Contributors

water-law avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.