Giter Site home page Giter Site logo

flask_bestpractices's People

Contributors

dependabot[bot] avatar gating avatar yangyuexiong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flask_bestpractices's Issues

404 NOT Found

Hi, I am new to the Flask. I have followed your guide in ReadMe that set the virtual env and env variable "FLASK_ENV" and "STARTUP_MODE". Then I run the run.py (masOS).

the terminal returns:
`时间:2020-06-10 23:32:47.230466
操作系统:Darwin
项目路径:/Flask_BestPractices
当前环境:development
启动方式:pyc
threading: 4623654336
当前进程id: 22563
父进程id: 17994
< ------------------------------------------------------------------ >

  • Serving Flask app "ApplicationExample" (lazy loading)
  • Environment: development
  • Debug mode: on
  • Running on http://0.0.0.0:9999/ (Press CTRL+C to quit)
  • Restarting with stat
    Linux或Darwin配置文件:/Flask_BestPractices/config/dev.ini
    < ------------------------------------------------------------------ >
    时间:2020-06-10 23:32:47.761835
    操作系统:Darwin
    项目路径:/Flask_BestPractices
    当前环境:development
    启动方式:pyc
    threading: 4398337472
    当前进程id: 22566
    父进程id: 22563
    < ------------------------------------------------------------------ >
  • Debugger is active!
  • Debugger PIN: 205-568-464`

When I click http://0.0.0.0:9999/ , the webset returns:
'
{
"code": 404,
"data": "GET /",
"message": "HTTPException:\u3010404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.\u3011"
}
'

I do not know what is my wrong? I would also like to know the meaning of the value "pyc" and "ter" for Variable "STARTUP_MODE".

Thank you !

Api result might also return a kind of response for webhooks

Only if not already done somewhere I missed, with a little refactor it looks like this:

def api_result(code=None, message=None, data=None, details=None, status=None):
    result = {
        'code': code,
        'message': message,
        'data': data,
        'details': details,
        'status': status
    }

    if not result['data']:
        result.pop('data')
    if not result['details']:
        result.pop('details')
    if not result['status']:
        result.pop('status')

    return jsonify(result)


def webhook_result(code=None, message=None, data=None, status=None, details=None):
    return api_result(
        code=code, message=message, data=data, details=details, status=status
    ), code

def api_result(code=None, message=None, data=None, details=None, status=None):

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.