Code Monkey home page Code Monkey logo

simpleblog's Introduction

Simpleblog

简介

这是一个使用 PythonFlask 框架,模仿简书, 写的一个简单的,适合多人使用的社交型网站。

地址

here

功能

  • 注册,登录
  • 发布文章
  • 文章点赞
  • 发布,回复,管理评论
  • 设置资料
  • 关注用户
  • 消息通知和私信
  • 管理员功能

本地使用

安装需要的库

$ pip install -r requirements.txt

更新数据库,获得角色权限

$ manage.py deploy

运行

$ manage.py runserver --host 0.0.0.0

打开本地浏览器访问127.0.0.1:5000即可。

Heroku部署

1.注册 Heroku 账户

2.安装Heroku Toolbelt,登录Heroku。

$ heroku login
Email: <youremail>
Password: <password>

3.创建app,这里我们要创建没有被注册过得app name.

$ heroku create <your appname>

4.配置数据库

$ heroku addons:add heroku-postgresql:hobby-dev

5.设置自己的环境变量,例如设置管理员邮件地址

$ heroku config:set ADMINEMAIL=<adminemail>

6.如果要使用Heroku部署,必须确保程序托管在Git仓库。如果已经确定所有程序都已经提交到Git仓库,需要把程序上传到远程仓库heroku。

$ git push heroku master

7.执行deploy命令

$ heroku run python manage.py deploy
$ heroku restart

执行成功,访问http://<youapp>.herokuapp.com/

8.如果程序运行中,发现bug需要改动。直接重复以上步骤,然后执行升级命令:

$ heroku maintenance:on
$ git push heroku master
$ heroku run python manage.py deploy
$ heroku restart
$ heroku maintenance:off

阿里云部署

觉得免费的Heroku太慢,并且有自己的服务器,想要部署线上。以阿里云部署为参考,利用Flask+WSGI+Nginx部署,亲测每页响应速度不到0.3s。

具体部署参考大神文章:文章地址

Enjoy it.

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.