Giter VIP home page Giter VIP logo

flask-shop's Introduction

Flask

Flask example

Usage

1. install virtualenv

$ pip install virtualenv
$ virtualenv venv
$ . venv/bin/activate
$ pip install -r requirements.txt

2. set environment or create config.json

Name Description
APP_MODE choose from production, development, testing
APP_HOST ip address
APP_PORT port number
DB_USER_NAME db user name
DB_USER_PASSWD db user password
DB_HOST db host
DB_NAME db name
REDIS_HOST redis ip address
REDIS_PASSWD redis password
TESTING if using test table true else false

3. db migrate

$ export FLASK_APP=apps.common.commands.manager
$ flask db stamp head
$ flask db migrate
$ flask db upgrade

migrate db tables

4. run test code

$ export FLASK_APP=apps.common.commands.manager
$ flask test

5. run flask server

$ python3 manage.py

if you do not install database, you can get the database connection error.

Command

test

$ export FLASK_APP=apps.common.commands.manager
$ flask test

run test code with unittest2

db

$ export FLASK_APP=apps.common.commands.manager
$ flask db
usage: Perform database migrations

Perform database migrations

positional arguments:
  {init,revision,migrate,edit,merge,upgrade,downgrade,show,history,heads,branches,current,stamp}
    init                Creates a new migration repository
    revision            Create a new revision file.
    migrate             Alias for 'revision --autogenerate'
    edit                Edit current revision.
    merge               Merge two revisions together. Creates a new migration
                        file
    upgrade             Upgrade to a later version
    downgrade           Revert to a previous version
    show                Show the revision denoted by the given symbol.
    history             List changeset scripts in chronological order.
    heads               Show current available heads in the script directory
    branches            Show current branch points
    current             Display the current revision for each database.
    stamp               'stamp' the revision table with the given revision;
                        don't run any migrations

optional arguments:
  -?, --help            show this help message and exit

perform database migrations

https://flask-migrate.readthedocs.io/en/latest/

flask-shop's People

Contributors

gureuso avatar

Watchers

 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.