Coder Social home page Coder Social logo

flaskdemo's Introduction

Windows下启动方式

Linux上的部署之后再写

1.建立并切换到python虚拟环境

切换到工程目录

virtualenv venv
.\venv\Scripts\activate

2.安装依赖

pip install -r requirements.txt

3.创建数据库

在虚拟环境中输入

python manage.py shell

进入交互环境

from app.models import db, Role
db.create_all()
Role.insert_roles()

数据库创建完成,数据库文件为data-dev.sqlite

4.启动

python start.py

访问网站 http://127.0.0.1:5000/

5. 访问所有界面

右上角有Log In按钮

点击有注册账户功能。

根据config.py文件中第7行

FLASKY_ADMIN_EMAIL = '[email protected]'

注册时若Email为[email protected],则新账户为管理员权限,可以访问所有界面。


2019.5.22 添加docker适配

需要先建立数据库。

python manage.py shell

from app.models import db, Role
db.create_all()
Role.insert_roles()

Dockerfile中将建立好的数据库data-dev.sqlite拷贝到docker workdir中。

建立docker image。

docker image build -t flaskdemo:latest .

启动container

docker container run -d --name flask -p 8000:8000 flaskdemo:latest


flask官方文档:http://flask.pocoo.org/docs/1.0/

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.